Skip to content

Instantly share code, notes, and snippets.

@Getty
Created February 10, 2011 16:10
Show Gist options
  • Select an option

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

Select an option

Save Getty/820790 to your computer and use it in GitHub Desktop.
Sugar::Cane working
package Sugar::Cane;
# ABSTRACT: EXPERIMENTAL What you need to produce Sugar
use Moose ();
use Moose::Exporter;
use Moose::Util;
my ( $import, $unimport, $init_meta ) = Moose::Exporter->setup_import_methods(
with_meta => [ 'attributes' ]
);
sub import {
my $sugar_class = caller;
Moose::Exporter->setup_import_methods(
exporting_package => $sugar_class,
class_metaroles => {
class => [ 'Sugar::Cane::Meta::Trait::Class' ],
},
also => [ 'Moose' ],
);
goto $import;
}
sub attributes {
my ( $meta, %args ) = @_;
$meta->sugar_default_attributes(\%args);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment