Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Code Generation with Perl?

by demerphq (Chancellor)
on Oct 04, 2003 at 10:56 UTC ( #296490=note: print w/replies, xml ) Need Help??


in reply to Code Generation with Perl?

As others have pointed out Perl has a long heritage of code generation. Documentation that has been bundled with Perl for a long time explains some common usages. perltoot and perltootc. Data::Dumper, also bundled with Perl for ages is a classic code generator. Turning an in memory data structure into a program that should recreate the same data structure when evaled.

Since perl has a such powerful string manipulation abilities, and the handy eval and closure, dynamic run time code generation is a common and powerful technique for reducing coding overhead and error. Personally I've done a variety of funky code generation. Have a look at Algorithm::Treap for an example of using import() and code manipulation to turn a package into a class factory.

This area is well worth experimentation and once you are comfortable with it, use in production enviornments is perfectly acceptable.


---
demerphq

    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi


Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://296490]
help
Chatterbox?
[erix]: pretty :)
[Your Mother]: Yep, LanX, here is the reverse operation: perl -CSD -MEncode -MMIME::Base64 -E 'say decode_utf8( decode_base64(" 4oGZ"))'
[LanX]: Thanks Many thanks YM... it was already supposed to be encoded, I'll see tomorrow
[Your Mother]: I am entirely skeptical the wall will happen… but this country does love its boongdoggles now and then. :P
[Your Mother]: Did I tell or show you? There is a leucistic Turkey Vulture around here all the time. I have a couple decent pictures.
[Your Mother]: Pure white (well, dirty white :P)
[erix]: as a kid I had a painted bunting -- beautiful
[Your Mother]: I would love to see one. It would be a lifer.
[Your Mother]: Wait… maybe I did see one last year…
[Your Mother]: I saw what I thought was a Cuban trogon but they are too impossibly rare / never seen in the US. That guy might have been what I actually saw.

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2017-01-20 01:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (173 votes). Check out past polls.