PrePAN

Sign in to PrePAN

Profile

User's Modules

Object::Stash provides a Catalyst-like "stash" method for your class

The Catalyst context object has a method called stash, that provides a hashref for storing arbitrary data associated with the object. This is arguably a little hackish - the proper solution might be to create a slot for each piece of information you wish to store, with appropriate accessor methods. But often hackish will do.

Object::Stash sets up one or more stash methods for your class. How these methods are named depends on how Object::Stash is imported. Object::Stash is a role, like Object::New or Object::ID. This means you import it, but don't inherit from it.

tobyink@github 1 comment

Web::Magic HTTP dwimmery

Web::Magic understands XML, HTML, JSON, YAML, RDF/XML, RDF/JSON, Turtle, Atom and RSS. It can GET, it can POST, it can PUT, it can DELETE... hell, it can even BREW if you tell it to.

Web::Magic is lazy too; deferring the work (actual HTTP requests) until the last possible moment.

Web::Magic does what you mean.

Web::Magic is available on CPAN today.

tobyink@github 0 comments

MooseX::Syntax::Pluggable MooseX::Declare on drugs

This module does more or less the same as MooseX::Declare (without re-inventing the wheel - it gets MooseX::Declare to do the heavy lifting!) but also supports plugins to add further sugar to your syntax.

It also exports the TryCatch sugar.

tobyink@github 0 comments

MooseX::RoleFor limit the applicability of a Moose::Role

This package allows your Moose roles to limit what classes and objects they may be composed with. This is often not a good idea - one of the advantages of roles is that they can be reused in such different contexts.

However, if you search CPAN for "TraitFor" you'll see that it's quite a common desire to indicate that a role should only be applies to certain classes.

For those familiar with Moose internals, does the implementation look vaguely sensible?

It would also be nice I think to have some MooseX::Declare-style syntactic sugar for it:

use MooseX::Declare;
use MooseX::RoleFor::Declare;

role Watchdog for Dog {
  requires 'make_noise';
  method hear_intruder {
    $self->make_noise;
  }
}

tobyink@github 1 comment

Moan yet another "assert" module

Provides assertion functions.

Failed assertions are (by default) warnings, but can be made fatal, or silent, on a per package or per category basis, using, for example:

perl -Moan::fatally=MyApp::Maths addition.pl

tobyink@github 0 comments

DateTimeX::Format::Ago Formats past DateTime objects for human reading.

Ever wished DateTime::Format::Natural had a format_datetime method? This module provides human-friendly datetime formatting, outputting strings like "3 days ago".

Primary use case: websites that show a list of a person's recent activities.

tobyink@github 8 comments