Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: writing a pragma

by salva (Monsignor)
on Apr 25, 2014 at 15:42 UTC ( #1083803=note: print w/ replies, xml ) Need Help??


in reply to Re: writing a pragma
in thread writing a pragma

Well, strict is not a good example as it is just a thin wrapper to enable/disable functionality that is actually implemented on the C side of the perl interpreter.

How to write pragmas is documented in perlpragma. The entry for %^H in perlvar contains also some bits of information.


Comment on Re^2: writing a pragma
Download Code
Re^3: writing a pragma
by karthikasasanka (Acolyte) on Apr 26, 2014 at 03:28 UTC
    thanks for the answer. helped a lot. is there a way to write a module to work like strict. so that does something at compile time?
      is there a way to write a module to work like strict. so that does something at compile time?
        In Perl it is easy to do things at compile time. You have BEGIN for that.

        A different mater is changing how the program is compiled. perl provides some hooks for doing it, but AFAIK, it must be done at the C level and requires a pretty good knowledge of the internals. See perlguts.

        That really depends on exactly what you want to do at compile time, doesn't it? Some things are easier than others.

        use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2014-10-24 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (131 votes), past polls