User pragmas now visible from B

jjore on 2006-12-07T17:31:16

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?