Skip to content

Instantly share code, notes, and snippets.

@Getty
Created February 11, 2011 22:12
Show Gist options
  • Select an option

  • Save Getty/823146 to your computer and use it in GitHub Desktop.

Select an option

Save Getty/823146 to your computer and use it in GitHub Desktop.
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