Created
February 11, 2011 22:12
-
-
Save Getty/823146 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package Sugar::Factory; | |
| # ABSTRACT: EXPERIMENTAL The factory for producing your own Sugar | |
| use Sugar::Cane (); | |
| use Moose::Exporter; | |
| use Moose::Util; | |
| my ( $import, $unimport, $init_meta ) = Moose::Exporter->setup_import_methods( | |
| with_meta => [ 'attributes' ], | |
| class_metaroles => { | |
| class => [ 'Sugar::Factory::Meta::Trait::Class' ], | |
| }, | |
| ); | |
| sub import { | |
| my $sugar_class = caller; | |
| Moose::Exporter->setup_import_methods( | |
| exporting_package => $sugar_class, | |
| also => [ 'Sugar::Cane' ], | |
| ); | |
| goto $import; | |
| } | |
| use Data::Dumper; | |
| sub attributes { | |
| my ( $class, %args ) = @_; | |
| $class->sugar_default_attributes(\%args); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment