Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Module questions

by davorg (Chancellor)
on Apr 04, 2001 at 20:24 UTC ( [id://69721]=note: print w/replies, xml ) Need Help??


in reply to Re: Module questions
in thread Module questions

But you don't have to use CGI::Cookie as CGI.pm has the following line of code in its cookie function.

require CGI::Cookie;

Is that "clever module design"?

Oh, and it's "Perl", not "PERL".

--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me

Replies are listed 'Best First'.
Re: Re: Re: Module questions
by runrig (Abbot) on Apr 04, 2001 at 20:50 UTC
    The poster asked about mod_perl, so I'll add this:
    If you ARE using mod_perl, then in the mod_perl startup script, you'll want to include both 'use CGI' and 'use CGI::Cookie', as the cookie module does not seem to get included until runtime (after child processes are forked) even when doing 'use CGI qw(-compile :all);'.
Re: Re: Re: Module questions
by Anonymous Monk on Apr 05, 2001 at 14:52 UTC
    I tried not including CGI::Cookie and only haveing use CGI.

    Unforunately this did not work.

    It seems you have to include both.
      That does not seem correct, I ran this:
      #!/usr/bin/perl -l -w use strict; use CGI qw(:all); print for keys %INC; my $c = cookie('bob'); print "--------"; print for keys %INC;
      And got these results:
      $ ./tst | grep "^[C-]" Carp.pm CGI/Util.pm CGI.pm -------- Carp.pm CGI/Util.pm CGI/Cookie.pm CGI.pm
      So using just 'CGI' SHOULD work and load the CGI::Cookie module when you call the cookie function.
Re: Re: Re: Module questions
by satchboost (Scribe) on Apr 04, 2001 at 21:47 UTC
    Fair enough. That is clever module design. I suspect that it's also common module design, but it's not something that a beginner, as the poster indicated s/he was, would think about. In addition, it's listed among the common mistakes someone from C++ would make coming to PERL(!). It's certainly not what I thought about when I first started working on modules.

    And as long as you understood what I was talking about, it could've been peRl, Per1, or PerL. *grins* I don't want to start a flamewar, but that did seem a little nitpicky.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-03-29 13:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found