B::More - Additional introspection methods and functions


B-More documentation Contained in the B-More distribution.

Index


Code Index:

NAME

Top

B::More - Additional introspection methods and functions

DESCRIPTION

Top

Adds stuff I needed in B and wasn't there :-)

Feel free to email me with suggestions for other methods I can add.

B::SV METHODS

svref

Inverse of B::svref_2object.

B::PVMG METHODS

magic

Returns a string containing the types of all MAGIC.

magic TYPE

Returns the B::MAGIC object for the magic with specified type, or undef if no magic with that type was found.

FUNCTIONS

Top

defstash

Returns the default stash (main::) as B::HV object.

curstash

Returns the current stash (package) as B::HV object. Note that this only makes sense at compile time (in a BEGIN-block or in eval-string).

SEE ALSO

Top

B, perlguts

AUTHOR

Top

Matthijs van Duin <xmath@cpan.org>

Copyright (C) 2003 Matthijs van Duin. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


B-More documentation Contained in the B-More distribution.

# $Id: More.pm,v 1.4 2003/02/20 00:03:33 xmath Exp $

package B::More;

use 5.006;
use strict;
use warnings;

our $VERSION = "1.01";

use Carp;
use B;

require XSLoader;
XSLoader::load('B::More', $VERSION);

sub B::PVMG::magic : method {
	my $x = shift->MAGIC;
	my $type = shift;
	croak "Too many arguments for 'magic'" if @_;
	if (not defined $type) {
		for (; $x && $$x; $x = $x->MOREMAGIC) {
			$type .= $x->TYPE;
		}
		return $type;
	}
	for (; $x && $$x; $x = $x->MOREMAGIC) {
		return $x if $x->TYPE eq $type;
	}
	return;
}

1;

__END__