XS-Framework
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/XS/Framework/Manual/SVAPI/Stash.pod view on Meta::CPAN
Stash(__PACKAGE__, GV_ADD).mark_as_loaded(__MODULE__);
The typical sympthom to use C<mark_as_loaded> is the following error:
Can't locate MyModule/MyClass.pm in @INC
=head2 inherit()
void inherit (const Stash& parent)
void inherit (const panda::string_view& parent)
Links the current symbol table as the descendant class for C<parent> C<Stash>.
In other words, it the following construct:
Stash child("MyPackage::Child"); // or, better Stash(__PACKAGE__, GV_ADD)
child.mark_as_loaded(__MODULE__);
Stash base("MyPackage::Base");
child.inherit(base);
is equivalent to perl code:
package MyPackage::Child;
use parent qw/MyPackage::Base/;
If the C<parent> package is defined as C<string_view>, it will be automatically
added to Perl via C<GV_ADD>.
The C<inherit> is NULL-safe method; the exception will be thrown if it is
invoked on empty C<Stash>.
=head2 isa()
bool isa (const panda::string_view& parent, U32 hash = 0, int flags = 0) const
bool isa (HEK* hek) const
bool isa (const Stash& parent) const
The C<isa> method returns C<true> if the current C<Stash> exactly matches C<parent>
C<Stash> or if the current C<Stash> is child class for the C<parent> C<Stash>.
The similar code in Perl is
child_CLASS->isa(parent_CLASS);
Under the hood the method uses C<hv_common> function (see C<perlapi>).
=head2 bless()
Object bless () const;
This method creates new C<Object>, which is blessed into to the current package
(C<Stash>).
Object bless (const Sv& what) const;
This C<bless> method version works somewhat similiar to the following Perl
construction
my $class = ...;
my $obj = ...;
return bless $obj => $class;
i.e. if C<what> is already an object, it is blessed into the C<Stash>,
otherwise new C<RV*> created from the C<what> argument, and the
blessed object returned.
=head2 add_const_sub()
void add_const_sub (const panda::string_view& name, const Sv& val);
Creates subroutine C<name> that returns constant C<val> eligible for compile-time inlining (like newCONSTSUB). C<val> is retained and made readonly.
C<val> can be either any C<Scalar> or <Array>. In latter case, const sub will return list containing array's values.
=head1 SEE ALSO
L<XS::Framework>
L<XS::Framework::Manual::SVAPI>
L<XS::Framework::Manual::SVAPI::Sv>
L<XS::Framework::Manual::SVAPI::Hash>
=cut
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.646 second using v1.00-cache-2.02-grep-82fe00e-cpan-cec75d87357c )