[19747] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1942 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 17 00:06:24 2001

Date: Tue, 16 Oct 2001 21:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1003291508-v10-i1942@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 16 Oct 2001     Volume: 10 Number: 1942

Today's topics:
    Re: Can't get the output for shell command from CGI <carfield@programmer.net>
        Checking if a file exists <CYNg@ntu.edu.sg>
    Re: Checking if a file exists <wyzelli@yahoo.com>
    Re: Checking if a file exists <tintin@snowy.calculus>
    Re: Checking if a file exists <CYNg@ntu.edu.sg>
    Re: Checking if a file exists <wyzelli@yahoo.com>
    Re: Checking the remote file (Chris Fedde)
        DB_File and messageboards <Gala@nonono.com>
        Entering Name-Value pairs - Still Confused <doctor_pericles@hotmail.com>
        HELP - QUICK Question!!! <doctor_pericles@hotmail.com>
    Re: HELP - QUICK Question!!! <tony_curtis32@yahoo.com>
    Re: Help on wait and get process ids.. (Rashyid)
        How do I pass a buffer to a C program? <thewriter@usa.com>
    Re: How do I pass a buffer to a C program? <bart.lateur@skynet.be>
    Re: How do I pass a buffer to a C program? (Martien Verbruggen)
    Re: HOW TO enter name value pairs manually? - STILL CON <doctor_pericles@hotmail.com>
        HOW TO enter name value pairs manually? <doctor_pericles@hotmail.com>
    Re: HOW TO enter name value pairs manually? <uri@sysarch.com>
    Re: how to find memory leaks in perl 5.004_04 <Tassilo.Parseval@post.rwth-aachen.de>
    Re: How to restore a filehandle tie correctly? <goldbb2@earthlink.net>
        HTML::FORM - Setting radio buttons in a form  <graham@purplemtn.com>
    Re: HTML::FORM - Setting radio buttons in a form <gisle@ActiveState.com>
        IE6 Error - Perl Output <rlally1@nycap.rr.com>
    Re: IE6 Error - Perl Output <Jon.Ericson@jpl.nasa.gov>
    Re: IE6 Error - Perl Output <rob_13@excite.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 17 Oct 2001 11:22:41 +0800
From: Carfield Yim <carfield@programmer.net>
Subject: Re: Can't get the output for shell command from CGI
Message-Id: <3BCCF981.5000804@programmer.net>

Ron Reidy wrote:

>Carfield Yim wrote:
>
>>I want to display a HTML of java code to my visitor, so I write the
>>following script to serve this:
>>
>>#!/usr/bin/perl -w
>>use CGI qw(param);
>>
>>print "Content-type: text/html";
>>
>>$command = "/usr/local/bin/java2html <
>>/server/http/java_store/applet/chat/src/com/lyrisoft/auth/mysql/Mysql.java
>>--title \"powered by java2html from gun.org\"|";
>>open(IN, $command) || die "cannot open file for reading: $!";
>>
>>while (<IN>) {  # read a line from the command into $_
>>    print $_;   # print that line to file $b
>>}
>>close(IN) || die "can't close file: $!";
>>
>>The $command can successful run at shell and display the HTML to
>>stdout, however in this CGI I get the following error:
>>
>>/usr/local/bin/java2html: unrecognized option
>>`--code=http://www.carfield.com.hk/java_store/SUN_j2se_runtime_lib_src_1.4/java/lang/String.java'
>>can't close file:  at /var/www/cgi-bin/java2html.pl line 14.
>>[Wed Oct 17 00:50:13 2001] [error] [client 10.0.0.1] Premature end of
>>script headers: /var/www/cgi-bin/java2html.pl
>>
>>why will this happen?
>>
>You open() command is suspicious.  If you want the output, you need to
>open like this: open(IN, "|$command") || die ...
>
>See perldoc perolfunc and look for open() and perldoc perlipc
>
The most strange is that why my domain appear as an option of java2html, 
do anyone know about this?
After I change the open() command and my perl script run successful at 
shell, I still can't run it as cgi...



------------------------------

Date: Wed, 17 Oct 2001 09:11:01 +0800
From: Ng Chze Yong <CYNg@ntu.edu.sg>
Subject: Checking if a file exists
Message-Id: <8D5C8824989A21458FFF1C3CE990203605875DBB@mail12.main.ntu.edu.sg>

Hi everyone,

i did something similar:
if (-e $file_location) { print "File exists!"; }
else { print "File does not exist!";}

When i execute this from command prompt, it works fine - file exist.
However when i execute this as part of a CGI script, it doesn't. I keep
getting negative results even though the file really exists. 

I am using ActivePerl 5.6.0.623 on Win2k. Can anybody pls help?

Thanks :)

CY


-----Original Message-----
From: Tony Curtis [mailto:tony_curtis32@yahoo.com]
Posted At: Tuesday, October 16, 2001 10:15 PM
Posted To: misc
Conversation: Checking if a file exists
Subject: Re: Checking if a file exists



[ top-posting rearranged ]

>> On Tue, 16 Oct 2001 09:46:59 +0100,
>> "Simon Pearce" <simonp@NOSPAM.dircon.co.uk> said:

> "Simon Pearce" <simonp@NOSPAM.dircon.co.uk> wrote in
> message news:9qgq4r$8d1$1@news6.svr.pol.co.uk...
>> Hi everyone :)
>> 
>> I have a CGI perl script that opens a particular
>> document to read info
> from
>> it.
>> 
>> What I would like to do is be able to check if that
>> file actually exists first - something like:
>> 
>> if (file.txt does not exist) { &file_error; }
>> 
> Thanks guys! That works great!  Simon

I assume you then want to go and read from the file.  Note
however that it is possible something could happen between
checking the file's existence and opening it for read.

The safer way would be simply to open the file for read.
If it's there, good, you now have a handle for reading its
contents.  If not, you can see why you were unable to open
it ($!).

hth
t
-- 
Oh!  I've said too much.  Smithers, use the amnesia ray.



------------------------------

Date: Wed, 17 Oct 2001 11:32:36 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Checking if a file exists
Message-Id: <yw5z7.31$bB1.790@wa.nnrp.telstra.net>

"Ng Chze Yong" <CYNg@ntu.edu.sg> wrote in message
news:8D5C8824989A21458FFF1C3CE990203605875DBB@mail12.main.ntu.edu.sg...
> Hi everyone,
>
> i did something similar:
> if (-e $file_location) { print "File exists!"; }
> else { print "File does not exist!";}
>
> When i execute this from command prompt, it works fine - file exist.
> However when i execute this as part of a CGI script, it doesn't. I keep
> getting negative results even though the file really exists.
>
> I am using ActivePerl 5.6.0.623 on Win2k. Can anybody pls help?

I would bet $file_location does not include a full path to the file.

Wyzelli
--
@x='074117115116032097110111116104101114032080101114108032104097099107101114
'=~/(...)/g;
print chr for @x;




------------------------------

Date: Wed, 17 Oct 2001 11:57:06 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Checking if a file exists
Message-Id: <3B5z7.7$Me1.55351@news.interact.net.au>


"Ng Chze Yong" <CYNg@ntu.edu.sg> wrote in message
news:8D5C8824989A21458FFF1C3CE990203605875DBB@mail12.main.ntu.edu.sg...
> Hi everyone,
>
> i did something similar:
> if (-e $file_location) { print "File exists!"; }
> else { print "File does not exist!";}
>
> When i execute this from command prompt, it works fine - file exist.
> However when i execute this as part of a CGI script, it doesn't. I keep
> getting negative results even though the file really exists.

I bet the path you are using to the file doesn't exist.




------------------------------

Date: Wed, 17 Oct 2001 11:17:19 +0800
From: Ng Chze Yong <CYNg@ntu.edu.sg>
Subject: Re: Checking if a file exists
Message-Id: <8D5C8824989A21458FFF1C3CE990203605875DBC@mail12.main.ntu.edu.sg>

I did try using relative path eg. "../../file.txt" and absolute path eg.
"c\:\\dir1\\dir2\\file.txt". Both work when executed from cmd line but
fail when executed from CGI. Any ideas?

Thanks,
CY

-----Original Message-----
From: Wyzelli [mailto:wyzelli@yahoo.com]
Posted At: Wednesday, October 17, 2001 10:03 AM
Posted To: misc
Conversation: Checking if a file exists
Subject: Re: Checking if a file exists


"Ng Chze Yong" <CYNg@ntu.edu.sg> wrote in message
news:8D5C8824989A21458FFF1C3CE990203605875DBB@mail12.main.ntu.edu.sg...
> Hi everyone,
>
> i did something similar:
> if (-e $file_location) { print "File exists!"; }
> else { print "File does not exist!";}
>
> When i execute this from command prompt, it works fine - file exist.
> However when i execute this as part of a CGI script, it doesn't. I
keep
> getting negative results even though the file really exists.
>
> I am using ActivePerl 5.6.0.623 on Win2k. Can anybody pls help?

I would bet $file_location does not include a full path to the file.

Wyzelli
--
@x='07411711511603209711011111610410111403208010111410803210409709910710
1114
'=~/(...)/g;
print chr for @x;




------------------------------

Date: Wed, 17 Oct 2001 13:30:41 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Checking if a file exists
Message-Id: <ff7z7.39$bB1.966@wa.nnrp.telstra.net>


"Ng Chze Yong" <CYNg@ntu.edu.sg> wrote in message
news:8D5C8824989A21458FFF1C3CE990203605875DBC@mail12.main.ntu.edu.sg...
> "Ng Chze Yong" <CYNg@ntu.edu.sg> wrote in message
> news:8D5C8824989A21458FFF1C3CE990203605875DBB@mail12.main.ntu.edu.sg...
> > Hi everyone,
> >
> > i did something similar:
> > if (-e $file_location) { print "File exists!"; }
> > else { print "File does not exist!";}
> >
> > When i execute this from command prompt, it works fine - file exist.
> > However when i execute this as part of a CGI script, it doesn't. I
> keep
> > getting negative results even though the file really exists.
> >
> > I am using ActivePerl 5.6.0.623 on Win2k. Can anybody pls help?
>
>> I would bet $file_location does not include a full path to the file.
>

> I did try using relative path eg. "../../file.txt" and absolute path eg.
> "c\:\\dir1\\dir2\\file.txt". Both work when executed from cmd line but
> fail when executed from CGI. Any ideas?
>

Please post in order (ie after the stuff you are responding to) - Posting
re-ordered

Permissions problem.

With CGI, the server runs as a very low privilege user.  Check permissions
for the directory and file you are trying to read.

Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";





------------------------------

Date: Wed, 17 Oct 2001 02:50:51 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Checking the remote file
Message-Id: <fm6z7.109$1L8.187441152@news.frii.net>

In article <699c9db.0110161320.4b25f063@posting.google.com>,
Peter Sun <sunpl@yahoo.com> wrote:
>Hi,
>
> if (-e "servername:/home/peter/file.txt") { print "The file does
>exist";}
>

Not much chance that is going to work. 
Try instead something on the lines of 

    system('rsh servername test -e /home/peter/file.txt');
    if ($? == 0) {
	print "The file does exist\n";
    } 

I tested this with ssh which exits with the exit code of the remote
command. IIRC rsh does the same thing.

Good Luck!
-- 
    This space intentionally left blank


------------------------------

Date: Wed, 17 Oct 2001 03:42:16 GMT
From: "Gala" <Gala@nonono.com>
Subject: DB_File and messageboards
Message-Id: <s67z7.24922$gT6.15430554@news1.rdc1.sfba.home.com>

Hi. I'm been mucking around with Perl for quite some time now and I am getting ready to great a forum (aka meesageboard. We
need a custom one for our site). I've been readaing up on DB_File. But I cant seem to find much info on how much it can hold.
So could someone please tell me if a DB_File db would be good and efficient for storing messages of that size? Or would it be
wiser to just sotre the author/subject/date stuff on the db and keep the message body in text files? Whats faster and more
reliable. Basically what are the pros and cons of each. Suggestions are all welocme. Thnks you.

-Gala




------------------------------

Date: Tue, 16 Oct 2001 21:49:24 -0600
From: "Dr. Kokinis" <doctor_pericles@hotmail.com>
Subject: Entering Name-Value pairs - Still Confused
Message-Id: <9qiust$h2s$1@coward.ks.cc.utah.edu>

> the cgi.pm docs explain this to you. you can either pass in param/value
> pairs on the command line or pass them in to stdin of the script.

Are these cgi-docs somewhere I can find?  I searched google and could not
find.

But more importantly, someone wrote:
> ... just requires you to type that data to the program after
> it runs (it will prompt you for that data). you can also pipe the data
> to it from a file or a program using the standard shell redirects and
such.

Yes, but HOW is this done?

For instance, I type:     perl -w mysscript.pl
It responds with:          (offline mode: enter name=value pairs on standard
input)

NOW WHAT???
In my example would I type

x_name (or would I type "x_name")  then what?  A return and then the value,
or a space and then the value???

Thanks





------------------------------

Date: Tue, 16 Oct 2001 20:24:57 -0600
From: "Dr. Kokinis" <doctor_pericles@hotmail.com>
Subject: HELP - QUICK Question!!!
Message-Id: <9qipuj$fje$1@coward.ks.cc.utah.edu>

How do I manually enter name-value pairs on the command line?

That is, what is the format to be used?  Quotes?

So if I want to pass "name1" with a value of "John"  what would I do?

Thanks




------------------------------

Date: Tue, 16 Oct 2001 21:40:42 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: HELP - QUICK Question!!!
Message-Id: <87adyrf0ph.fsf@limey.hpcc.uh.edu>

>> On Tue, 16 Oct 2001 20:24:57 -0600,
>> "Dr. Kokinis" <doctor_pericles@hotmail.com> said:

> How do I manually enter name-value pairs on the command
> line?  That is, what is the format to be used?  Quotes?

You enter one, then the other, in the format you require.

> So if I want to pass "name1" with a value of "John" what
> would I do?

Depends on what you're talking about.

So, what exactly are you talking about?  Databases?  CGI
(testing)?  Something else?

hth
t
-- 
Oh!  I've said too much.  Smithers, use the amnesia ray.


------------------------------

Date: 16 Oct 2001 19:02:23 -0700
From: rra@excite.com (Rashyid)
Subject: Re: Help on wait and get process ids..
Message-Id: <79c1319c.0110161802.1ada0c8b@posting.google.com>

Hi there Martin, 

Thanks for the response: Am reading through it and am trying to digest
everything in..

Ok.. what the subprocedures do:

A - Extract one table out from a DB
B - Load one table into another DB
C - Do a consistency check of the extract and load for one table..


so what would be happening 

Extract table 1

once finish extract load table 1

once finish load do consistency check.

after extracting from table 1 - extract from table 2 

therefore the extract and load after the first would be done
simultaneously
rather than one after the other, hence saving time.. There wont be any
overlap
as the extraction takes LOADS of more time compared to the other two.
it will be something like..

A1----finish---->A2----finish----->A3----finish---->A4----finish.....
       |                |                 |                 |
       |---->B1-->C1    |---->B2-->C2     |---->B3-->C3     |...


therefore it can be seen that A2 will run in parallel with B1 and then
C1, A3 with B2 and then C2... etc etc etc...and it goes on and on for
around 70 tables..

Rashyid









mgjv@tradingpost.com.au (Martien Verbruggen) wrote in message news:<slrn9so3dr.di2.mgjv@martien.heliotrope.home>...
> On 15 Oct 2001 23:56:37 -0700,
> 	Rashyid <rra@excite.com> wrote:
> > hi there again...
> 
> Hiya,
> 
> next time, please leave a bit of context in your posts. I only realised
> that this was a response to me because of my scoring system. otherwise I
> wouldn't have noticed it at all.
> 
> > well, actually i didn't make myslef clear... heres what i need to do
> > 
> > A------------>B-------------->C-------------->D--......
> >|             |               |               |
> >|             |               |               |
>  E             F               G               H
> >|             |               |               |
> >|             |               |               |
> > J             L               M               N
> 
> This is a bit of a bad diagram. It looks as if A fires off B and E, and
> E fires off J, and B fires off F and C, etc.
> 
> > from the diagram above, A,B,C....are *sub-procedures* that i need to
> > call.
> > 
> > each line shows a wait.. where, for eg once A finishes, E and B starts
> > and then when B finishes running, C and F starts and so on.. the
> > subprocedures basically are system calls that pass through variables
> > and process the results..
> > 
> > is there a syntax such like..
> > 
> > run A
> > 
> > if A finishes{run B; (run E and then J;)}
> > if B finishes{run C; (run G and then M;)}
> > if C finishes{run D; (run H and then N;)}
> 
> The answer was in the post that I sent to you.
> 
> # perldoc -f fork
> # perldoc -f wait
> # perldoc -f waitpid
> 
> Also read the perlipc documentaiton
> 
> # perldoc perlipc
> 
> You get the pid(s) from a(some) fork(s), you follow it with an exec of
> the program you need to exec. Then the parent waits for either all
> processes (wait, most likely), or for one process it is interested in
> (waitpid). When waitpid returns, you can be certain the child process
> has gone away.
> 
> Something like (pseudo code)
> 
> $pid = fork_and_exec A;
> 
> waitpid $pid;
> 
> fork_and_exec E
> $pid = fork_and_exec B
> 
> waitpid $pid
> 
> fork_and_exec F
> $pid = fork_and_exec C
> 
> etc..
> 
> You have not made it very clear what fires off J, L, M and N.
> 
> Oh.... wait... did you mean that J should be started as soon as E
> finishes? Then you either need to install a signal handler (which isn't
> always reliable), or you'll need more than one process managing this.
> Or, if you don't really need to start J immediately after E finishes,
> but just some time after, you could do something like:
> 
> 
> $pid = fork_and_exec A;
> 
> waitpid $pid;
> 
> $pid_e = fork_and_exec E
> $pid_b = fork_and_exec B
> 
> waitpid $pid_e;
> waitpid $pid_b;
> 
> If, however, those branches drawn above need to be independent, then
> maybe you could do something like:
> 
> 
> $pid = fork_and_exec A;
> 
> waitpid $pid;
> 
> fork_and_run (E followed by J)
> $pid = fork_and_exec B
> 
> waitpid $pid;
> 
> fork_and_run (F followed by L)
> $pid = fork_and_exec C
> 
> waitpid $pid;
> 
> BTW, if all of these 'subprocesses' are perl, you might not need to
> exec, but you could maybe just run them directly.
> 
> > and it goes on and on..
> > 
> > Sorry if this is a trivial question, but i am a newbie here..
> 
> It doesn't at all sound trivial to me, and I am not even sure that
> you've thought this through correctly. Depending on how long these
> processes run, you could end up with a large number of them running.
> Depending on what fires off J, L, M and N, you might end up with some
> geometric progression (Does every process fire off two children and wait
> for only one?) You haven't specified what you want to do with all the
> children that you are not waiting for. In principle you _should_ wait
> for them, or you'll end up with zombies, or you might need to do a
> double-fork trick to completely dissociate them, or something like that.
> Depending on that, you may need to install a signal handler for
> SIG_CHLD. You haven't specified at all whether there is a need for any
> communication of information between the processes either.
> 
> Maybe if you gave us a bit more of an idea of what those processes are
> supposed to be doing, we could be of more help. I've given you some
> outlines, but since your spec is so vague and underspecified, it is
> impossible to say what would be useful.
> 
> Martien


------------------------------

Date: Tue, 16 Oct 2001 19:19:05 -0400
From: "Bert Waller" <thewriter@usa.com>
Subject: How do I pass a buffer to a C program?
Message-Id: <493z7.2716$K8.269211@e3500-atl1.usenetserver.com>

What I need to do is this: Call a C program and pass it a buffer. The C
program will then change the buffer and pass it back to the original PERL
program.
Is this possible?
Thanks from a PERL newbie.....








------------------------------

Date: Tue, 16 Oct 2001 23:47:32 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: How do I pass a buffer to a C program?
Message-Id: <jfhpstkf5vdh57tt1p003rtglv7f7va0so@4ax.com>

Bert Waller wrote:

>What I need to do is this: Call a C program and pass it a buffer. The C
>program will then change the buffer and pass it back to the original PERL
>program.
>Is this possible?
>Thanks from a PERL newbie.....

How do you want to call the C program?

If you have the C source, and a usable compiler on your system, you
should check out the module Inline (on CPAN,
<http://search.cpan.org/search?dist=Inline>). Otherwise, if this really
is an external program, you'll have to rely on pipes or temp files and
command line options, or perhaps even sockets. See the standard doc:
perlipc.

-- 
	Bart.


------------------------------

Date: Tue, 16 Oct 2001 23:52:15 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: How do I pass a buffer to a C program?
Message-Id: <slrn9spi1f.l88.mgjv@verbruggen.comdyn.com.au>

On Tue, 16 Oct 2001 23:47:32 GMT,
	Bart Lateur <bart.lateur@skynet.be> wrote:
> Bert Waller wrote:
> 
>>What I need to do is this: Call a C program and pass it a buffer. The C
>>program will then change the buffer and pass it back to the original PERL
>>program.
>>Is this possible?
>>Thanks from a PERL newbie.....
> 
> How do you want to call the C program?
> 
> If you have the C source, and a usable compiler on your system, you
> should check out the module Inline (on CPAN,
><http://search.cpan.org/search?dist=Inline>). Otherwise, if this really
> is an external program, you'll have to rely on pipes or temp files and
> command line options, or perhaps even sockets.

Or shared memory, which seems to fit this bill a bit closer.

>                                                See the standard doc:
> perlipc.

Good advice.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | If at first you don't succeed,
Commercial Dynamics Pty. Ltd.   | destroy all evidence that you tried.
NSW, Australia                  | 


------------------------------

Date: Tue, 16 Oct 2001 21:47:20 -0600
From: "Dr. Kokinis" <doctor_pericles@hotmail.com>
Subject: Re: HOW TO enter name value pairs manually? - STILL CONFUSED
Message-Id: <9qiup1$h27$1@coward.ks.cc.utah.edu>

> the cgi.pm docs explain this to you. you can either pass in param/value
> pairs on the command line or pass them in to stdin of the script.
>
> so the former way can be done with:
>
> my_cgi_script foo=bar name=x_name value="test man"
>
> and the latter just requires you to type that data to the program after
> it runs (it will prompt you for that data). you can also pipe the data
> to it from a file or a program using the standard shell redirects and
such.

Yes, but HOW is this done?

I type

perl -w mysscript.pl
It responds with: (offline mode: enter name=value pairs on standard input)

NOW WHAT???
In my example would I type

x_name (or would I type "x_name")  then what?  A return and then the value,
or a space and then the value???

Thanks




------------------------------

Date: Tue, 16 Oct 2001 21:22:05 -0600
From: "Dr. Kokinis" <doctor_pericles@hotmail.com>
Subject: HOW TO enter name value pairs manually?
Message-Id: <9qit9m$gl0$1@coward.ks.cc.utah.edu>

I am trying to read a form that is posted to this perl script.

"x_name" is used to identify a text field
<input type="text" name="x_name" size=33 value="Test Man">

The perl script reads in variable like so:

$inform = new CGI;
@variables = $inform->param;
foreach $variable (@variables)
{
        $F{$variable} = $inform->param($variable);
        print "$variable $F{$variable}<BR>\n";
        $everything .= "$variable $F{$variable}\n";
}
$name = $F{'x_name'};


So how would I enter this into the perl script manually?

Would I type "x_name" (in quotes?) then <cr>? then "Bob Jones"?

I need to understand how to do this in order to debug the perl script.

Thanks




------------------------------

Date: Wed, 17 Oct 2001 03:26:11 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: HOW TO enter name value pairs manually?
Message-Id: <x7itdf54lh.fsf@home.sysarch.com>

>>>>> "K" == Kokinis  <doctor_pericles@hotmail.com> writes:

  K> "x_name" is used to identify a text field
  K> <input type="text" name="x_name" size=33 value="Test Man">

  K> So how would I enter this into the perl script manually?

  K> Would I type "x_name" (in quotes?) then <cr>? then "Bob Jones"?

  K> I need to understand how to do this in order to debug the perl script.

the cgi.pm docs explain this to you. you can either pass in param/value
pairs on the command line or pass them in to stdin of the script.

so the former way can be done with:

my_cgi_script foo=bar name=x_name value="test man"

and the latter just requires you to type that data to the program after
it runs (it will prompt you for that data). you can also pipe the data
to it from a file or a program using the standard shell redirects and such.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs  --------------------------  http://jobs.perl.org


------------------------------

Date: Wed, 17 Oct 2001 00:52:02 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: how to find memory leaks in perl 5.004_04
Message-Id: <3BCCBA12.8040804@post.rwth-aachen.de>

Jim Anderson wrote:

> I've got a socket server implemented in perl (5.004_04). It gradually
> eats up more and more memory until it eventually dies trying to fork a
> child, due to insufficient swap space.
> 
> When the process first starts, it takes up 23MB; just before it

                                            !!^^^^!!
Something wrong with your design. Better post some code to give us a 
chance to see how you did that.


> crashes, it's up to 200MB :-(


Tassilo


-- 
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};



------------------------------

Date: Tue, 16 Oct 2001 22:13:35 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: How to restore a filehandle tie correctly?
Message-Id: <3BCCE94F.D5198F42@earthlink.net>

David Coppit wrote:
> 
> Greetings all,
> 
> I'm trying to update CGI::Cache to play well with FCGI. The problem is
> that both want to tie to STDOUT.

Use the Source, Luke.  You don't need to do that, since CGI::Cache
already takes into account that STDOUT might already be tied.  Take a
look inside of start().

You do however have a different problem, specifically:
"Once a page has been cached in this fashion, then a subsequent visit to
that CGI script will check for an existing cache entry for the given key
before continuing through the code. If the file exists, then the cache
file's content is printed to the real STDOUT and the process exits
before executing the regular CGI code."

Your bigger problem is that you need to make it NOT exit, and instead do
another accept loop.

    FCGILOOP:
    while ($q = CGI::Fast->new) {
        local *CORE::GLOBAL::exit = sub {
            last FCGILOOP if shift;
            next FCGILOOP;
        };
        my $query = $q->Vars;
        my $regen = delete $query->{regenerate};
        CGI::Cache::set_key($query);
        CGI::Cache::invalidate_cache_entry()
            if $regen;
        CGI::Cache::start();
        ++$COUNTER;
        print "Content-type: text/html\n\n";
        print <<"    EOF";
        <html>
        <head><title>Fast CGI</title></head>
        <body>Counter: $COUNTER PID: $$</body>
        </html>
        EOF
        CGI::Cache::stop();
    }

This code is untested.
Note that normally [in non-fcgi], you wouldn't have to call stop
explicitly, though here you do.

-- 
"What does stupid old man mean pidgin talk? Shampoo does not talk like a
bird."


------------------------------

Date: Tue, 16 Oct 2001 17:48:26 -0600
From: Graham Knight <graham@purplemtn.com>
Subject: HTML::FORM - Setting radio buttons in a form 
Message-Id: <3BCCC74A.612E73D@purplemtn.com>


Please help me with a problem i am having.

Let's say i have a radio button in a form that looks like this:

INPUT TYPE=radio NAME=test VALUE="test"
INPUT TYPE=radio NAME=test VALUE="test2"


How do i use HTML::Form to set the value to 'test2'?

Here's what I'm trying:

	$input->value("test2");

Here's the result:

	Illegal value 'test2' at C:/Perl/site/lib/HTML/FORM.pm line 627.




thanks for any pointers.


Graham


------------------------------

Date: Wed, 17 Oct 2001 03:04:08 GMT
From: Gisle Aas <gisle@ActiveState.com>
Subject: Re: HTML::FORM - Setting radio buttons in a form
Message-Id: <m38zeboti9.fsf@ashn89-ty262h.bc.hsia.telus.net>

Graham Knight <graham@purplemtn.com> writes:

> Please help me with a problem i am having.
> 
> Let's say i have a radio button in a form that looks like this:
> 
> INPUT TYPE=radio NAME=test VALUE="test"
> INPUT TYPE=radio NAME=test VALUE="test2"
> 
> 
> How do i use HTML::Form to set the value to 'test2'?
> 
> Here's what I'm trying:
> 
> 	$input->value("test2");
> 
> Here's the result:
> 
> 	Illegal value 'test2' at C:/Perl/site/lib/HTML/FORM.pm line 627.

Can you post a complete (but still small) program that shows this error.

-- 
Gisle Aas


------------------------------

Date: Tue, 16 Oct 2001 23:02:50 GMT
From: "RSL" <rlally1@nycap.rr.com>
Subject: IE6 Error - Perl Output
Message-Id: <u03z7.21492$1%.5037749@typhoon.nyroc.rr.com>

Hi:

I modified my .htaccess so 404 errors cause a Perl CGI script to execute.
The
script has been modified to output a small amount of code to the browser
that says, "An Error has Occurred".

Now, when I enter the following URL which points to a file that does not
exist:  http://www.prophezine.com.fred.html    The CGI code outputs the text
message to the browser.  Unfortunately IE must somehow still see the 404 and
outputs its own Page Not Found to the browser instead of taking any code
that the CGI script has sent to the browser.

Is there an Environment  variable that holds the error code so I can change
it to something else?

Bob






------------------------------

Date: 16 Oct 2001 16:33:22 +0000
From: Jon Ericson <Jon.Ericson@jpl.nasa.gov>
Subject: Re: IE6 Error - Perl Output
Message-Id: <86vghfbl4d.fsf@jon_ericson.jpl.nasa.gov>

[comp.lang.perl removed from newsgroups]

"RSL" <rlally1@nycap.rr.com> writes:

> I modified my .htaccess so 404 errors cause a Perl CGI script to
> execute.  The script has been modified to output a small amount of
> code to the browser that says, "An Error has Occurred".
> 
> Now, when I enter the following URL which points to a file that does
> not exist: http://www.prophezine.com.fred.html The CGI code outputs
> the text message to the browser.  Unfortunately IE must somehow still
> see the 404 and outputs its own Page Not Found to the browser instead
> of taking any code that the CGI script has sent to the browser.
> 
> Is there an Environment variable that holds the error code so I can
> change it to something else?

This question is off-topic for c.l.p.misc.  The way to discern that is
to substitute other languages for the word Perl, and see if it still
makes sense.  Your issue is with IE, http, and (perhaps) CGI, not with
Perl.  Resources on those topics should be more helpful and
authoritative than this newsgroup.

Jon
-- 
  "Consider carefully what you hear," he continued. "With the measure
  you use, it will be measured to you--and even more.  Whoever has
  will be given more; whoever does not have, even what he has will be
  taken from him." -- Mark 4:24-25 (NIV)


------------------------------

Date: Wed, 17 Oct 2001 01:12:52 GMT
From: "Rob - Rock13.com" <rob_13@excite.com>
Subject: Re: IE6 Error - Perl Output
Message-Id: <Xns913CD7B52C4A1rock13com@64.8.1.226>

Jon Ericson <news:86vghfbl4d.fsf@jon_ericson.jpl.nasa.gov>:

> [comp.lang.perl removed from newsgroups]
> 
> "RSL" <rlally1@nycap.rr.com> writes:
> 
>> I modified my .htaccess so 404 errors cause a Perl CGI script
>> to execute.  The script has been modified to output a small
>> amount of code to the browser that says, "An Error has
>> Occurred". 
>> [But it doesn't work in IE...] 
>> 
>> Is there an Environment variable that holds the error code so
>> I can change it to something else? 

Yup, this is OT but I can see (sorta) how you could think it has 
something to do with Perl.

It is a configuration in IE. Tell it not to show "friendly" error 
pages. Then make sure your error outputs a decent amount of content 
(can't recall the number of bytes--do a search) or IE will ignore 
your error page if viewers have not adjusted their IE.

-- 
Rob - http://rock13.com/
Web Stuff: http://rock13.com/webhelp/


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 1942
***************************************


home help back first fref pref prev next nref lref last post