Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of jjore (6662)

Thursday December 07, 2006
12:31 PM

User pragmas now visible from B

[ #31840 ]

User pragmas are now visible from B. Just get your most recent COP opcode and do this little dance to get a hash reference:

my $hints_hash_ref = $cop->hints_hash->HASH;
if ( $hints_hash_ref->{my_pragma} =~ /.../ ) {
    # Yay!

The B::COP method ->hints_hash returns a new kind of object B::RHE which is a refcounted_he struct which is an odd kind of he which is guts for a hash. I hate having to look that closely at implementation. I loath having to even mention that B::RHE exists but whatever. It's pretty ignorable as is.

This is the sugarless approach, I figure there's something better to be said here.

Maybe B::COP should have ->hints_hash_ref which would just encapsulate the above?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.