Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Internal representation of qr// compiled regular expressions

by japhy (Canon)
on May 23, 2006 at 00:18 UTC ( [id://551061]=note: print w/replies, xml ) Need Help??


in reply to Re: (tye)Re: Internal representation of qr// compiled regular expressions
in thread Internal representation of qr// compiled regular expressions

pp_ctl.c (in pp_regcomp()) shows that, if the regex has magic on (which means it's a qr// regex), it extracts the regexp struct from mg->mg_obj. So that's where the "meat" of a Regexp object is.

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re^4: Internal representation of qr// compiled regular expressions
by John M. Dlugosz (Monsignor) on May 24, 2006 at 03:24 UTC
    Wow, has it really been nearly five years?!

    So, is the mg_obj member in a different place from where normal representations are stored for scalars? Point is, I guess, is that it's done in a totally different way than just blessing a scalar, which is how we would do something within the Perl 5 language.

    —John

      Yes. The stringification of a Regexp object goes through the magic system. The mg_obj member is how a Regexp object points to the internal representation of itself (the regexp struct).

      Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
      How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

        And what is: '(?^u:' ?

        When inspecting (using the EPIC/Eclipse Perl debugger) the internal composition of a compiled regex (for example:

        my $var = qr/abc/;

        then $var shows as:

         '(?^u:abc)'

        What is '(?^u:' ?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2024-03-28 19:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found