You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Purcell, Scott" <sp...@ltcgroup.com> on 2001/06/27 17:29:06 UTC

Startup.pl File Q

Mod_perl version: 1.25_01-dev
Perl version:         5.6.1
Apache Version:  1.3.20
OS:                    NT

I am in the apache book and I am doing some hacking. In my startup.pl file,
I put 'use CG qw(:standard); along with some other modules.
Anyway, then I typed that little dittie below, and commented out the $use
CGI (since I thought it would be loaded in the startup.pl file).

It does not work. Are the items in the startup.pl file only used with
handlers?

Thanks
Scott



### code below just for reference #####

#! /usr/local/bin/perl

#use CGI qw(:standard);
use strict;

my $name = param('name') || 'Anonymous';

print header(),
start_html(-title=>'Yo!',-bgcolor=>'blue'),
h1("Hello $name"),
p(
"To change your name, enter it into the text field below and press",
    em("change name.")
),
start_form(),
"Name: ",textfield(-name=>'name',-value=>'Anonymous'),
submit(-value=>'Change Name'),
end_form(),
hr(),
end_html();

Scott Purcell


Re: Startup.pl File Q

Posted by darren chamberlain <dl...@users.sourceforge.net>.
Purcell, Scott <sp...@ltcgroup.com> said something to this effect on 06/27/2001:
> Mod_perl version: 1.25_01-dev
> Perl version:         5.6.1
> Apache Version:  1.3.20
> OS:                    NT
> 
> I am in the apache book and I am doing some hacking. In my startup.pl file,
> I put 'use CG qw(:standard); along with some other modules.
> Anyway, then I typed that little dittie below, and commented out the $use
> CGI (since I thought it would be loaded in the startup.pl file).
> 
> It does not work. Are the items in the startup.pl file only used with
> handlers?

You still need to tell Perl that the script in question (e.g.,
the one you attached) needs to use the functions from CGI.
Without that line, "param" and friends are not defined.

Putting CGI in your startup.pl means that it will be required and
compiled only once; all the scripts/modules that need to make use
of the pre-compiled module still need to 'use' it. In these cases,
only the importing of subroutine names and stuff like that
happens.

As an aside, you could (possibly) get away with invoking the
param function as CGI::param; you didn't specify what kind of
"didn't work" you got in the error log.

(darren)

-- 
Every program has at least one bug, and at least one line of code
that can be removed.  Therefore, by induction, every program can
be reduced to one line of code that doesn't work.

Re: Startup.pl File Q

Posted by Stas Bekman <st...@stason.org>.
On Wed, 27 Jun 2001, Issac Goldstand wrote:

> Actually, I believe that it helps to do a use cgi qw(-compile: all) as this
> will pre-compile the entire module (which makes it go a bit faster for it's
> first request).

As Issac correctly said, but usually you don't want :all, but only the tag
groups that you really need. Scott, please refer to the guide, it explain
what, how and why.  Including memory measurement with different configs.

>
>    Issac
>
> ----- Original Message -----
> From: "Purcell, Scott" <sp...@ltcgroup.com>
> To: <mo...@apache.org>
> Sent: Wednesday, June 27, 2001 17:29
> Subject: Startup.pl File Q
>
>
> > Mod_perl version: 1.25_01-dev
> > Perl version:         5.6.1
> > Apache Version:  1.3.20
> > OS:                    NT
> >
> > I am in the apache book and I am doing some hacking. In my startup.pl
> file,
> > I put 'use CG qw(:standard); along with some other modules.
> > Anyway, then I typed that little dittie below, and commented out the $use
> > CGI (since I thought it would be loaded in the startup.pl file).
> >
> > It does not work. Are the items in the startup.pl file only used with
> > handlers?
> >
> > Thanks
> > Scott
> >
> >
> >
> > ### code below just for reference #####
> >
> > #! /usr/local/bin/perl
> >
> > #use CGI qw(:standard);
> > use strict;
> >
> > my $name = param('name') || 'Anonymous';
> >
> > print header(),
> > start_html(-title=>'Yo!',-bgcolor=>'blue'),
> > h1("Hello $name"),
> > p(
> > "To change your name, enter it into the text field below and press",
> >     em("change name.")
> > ),
> > start_form(),
> > "Name: ",textfield(-name=>'name',-value=>'Anonymous'),
> > submit(-value=>'Change Name'),
> > end_form(),
> > hr(),
> > end_html();
> >
> > Scott Purcell
> >
>



_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



Re: Startup.pl File Q

Posted by Issac Goldstand <is...@mail.jct.ac.il>.
Actually, I believe that it helps to do a use cgi qw(-compile: all) as this
will pre-compile the entire module (which makes it go a bit faster for it's
first request).

   Issac

----- Original Message -----
From: "Purcell, Scott" <sp...@ltcgroup.com>
To: <mo...@apache.org>
Sent: Wednesday, June 27, 2001 17:29
Subject: Startup.pl File Q


> Mod_perl version: 1.25_01-dev
> Perl version:         5.6.1
> Apache Version:  1.3.20
> OS:                    NT
>
> I am in the apache book and I am doing some hacking. In my startup.pl
file,
> I put 'use CG qw(:standard); along with some other modules.
> Anyway, then I typed that little dittie below, and commented out the $use
> CGI (since I thought it would be loaded in the startup.pl file).
>
> It does not work. Are the items in the startup.pl file only used with
> handlers?
>
> Thanks
> Scott
>
>
>
> ### code below just for reference #####
>
> #! /usr/local/bin/perl
>
> #use CGI qw(:standard);
> use strict;
>
> my $name = param('name') || 'Anonymous';
>
> print header(),
> start_html(-title=>'Yo!',-bgcolor=>'blue'),
> h1("Hello $name"),
> p(
> "To change your name, enter it into the text field below and press",
>     em("change name.")
> ),
> start_form(),
> "Name: ",textfield(-name=>'name',-value=>'Anonymous'),
> submit(-value=>'Change Name'),
> end_form(),
> hr(),
> end_html();
>
> Scott Purcell
>