Skip to content

Instantly share code, notes, and snippets.

@hideo55
Created July 4, 2011 15:05
Show Gist options
  • Save hideo55/1063449 to your computer and use it in GitHub Desktop.
Save hideo55/1063449 to your computer and use it in GitHub Desktop.
Moose coerce
package WWW::ImagePager;
use Any::Moose;
use Any::Moose '::Util::TypeConstraints';
use URI;
class_type 'URI';
coerce 'URI' => from 'Str' => via { URI->new(shift) };
has 'basepage' => ( is => 'rw', isa => 'URI', coerce => 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment