Thread View: pl.comp.lang.perl
4 messages
4 total messages
Started by Ruben Safir
Wed, 10 Dec 1997 18:56
PERL CGI Parsing
Author: Ruben Safir
Date: Wed, 10 Dec 1997 18:56
Date: Wed, 10 Dec 1997 18:56
24 lines
1577 bytes
1577 bytes
Hello Perhaps someone can help me with a CGI written in perl that I am working on. The script is taking data from a form which is user edited. It is then parsed or decoded, then looked up on a database file called ussaf.txt. When a matching key is found, it is the entire database is copied record by record into a new file, with the changed information. Then the newfile is renamed the old file. I seem to be having trouble with the two opened files. I am not being permited to open one file for reading and another for writing. When I get to the print DATAOUT command, I'm getting an error message in the Appache log as follows Undefined subroutine &main::DATAOUT called at /var/lib/httpd/cgi-bin/add_lable.cgi line 27 <DATAIN> chunk1. Ruben 75762.2332@compuserve.com
Re: PERL CGI Parsing
Author: Brad Bradley
Date: Wed, 10 Dec 1997 19:42
Date: Wed, 10 Dec 1997 19:42
13 lines
1250 bytes
1250 bytes
Ruben, Try posting some code so that we can help troubleshoot it. > I seem to be having trouble with the two opened files. > I am not being permited to open one file for reading > and another for writing. When I get to the print DATAOUT > command, I'm getting an error message in the Appache log > as follows > > Undefined subroutine &main::DATAOUT called at > /var/lib/httpd/cgi-bin/add_lable.cgi line 27 > <DATAIN> chunk1.
Re: PERL CGI Parsing
Author: Tom Phoenix
Date: Thu, 11 Dec 1997 06:09
Date: Thu, 11 Dec 1997 06:09
37 lines
2317 bytes
2317 bytes
On Wed, 10 Dec 1997, Ruben Safir wrote:
> Newsgroups: comp.lang.perl.misc, comp.os.linux.networking,
> pl.comp.lang.perl, uk.comp.os.linux, alt.os.linux.slackware
I'm not sure that this has anything to do with Linux networking, or even
anything Linux-specific. And did you have a special reason for including
pl.comp.lang.perl?
[ A screenful of irrelevant stuff snipped. :-) ]
> When I get to the print DATAOUT command, I'm getting an error message in
> the Appache log as follows
>
> Undefined subroutine &main::DATAOUT called at
> /var/lib/httpd/cgi-bin/add_lable.cgi line 27
> <DATAIN> chunk1.
When you get an unfamiliar error message from Perl, you can find it in the
perldiag manpage. This one's entry says:
=item Undefined subroutine &%s called
(F) The subroutine indicated hasn't been defined, or if it was, it
has since been undefined.
I'd say that you should look at line 27 of add_lable.cgi and see why Perl
thinks you're calling a sub called DATAOUT there. Maybe you put an
ampersand before the filehandle name DATAOUT?
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
Re: PERL CGI Parsing
Author: Nick Djurovich
Date: Fri, 12 Dec 1997 16:32
Date: Fri, 12 Dec 1997 16:32
60 lines
3081 bytes
3081 bytes
Ruben Safir wrote: > Hello > > Perhaps someone can help me with a CGI written in perl that I am > working on. > > The script is taking data from a form which is user edited. It > is then > parsed or decoded, then looked up on a database file called > ussaf.txt. > When a matching key is found, it is the entire database is copied > record by record into a new file, with the changed information. > Then the newfile is renamed the old file. > > I seem to be having trouble with the two opened files. > I am not being permited to open one file for reading A common problem is that a CGI script being run by the webserver normally has the USERID of 'nobody'. Or if not this, some other userid that isn't the same group as the user (you). What this means basically is that the permissions on the directory that you wish to read and write from, have to have WORLD or OTHER access. I suspect currently the CGI script hasn't permission to write to the directory. Do a man on chmod to get more info. Go to the directory where you want to read/write to and type : chmod o+rw . This gives (r)EAD and (w)RITE access to the (o)THER users ... which is basically any other id. Hmmm ... why does it think DATAOUT is a subroutine. I thinkyou have a syntax problem here. Are you sure you have opened the FILEHANDLE correctly ? eg open( DATAOUT, "> filename" );Perhaps because it couldn't open the file , this causes DATAOUT to be undefined as a filehandle and so it thinks it's a subroutine. Ideally, you should check the result of the open command, check, and flag and error if there's a problem. Never assume anything .. is a good motto. /Nick > Name: Nicholas Djurovich > E-Mail: etlndh@etlxdmx.ericsson.se > Phone: (0)1444 23 4179 > > Product Development Manager, Business Comms > Ericsson Telecommunications Ltd. > Burgess Hill, England > > Opinions : All or none of the opinions not expressed here > are not necessarily those of my own or of > anybody else that I don't know or haven't not > yet met. > > Disclaimer : I disclaim everything, I didn't do it, nobody > saw me, you can't prove anything.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads