Newsgroups: fj.lang.perl
Path: galaxy.trc.rwcp.or.jp!news.trc!nf2.iij.ad.jp!nr0.iij.ad.jp!news.iij.ad.jp!rim.or.jp!Q.T.Honey!sutnews.sut.ac.jp!news.join.ad.jp!wnoc-tyo-news!aist-nara!odins-suita!itserv.it.okayama-u.ac.jp!elecnews!libero!yama
From: yama@biotech.okayama-u.ac.jp (Mamoru Yamanishi)
Subject: Re: calling perl script from HTML
Sender: news@plasma.elec.okayama-u.ac.jp
Message-ID: <yama-1812971909240001@libero.biotech.okayama-u.ac.jp>
Date: Thu, 18 Dec 1997 10:09:24 GMT
Content-Type: text/plain; charset=iso-2022-jp
References: <349758e9.0@cwaix>
Nntp-Posting-Host: libero.biotech.okayama-u.ac.jp
Mime-Version: 1.0
Organization: Okayama Univ., Biotech. Dept.
X-Newsreader: NewsWatcher-J18 (2.1.6)
Lines: 57
Xref: galaxy.trc.rwcp.or.jp fj.lang.perl:2622
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.lang.perl&nb=2622&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.

> Could anyone tell me if I can call a perl script from HTML ?  (ie. 
client
> codes instead of server codes).

I cannot understand "client codes" and "server codes".
Please add explanations for me.

> However, the perl script returns a broken image.  Thus, it would be
good if
> the perl script returns a valid image, which I couldn't achieve too.

1st of all, please check the file mode of your perl script.  You _must_
set it executable.  And also incorporate the path for perl at the
top of the script; for example:

   #! /usr/bin/perl

2nd, please check the path for your script.  If the document root on
your server is "/usr/local/etc/httpd/htdocs", your document

>   <IMG SRC="http://cgi.abc.com/cgi-bin/Test.pl?abc=111">

_must_ be in "/usr/local/etcc/httpd/htdocs/cgi-bin/".

3rd hint I can show you is that you may write wrong path for
any other files which you include to your script by using "require"
and so on.  The "require"d files might be placed in other than regular 
path's, where is current directory or described in _your_ environment
variables.  In these cases, the script which return correct resut
executed
by hand returns bad while executed by httpd.  Please re-write the
path's for "require" to absolute path's.  For example:

   use
      require "/home/my_name/this_is_in_my_homedirectory.pl";

   instead of
      require "this_is_in_my_homedirectory.pl";

This is the same for the command path.  If you call other command
by system() or ``, you may meet the same result.  When you execute
your script by hand, "csh" and "perl" use your current environments.
While executed by httpd, httpd cannot pass your environments to your
script.  Therefore you should better to describe with absolute path's.
For example:

   use
      $answer = `some_command somefile.text`;

   instead of
     $answer = `/usr/local/bin/some_command somefile.text`;

I could show other hints if you want.

-- 
$B;3@>!!<i(B <yama@biotech.okayama-u.ac.jp>
086-251-8196, 086-251-8264(fax)
