Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How can I tell if an object is based on a regex?

by chromatic (Archbishop)
on May 31, 2007 at 17:57 UTC ( [id://618546]=note: print w/replies, xml ) Need Help??


in reply to How can I tell if an object is based on a regex?

The only reliable way I know is to look for regexp magic on the SV:

$ perl -MDevel::Peek my $r = qr/foo/; my $n = 'bar'; Dump( $r ); Dump( $n ); SV = RV(0x817fb18) at 0x8152cdc REFCNT = 1 FLAGS = (PADBUSY,PADMY,ROK) RV = 0x81535dc SV = PVMG(0x816dac8) at 0x81535dc REFCNT = 1 FLAGS = (OBJECT,SMG) IV = 0 NV = 0 PV = 0 MAGIC = 0x817c1f8 MG_VIRTUAL = 0x814ee88 MG_TYPE = PERL_MAGIC_qr(r) MG_OBJ = 0x8175270 STASH = 0x81530f0 "Regexp" SV = PV(0x8153b00) at 0x815360c REFCNT = 1 FLAGS = (PADBUSY,PADMY,POK,pPOK) PV = 0x816ba88 "bar"\0 CUR = 3 LEN = 4

Unfortunately, I don't have an easy way to do that from pure-Perl code. I've also never had the need to do so.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://618546]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-24 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found