Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts

    trouble passing params to script - specific scenario.

    Hi,

    been away for a while and am a bit rusty. I would appreciate a nudge with this issue, please.

    I have a main script, which establishes a $db_connect and a $session.

    It passes this to a doctype_and_header.pl - for outputting the, erm, doctype and the rest of the head section of the html output.

    Doctype_and_head.pl works out the $css values from a db_connection and uses them in the following line:
    Code:
    print qq(
        <link rel="stylesheet" href="/cgi-bin/stylesheets.pl/$css1$css2$css3" type='text/css' media='screen' />
      );
    Now, here's the problem...

    stylesheets.pl will load the existing $session using:

    Code:
    my $session = load CGI::Session($cgi) or die CGI::Session->errstr;
    But, how do I pass the $db_connect handle?

    I imagine it's not secure to store the $db_connect in the $session, even if possible. I have tried but i get an overload warning.

    And I wonder if establishing a connect specificallty for this script, is placing undue/unnecessary demands on the server.

    So, should I make a connection for stylesheet.pl and terminate it at the end of this script (as soon as it is finished its db job), or, is it possible to pass the existing $db_connect from doctype_and_head.pl using the html line above (or some other way)?

    Maybe there is a completely different way to output the css whilst keeping it as an external resource?

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #2
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,953
    Thanks
    2
    Thanked 172 Times in 167 Posts
    No, you can't pass the db object to another script like that; you'll need to create a new db object in stylesheets.pl.

    My first choice would be to do the css db calls in doctype_and_header.pl and drop stylesheets.pl and my second choice might be to do the db calls in stylesheets.pl.

    A much better choice for many reasons would be to use either Mason or Catalyst.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •