Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: Draft - Writng pluggable programs with perl.

by sutch (Curate)
on Jun 15, 2004 at 01:35 UTC ( #366742=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Draft - Writng pluggable programs with perl.
in thread Draft - Writng plugable programs with perl.

Why do you say that a context object too complex? Doesn't it help reduce complexity?

Imagine a web application framework that needs to pass the request, the response, a database handle, an error logging object, a template, a user information object, etc. What would you recommend in place of a context object to handle this?


Comment on Re^4: Draft - Writng pluggable programs with perl.
Re^5: Draft - Writng pluggable programs with perl.
by dragonchild (Archbishop) on Jun 15, 2004 at 12:16 UTC
    Where on earth are you passing these objects to and from?!? Oh, my Gods! Neither mod_perl nor CGI::Application are anywhere near that complex. Frankly, this is what parent processes and sessions are for.

    Now, you may say "Well, isn't a session a context object?" and you'd be right. But, a session contains only enough information to maintain state between requests. The rest should be handled with Singletons.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

      I agree that singletons make sense in certain situations.

      In my example above, I was considering that a web application framework was running under mod_perl and serving up multiple sites. So each site could potentially pass a database handle specific to the application requested via the URL, an error log specific to the application requested via the URL, a template object specific.... I'm curious, how would you recommend implementing a framework that requires many objects passed among the objects which make up the framework?

        So, you are talking about having an engine that would be common across sites, but the specifics are, well, specific to each site? Well, obviously you'd pass the right objects around, initialized with the right values from your config file(s). *shrugs* This is the reverse problem from the one the OP is proposing to solve. His problem is how to have an engine, like Mozilla, that would delegate tasks to various expert systems. The problem you're describing is how to customize the engine on the fly so that it behaves differently, depending on the context. I'm not seeing how solutions to the one deal with the other.

        ------
        We are the carpenters and bricklayers of the Information Age.

        Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

        I shouldn't have to say this, but any code, unless otherwise stated, is untested

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2014-09-16 23:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (53 votes), past polls