Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi, i'm a newbie to Perl CGI programing. I'm using Debian system, the cgi files located in /usr/lib/cgi-bin/, and template files located in /var/www/
So, when I use Template in perl cgi, the CGI file path is like this: http://192.168.1.1/cgi-bin/main.cgi The image in it is: http://192.168.1.1/cgi-bin/t.jpg
Of course this would not work.
What should I do to make the image show itself? Thanks!
I'm using Template like this:
/usr/lig/cgi-bin/main.cgi:/var/www/template.tt#!/usr/bin/perl -w use Template; use CGI; my $file = '/var/www/template.tt'; my $vars={ msg=>"hello" }; my $cgi = CGI->new(); my $template = Template->new(); print $cgi->header(-type=>'text/html',-charset=>'utf-8'); $template->process($file, $vars) || die "Template process failed: ", $template->error(), "\n";
t.jpg located in /var/www/t.jpg<img src="sc1.jpg" />
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Template::Toolkit img path
by kcott (Archbishop) on Oct 14, 2010 at 06:45 UTC | |
|
Re: Template::Toolkit img path
by mjscott2702 (Pilgrim) on Oct 14, 2010 at 08:19 UTC | |
|
Re: Template::Toolkit img path
by Anonymous Monk on Oct 14, 2010 at 06:29 UTC |