RETVAL = sv_bless(newRV((SV*)instance), gv_stashpv(class, 0));
OUTPUT:
RETVAL
+
+SV*
+name(self)
+ SV *self
+ INIT:
+ SV **slot;
+ CODE:
+ if (!sv_isobject(self))
+ croak("Can't call name as a class method");
+ slot = hv_fetch((HV*)SvRV(self), "name", 4, 0);
+ RETVAL = slot ? SvREFCNT_inc(*slot) : &PL_sv_undef;
+ OUTPUT:
+ RETVAL
+
+SV*
+namespace(self)
+ SV *self
+ INIT:
+ SV **slot;
+ CODE:
+ if (!sv_isobject(self))
+ croak("Can't call namespace as a class method");
+ slot = hv_fetch((HV*)SvRV(self), "namespace", 9, 0);
+ RETVAL = slot ? SvREFCNT_inc(*slot) : &PL_sv_undef;
+ OUTPUT:
+ RETVAL
Creates a new C<Package::Stash> object, for the package given as the only
argument.
-=cut
-
=method name
Returns the name of the package that this object represents.
-=cut
-
-sub name {
- return $_[0]->{name};
-}
-
=method namespace
Returns the raw stash itself.
=cut
-sub namespace {
- return $_[0]->{namespace};
-}
-
{
my %SIGIL_MAP = (
'$' => 'SCALAR',