A program can constitute data (if that's what you mean by process). Certain programming languages treat the code as data, and a program can process it's own instructions.

Perl keeps a distinction between code and data. To make an object, you take some data, like a hash, and 'bless it'. This tells perl that if it sees a -> arrow, it should check to see if there is a subroutine for that object.

You can work around Perl's separation of data and code using the 'eval' command, which allows you to take data and run it as code.

You can also almost treat code as data. By saying that $code = sub { print "This is really code\n";} you can create a variable that 'holds' code. You can pass it to functions, put it in a hash, but you can't modify it.

CGI::Application could use any of the above methods to do it's code and data magic. You are certainly allowed to do it any way you like, but each way has it's limits for tricks you can do further down the line. Basically if it works for you, and it feels good, you should do it.

____________________
Jeremy
I didn't believe in evil until I dated it.


In reply to Re: Creating Applications Using OO Techniques. by jepri
in thread Creating Applications Using OO Techniques. by Revelation

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.