in reply to Creating Applications Using OO Techniques.
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.
|
|---|