#sub does_metaclass_exist { defined $METAS{$_[0]} }
#sub remove_metaclass_by_name { delete $METAS{$_[0]} }
-
sub name;
+sub namespace;
+
# The followings are Class::MOP specific methods
#sub version { no strict 'refs'; ${shift->name.'::VERSION'} }
sub get_attribute_list{ keys %{$_[0]->{attributes}} }
sub remove_attribute { delete $_[0]->{attributes}->{$_[1]} }
-sub namespace{
- my $name = $_[0]->{package};
- no strict 'refs';
- return \%{ $name . '::' };
-}
-
sub add_method {
my($self, $name, $code) = @_;
sub name { $_[0]->{package} }
+sub namespace{
+ my $name = $_[0]->{package};
+ no strict 'refs';
+ return \%{ $name . '::' };
+}
+
package
Mouse::Meta::Class;
INSTALL_SIMPLE_READER_WITH_KEY(Module, _method_map, methods);
INSTALL_SIMPLE_READER_WITH_KEY(Module, _attribute_map, attributes);
+HV*
+namespace(HV* self)
+CODE:
+{
+ SV** svp = hv_fetchs(self, "package", FALSE);
+ if(!(svp && SvOK(*svp))){
+ croak("No package name");
+ }
+ RETVAL = gv_stashsv(*svp, GV_ADDMULTI);
+}
+OUTPUT:
+ RETVAL
+
MODULE = Mouse PACKAGE = Mouse::Meta::Class
BOOT: