Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: How do I run .pl script from Unix command line, and pass CGI variables to it?

by Lori713 (Pilgrim)
on Dec 15, 2003 at 15:50 UTC ( [id://314830]=note: print w/replies, xml ) Need Help??


in reply to Re: How do I run .pl script from Unix command line, and pass CGI variables to it?
in thread How do I run .pl script from Unix command line, and pass CGI variables to it?

When I run summary.pl from the command line, I get the following message:

/local/www/htdocs/scripts/campus>nc_rpt_summary.pl Content-Type: text/html; charset=ISO-8859-1

Software error:

HTML::Template->new() : Cannot open included file nc_rpt.tmpl : file not found. 
at /usr/local/lib/perl5.8.0/site_perl/HTML/Template.pm line 1580 HTML::Template::_init_template
('HTML::Template=HASH(0x28a914)') called
at /usr/local/lib/perl5.8.0/site_perl/HTML/Template.pm line 1177 HTML::Template::_init
('HTML::Template=HASH(0x28a914)') called
at /usr/local/lib/perl5.8.0/site_perl/HTML/Template.pm line 1071 HTML::Template::new
('HTML::Template','filename','nc_rpt.tmpl',
'associate','CGI=HASH(0x1800ec)',

'global_vars',1) called
at .//nc_rpt_summary.pl line 56

For help, please send mail to this site's webmaster, giving this error message
and the time and date of the error.

Mon Dec 15 09:51:20 2003 nc_rpt_summary.pl: HTML::Template->new() :
Cannot open included file nc_rpt.tmpl : file not found. at /usr/local/lib/perl5.8.0/site_perl/HTML/Template.pm line 1580
Mon Dec 15 09:51:20 2003 nc_rpt_summary.pl: HTML::Template::_init_template('HTML::Template=HASH(0x28a914)') called
at /usr/local/lib/perl5.8.0/site_perl/HTML/Template.pm line 1177
Mon Dec 15 09:51:20 2003 nc_rpt_summary.pl: HTML::Template::_init('HTML::Template=HASH(0x28a914)') called at /usr/local/lib/perl5.8.0/site_perl/HTML/Template.pm line 1071
Mon Dec 15 09:51:20 2003 nc_rpt_summary.pl: HTML::Template::new('HTML::Template','filename','nc_rpt.tmpl','associate','CGI=HASH(0x1800ec)','global_vars',1) called at .//nc_rpt_summary.pl line 56

Lori update: added some breaks so the lines don't run across the page

  • Comment on Re: Re: How do I run .pl script from Unix command line, and pass CGI variables to it?

Replies are listed 'Best First'.
Re: How do I run .pl script from Unix command line, and pass CGI variables to it?
by Abigail-II (Bishop) on Dec 15, 2003 at 15:58 UTC
    I'd say, fix your environment first so that you can run your program from the command line. Now you're getting all kinds of file not found errors unrelated to your original problem.

    Abigail

      Unfortunately, I don't know how to fix my environment (actually, I don't know what's wrong with it). I was hoping by getting the summary.pl to run with some variables passed to it that it would have gotten previously I would get further along in my debugment efforts. The command line error at 56 is referring to a CGI variable that I usually would have passed to it, so it can't find the template because I haven't passed the correct variable info. (Does that make sense?)

      Lori

        Odd. CGI programs ran from the command line used to prompt the user for keyword/value pairs.

        Anyway, have you read the DEBUGGING section in the CGI.pm manual page?

        Abigail

Re: Re: Re: How do I run .pl script from Unix command line, and pass CGI variables to it?
by derby (Abbot) on Dec 15, 2003 at 16:25 UTC
    Your template paths are relative:

    my $template = HTML::Template->new( filename => 'nc_mainmenu.tmpl', ...

    So either change those to be absolute (/path/to/nc_mainmenu.tmpl) or copy the templates to the directory you're executing the offline script from or check the webserver configuration to see if HTML_TEMPLATE_ROOT is set to something - if so, set your offline environment to have that same variable.

    -derby

      All my files (.pl's and .tmpl's) are in the same directory. Once I pass the CGI variable to it (as Abigail-II pointed me to above), the script runs and generates the HTML based on the template. So I think I have the template paths set up correctly (crossing fingers!). Thanks for your clarification!

      Lori

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-25 22:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found