[12241] in Perl-Users-Digest
Perl-Users Digest, Issue: 5841 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 31 14:07:20 1999
Date: Mon, 31 May 99 11:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 31 May 1999 Volume: 8 Number: 5841
Today's topics:
Re: Can I execute a string? (Collin Rogowski)
Case of Pathnames in NT <tomm2@worldnet.att.net>
Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Pe (Jim Weisgram)
Re: FAQ 7.23: How can I catch accesses to undefined var (Jos Backus)
Re: Fetch URL behind a proxy (Dave Cross)
flush the memory in DBlib SQL <lasteyrie@iname.com>
Re: Help! need fraction of a second time function <gellyfish@gellyfish.com>
Re: Help! need fraction of a second time function (Cameron Laird)
Re: How to format output ? (Larry Rosler)
Re: How to format output ? (Hansan Diwan)
Re: How to make a Beep(sound) via Perl ? <rootbeer@redcat.com>
Re: How to make a Beep(sound) via Perl ? <dgris@moiraine.dimensional.com>
Re: Incoming eMail -> Perl script -> Forward <rootbeer@redcat.com>
Re: perl -w, "uninitialized" variables, and the Perl la <macintsh@cs.bu.edu>
Re: Perl Newbee <bill@fccj.org>
Re: please help on finding longest string in file (Tad McClellan)
Protected directory (.htaccess) <karpat@eeh.ee.ethz.ch>
Re: Protected directory (.htaccess) <rootbeer@redcat.com>
Re: Quick way to count lines in file? (Fuzzy Warm Moogles)
Re: read files in Perl <mikep@nsis.com>
Re: read files in Perl <mikep@nsis.com>
Re: Read-Only values <rootbeer@redcat.com>
Re: Running a Background Process from CGI (Mark R.)
Re: Running a Background Process from CGI <gellyfish@gellyfish.com>
Re: Running a Background Process from CGI (Ronald J Kimball)
Re: Shorter solution ? (Fuzzy Warm Moogles)
Re: Trying to make custom start page for users via cook <gellyfish@gellyfish.com>
Re: Use binmode for binary files (Was: Re: PB writing a <uri@sysarch.com>
Re: Use binmode for binary files (Was: Re: PB writing a (Larry Rosler)
Re: where can i get a free Perl compiler on line? <dgris@moiraine.dimensional.com>
Re: Y2K infected Perl code <ralph@ee.net>
Re: Y2K infected Perl code <bill@fccj.org>
Re: Y2K infected Perl code <bill@fccj.org>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 31 May 1999 14:49:41 GMT
From: collin@rogowski.de (Collin Rogowski)
Subject: Re: Can I execute a string?
Message-Id: <3752a149.12997249@news.uni-X.net>
On Mon, 31 May 1999 01:41:59 +0100, "TheHat"
<ng@thehat.free-online.co.uk> wrote:
>I'm just learning PERL and have a question.
>I want to store the name of a variable in a string, and then later set that
>variable to a value.
>Is there a way to do this?
>I know in some languages you can put a line of code in a string and then
>execute the string. Can you do this in PERL?
>
> TIA
>
>Phil.
>
>
>
>
>
>
>
>
>
Yep
the function is called "eval" (like in most other languages as well)
------------------------------
Date: Mon, 31 May 1999 07:44:32 -0700
From: "Tom Milligan" <tomm2@worldnet.att.net>
Subject: Case of Pathnames in NT
Message-Id: <7iu798$180$1@birch.prod.itd.earthlink.net>
As we all know, most utilities on Win32 are case-insensitive when it
comes to pathnames (\XyZZy\Foo\Bar == \xyzzy\foo\bar), but Win
NT, at least, does preserve case when it comes to storing
the path info. I have an NT utility that is case-sensitive, so
when I do a Perl
e.g. system("mycmd \\xyzzy\\foo\\bar")
it will fail unless the case of XyZZY, Foo and Bar are correct. I
want/need a function that, when passed a valid windows pathname,
will look up that pathname in a case-insensitive way and return the
pathname with the correct case.
E.g. "correctcase(/xyzzy/foo/bar)" would return /XyZZy/Foo/Bar
I can use the DOS "dir" utility to deliver the correct case for the
leaf-node (Bar in the above example) , but not for the rest of the path.
Is there a simple answer that I'm overlooking? Has someone already
implemented or run-across such a Perl function or maybe even a
standard Windows utility that I could call but which I don't know about?
Thanks,
Tom Milligan
------------------------------
Date: Mon, 31 May 1999 17:41:45 GMT
From: jweisgram@hotmail.com (Jim Weisgram)
Subject: Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Message-Id: <3754c94a.3306135@news.ncn.com>
finsol@ts.co.nz wrote:
[...snip...]
>
>Why does the Perl community persist in denying that their applications
>could have Y2K problems instead of doing more to get the message out
>that the code needs to be checked. The stance that the Perl developers
>disputing this are taking is illogical, irresponsible and could cause
>serious problems for the organisations that continue to use the Perl
>code that remains unchecked.
>
Gee, I have seen post after post from "the Perl community" saying precisely that
perl applications could have Y2K problems, and that programmers using Perl must
evaluate their applications. Right in this thread.
>Jocelyn Amon
--
Jim Weisgram
Oregon Department of Transportation
email: jweisgram@hotmail.com
All opinions expressed are mine and not my employers (but they ought to be)
------------------------------
Date: 31 May 1999 15:29:30 GMT
From: jos@hal.mpn.cp.philips.com (Jos Backus)
Subject: Re: FAQ 7.23: How can I catch accesses to undefined variables/functions/methods?
Message-Id: <928164570.356830@dibbs1.mpn.cp.philips.com>
In article <375284ca@cs.colorado.edu>,
Tom Christiansen <perlfaq-suggestions@perl.com> wrote:
> How can I catch accesses to undefined variables/functions/methods?
But how about at compile time? use strict 'subs' doesn't cut it when the
function looks like one, i.e. it catches Fred ; but not Fred() ;
Thanks,
Jos
--
Jos Backus _/ _/_/_/ "Reliability means never
_/ _/ _/ having to say you're sorry."
_/ _/_/_/ -- D. J. Bernstein
_/ _/ _/ _/
Jos.Backus@nl.origin-it.com _/_/ _/_/_/ use Std::Disclaimer;
------------------------------
Date: Mon, 31 May 1999 16:24:50 GMT
From: dave@dave.org.uk (Dave Cross)
Subject: Re: Fetch URL behind a proxy
Message-Id: <3752b7b2.21718774@news.demon.co.uk>
On Mon, 31 May 1999 12:00:41 +0200, "Antonio Pascual"
<apa@jerez.micro.lucent.com> wrote:
>Anyone knows how to fetch a URL by http or ftp
>being behind a proxy server?.
If you look at perldoc lwpcook, it's covered in detail in there.
Dave...
--
Dave Cross <dave@dave.org.uk>
<http://www.dave.org.uk>
------------------------------
Date: 31 May 1999 15:55:12 GMT
From: Laurent de LASTEYRIE <lasteyrie@iname.com>
Subject: flush the memory in DBlib SQL
Message-Id: <7iubd0$tc2$1@news.x-echo.com>
I use the module Sybase::DBlib to use a database. I try to get sql resul
ts with
the command Sybase::DBlib->dbresults(). It works but when i try to
use a second sql command, i got that :
"
DB-Library error:
Attempt to initiate a new SQL Server operation with results pend
ing."
Does anyone can explain me the problem and how i can solve it.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Article poste via Voila News - http://www.news.voila.fr
Le : Mon May 31 17:55:12 1999 depuis l'IP : 193.49.1.61
------------------------------
Date: 31 May 1999 17:13:01 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help! need fraction of a second time function
Message-Id: <7iufut$4a6$1@gellyfish.btinternet.com>
On Fri, 28 May 1999 12:16:29 -0700 Larry Rosler wrote:
>
> In article <7imk4v$sp1$1@nnrp1.deja.com> on Fri, 28 May 1999 17:35:27
> GMT, Greg Fields <greg.fields@infoadvan.com> says...
>>
>> Is there anything out there that would allow me to track hundredths or
>> thousandths of a second?
>
> perldoc -f times
>
> The resolution is 'clock ticks', which may be 60 Hz, 100 Hz, or more.
>
On some Unix systems $ENV{HZ} will contain the value for 'ticks' but this
apparently is not the case for Linux. On Linux you might be able to use
/dev/rtc to get measurements upto 8192 Hz.
See /usr/src/linux/Documentation/rtc.txt for more on that.
Sounds like a good idea for a module actually.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 31 May 1999 12:17:28 -0500
From: claird@Starbase.NeoSoft.COM (Cameron Laird)
Subject: Re: Help! need fraction of a second time function
Message-Id: <7iug78$706$1@Starbase.NeoSoft.COM>
In article <5immi7.alq.ln@magna.metronet.com>,
Tad McClellan <tadmc@metronet.com> wrote:
>Greg Fields (greg.fields@infoadvan.com) wrote:
.
.
.
>: Is there anything out there that would allow me to track hundredths or
>: thousandths of a second?
>
>
> Perl FAQ, part 8:
>
> "How can I measure time under a second?"
.
.
.
I propose that the FAQ should also mention Win32::Timer.
--
Cameron Laird http://starbase.neosoft.com/~claird/home.html
claird@NeoSoft.com +1 281 996 8546 FAX
------------------------------
Date: Mon, 31 May 1999 09:15:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to format output ?
Message-Id: <MPG.11bc55822d24d0bc989b39@nntp.hpl.hp.com>
In article <brad-3105991222310001@brad.techos.skynet.be> on Mon, 31 May
1999 12:22:31 +0200, Brad Knowles <brad@shub-internet.org> says...
> In article <7itlst$t6$1@techftp.technion.ac.il>,
> s2845543@t2.technion.ac.il (Raz Uri ) wrote:
> > More specifically - I print a list of items and item counts in two rows,
> > and want the rows to have a constant width.
>
> See pp. 121-127 of _Programming Perl, 2nd Ed._ by Larry Wall, Tom
> Christiansen & Randal L. Schwartz, published by O'Reilly & Assoc.
>
> Or, see pp. 75-77 of _Perl in a Nutshell_, by Ellen Siever, Stephen
> Spainhour, & Nathan Patwardhan, published by O'Reilly & Assoc.
>
> This is probably also covered in the Perl FAQ, and who knows how many
> other places.
The 'other places' include the primary Perl documentation, which is
considerably more accessible than specific books.
The answer is found in perlfunc under sprintf, wherein particular
attention should be paid to the 'field width and precision' specifiers.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 31 May 1999 13:37:12 -0400
From: jackal@acm.rpi.edu (Hansan Diwan)
Subject: Re: How to format output ?
Message-Id: <7iuhc8$okr$1@delenn.acm.rpi.edu>
s2845543@t2.technion.ac.il (Raz Uri ) writes:
> More specifically - I print a list of items and item counts in two rows,
> and want the rows to have a constant width.
> How can I do that ?
perldoc perlform
--
Hasan Diwan
------------------------------
Date: Mon, 31 May 1999 07:54:11 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to make a Beep(sound) via Perl ?
Message-Id: <Pine.GSO.4.02A.9905310753120.24128-100000@user2.teleport.com>
On Mon, 31 May 1999, Gump Xu wrote:
> I want my Perl program to make a Beep (warn sound)
> when it ends. But I cannot find a function in Perl to do that.
Maybe you want to output the "\a" character to your terminal, which may
(or may not) cause your hardware to make the beep sound. Perl is software,
and tends to be quieter than hardware. :-) Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 31 May 1999 11:52:08 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: How to make a Beep(sound) via Perl ?
Message-Id: <m31zfxt9dj.fsf@moiraine.dimensional.com>
"Gump Xu" <gump_xu@sc.mcel.mot.com> writes:
> I want my Perl program to make a Beep (warn sound)
> when it ends.
END { print qq.\a. }
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: Mon, 31 May 1999 08:02:48 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Incoming eMail -> Perl script -> Forward
Message-Id: <Pine.GSO.4.02A.9905310758550.24128-100000@user2.teleport.com>
On Mon, 31 May 1999, Markus Gruen wrote:
> What I need to know: How am I able to read the STDIN (what is it??) to
> get the text of the mail ??
STDIN is a filehandle which you use to access the standard input stream to
your program. You can read about the input symbol <STDIN> in the section
about I/O operators in the perlop manpage. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 31 May 1999 15:24:22 GMT
From: John Siracusa <macintsh@cs.bu.edu>
Subject: Re: perl -w, "uninitialized" variables, and the Perl language spec
Message-Id: <7iu9j6$6tu$1@news1.bu.edu>
Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
>> * See "$foo = ${[split(' ', $goo)]}" in another recent clpm thread.
> Uh, that warning is because
> $foo = split()
> is *deprecated*. If you do ignore that warning, then sooner or later
> your code will *stop working*. So you can't blame that on -w.
See my other thread on the matter: my issue is that I *like* the
awk-like begavior of that form a split, and sometimes I *want*
the scalar result. I say just stop that call from squashing @_
and "un-deprecate" it. Anyway, see the other thread...
-----------------+----------------------------------------
John Siracusa | If you only have a hammer, you tend to
macintsh@bu.edu | see every problem as a nail. -- Maslow
------------------------------
Date: Mon, 31 May 1999 11:18:07 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: Perl Newbee
Message-Id: <3752a7e5.0@usenet.fccj.cc.fl.us>
In article <1dsn7nv.19q3ko1czp7l6N@p57.block2.tc4.state.ma.tiac.com>,
rjk@linguist.dartmouth.edu (Ronald J Kimball) wrote:
> Mike Likvan <mlikvan@home.com> wrote:
>
>> Can anyone help me sort out these questions?
>
> Not without seeing the code.
>
> --
> _ / ' _ / - aka -
> ( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
> / http://www.tiac.net/users/chipmunk/
> "It's funny 'cause it's true ... and vice versa."
What!?! Mr. Kimball? Not clairvoyant?!?
/^Humor$/
-Sneex- :]
______________________________________________________________________
Bill Jones Data Security Specialist http://www.fccj.org/cgi/mail?dss
Need to get started in Perl? See http://jacksonville.pm.org/Letter.cgi
------------------------------
Date: Mon, 31 May 1999 04:44:56 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: please help on finding longest string in file
Message-Id: <86iti7.k72.ln@magna.metronet.com>
tvn007@my-deja.com wrote:
: Would someone please help me with this problem ?
: I would like the output as follow:
: "longest input is: input3 has 10 elements
: #since input3 has ten 0/1
: #since input2 has five 0/1
: #since input 1 has one 0/1
------------------------
#!/usr/bin/perl -w
use strict;
my $size=0; # size of largest one seen so far
my $name; # name of that largest one
while (<DATA>) {
my($input, $value) = split /\s+=\s+|'/;
if ( $value > $size ) {
$size = $value;
$name = $input;
}
}
print "longest input is: $name has $size elements\n";
__DATA__
input1 = 1's0;
input2 = 5's01111;
input3 = 10's0000000110;
input1 = 1's0;
input2 = 5's00000;
input3 = 10's0001111100;
input1 = 1's1;
input2 = 5's11111;
input3 = 10's0111110111;
------------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 31 May 1999 18:34:45 +0200
From: Karpatchev Andrei <karpat@eeh.ee.ethz.ch>
Subject: Protected directory (.htaccess)
Message-Id: <3752BA25.344DD58B@eeh.ee.ethz.ch>
Could somebody help me in such question:
I have a directory protected with .htaccess.
Is it possible to open from my Perl-script the access for the user to
such directory,
by checking his password in script and saving the asking him for user
name /password
again by this standard .htaccess feature.
Thanks.
------------------------------
Date: Mon, 31 May 1999 10:07:01 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Protected directory (.htaccess)
Message-Id: <Pine.GSO.4.02A.9905311001410.24128-100000@user2.teleport.com>
On Mon, 31 May 1999, Karpatchev Andrei wrote:
> I have a directory protected with .htaccess. Is it possible to open
> from my Perl-script the access for the user to such directory, by
> checking his password in script and saving the asking him for user
> name /password again by this standard .htaccess feature.
It sounds as if you want to use Perl to update your .htaccess files.
That's easy to do with a module from CPAN. I think this is the one.
http://www.cpan.org/authors/id/LDS/HTTPD-User-Manage-1.53.tar.gz
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 31 May 1999 17:57:39 GMT
From: tgy@chocobo.org (Fuzzy Warm Moogles)
Subject: Re: Quick way to count lines in file?
Message-Id: <3753c8d1.70611184@news.oz.net>
On Mon, 31 May 1999 15:02:23 +0200, Marian Kelc
<marian.kelc@ruhr-uni-bochum.de> wrote:
>> Is there a quick/smart way of getting this information or do i have to
>> read every line and use a counter?
>
>while( <FILEHANDLE> ) { push @a, $_; ++$i }
@a = <FILEHANDLE>;
$i = @a;
--
Fuzzy | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=
------------------------------
Date: Mon, 31 May 1999 12:55:31 -0300
From: "Mike Power" <mikep@nsis.com>
Subject: Re: read files in Perl
Message-Id: <928166193.651.64@news.remarQ.com>
This may sound stupid.. but...
This snippet works great but I need to do the same thing but save it in
"$raw_code"
Nate <no@onehere.not> wrote in message news:37345355.32DF@onehere.not...
> Roberto wrote:
> >
> > Hi,
> > how can I read a file from another url using Perl script?
> > Thank you very much
> >
> >
> > -------------------------------------------
> > roberto azzimonti
> > mailto:roberto@mysacramento.com
> > http://www.mysacramento.com/azzimonti
> > -------------------------------------------
>
> From my site....
>
> #!/usr/local/bin/perl
>
> ## get_web_test.pl
>
> ###########################################################
> # Gets any web page's source and sends the HTML to the
> # browser, the output could have been stored in a file
> # at your site, or directed to further code that
> # parses the output and makes a web page based on the
> # information downloaded. This is the start of some
> # really cool scripts, the possibilities are endless!
> #
> # For more examples and free sources, visit www.nocrash.com
> ###########################################################
>
> use IO::Socket;
>
> #print "Content-Type: text/html\n\n";
>
> print "\n-BEGIN-\n";
>
> $host = "www.nasa.gov"; ## in this example we get
> 'www.nasa.gov/index.html'
> $document = "/index.html";
> $EOL = "\015\012";
> $BLANK = $EOL x 2;
>
> $remote = IO::Socket::INET->new( Proto => "tcp",
> PeerAddr => $host,
> PeerPort => "http(80)",
> );
> unless ($remote) { die "cannot connect to http daemon on $host"
> }
> $remote->autoflush(1);
> print $remote "GET $document HTTP/1.0" . $BLANK;
>
> ## we don't have to print here, you now have the page's source, do with
> it what you want!
>
> while ( <$remote> ) { print }
> close $remote;
>
> print "\n-END-\n";
>
> ***************************************************************
> Computer Problems? Free on-line solutions to your problems at:
> http://www.nocrash.com/ * Database of solutions, free!
> Drivers, DLL's, Programs, Free CGI Scripts, Programmer's Area
> ***************************************************************
------------------------------
Date: Mon, 31 May 1999 13:44:31 -0300
From: "Mike Power" <mikep@nsis.com>
Subject: Re: read files in Perl
Message-Id: <928169133.791.17@news.remarQ.com>
Ok .. I now deserve the DUH award for premature NG posting..
Just as I posted the question, I figured it out..
$raw_code = <$remote>;
Mike Power <mikep@nsis.com> wrote in message
news:928166193.651.64@news.remarQ.com...
> This may sound stupid.. but...
>
> This snippet works great but I need to do the same thing but save it in
> "$raw_code"
>
>
>
> Nate <no@onehere.not> wrote in message news:37345355.32DF@onehere.not...
> > Roberto wrote:
> > >
> > > Hi,
> > > how can I read a file from another url using Perl script?
> > > Thank you very much
> > >
> > >
> > > -------------------------------------------
> > > roberto azzimonti
> > > mailto:roberto@mysacramento.com
> > > http://www.mysacramento.com/azzimonti
> > > -------------------------------------------
> >
> > From my site....
> >
> > #!/usr/local/bin/perl
> >
> > ## get_web_test.pl
> >
> > ###########################################################
> > # Gets any web page's source and sends the HTML to the
> > # browser, the output could have been stored in a file
> > # at your site, or directed to further code that
> > # parses the output and makes a web page based on the
> > # information downloaded. This is the start of some
> > # really cool scripts, the possibilities are endless!
> > #
> > # For more examples and free sources, visit www.nocrash.com
> > ###########################################################
> >
> > use IO::Socket;
> >
> > #print "Content-Type: text/html\n\n";
> >
> > print "\n-BEGIN-\n";
> >
> > $host = "www.nasa.gov"; ## in this example we get
> > 'www.nasa.gov/index.html'
> > $document = "/index.html";
> > $EOL = "\015\012";
> > $BLANK = $EOL x 2;
> >
> > $remote = IO::Socket::INET->new( Proto => "tcp",
> > PeerAddr => $host,
> > PeerPort => "http(80)",
> > );
> > unless ($remote) { die "cannot connect to http daemon on $host"
> > }
> > $remote->autoflush(1);
> > print $remote "GET $document HTTP/1.0" . $BLANK;
> >
> > ## we don't have to print here, you now have the page's source, do with
> > it what you want!
> >
> > while ( <$remote> ) { print }
> > close $remote;
> >
> > print "\n-END-\n";
> >
> > ***************************************************************
> > Computer Problems? Free on-line solutions to your problems at:
> > http://www.nocrash.com/ * Database of solutions, free!
> > Drivers, DLL's, Programs, Free CGI Scripts, Programmer's Area
> > ***************************************************************
>
>
------------------------------
Date: Mon, 31 May 1999 08:08:36 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Read-Only values
Message-Id: <Pine.GSO.4.02A.9905310805370.24128-100000@user2.teleport.com>
On Mon, 31 May 1999, Nico van der Dussen wrote:
> I all of a sudden encountered a problem with an error message telling
> me: Modification of a read-only value attempted at ./test.pl line 221.
>
> The line involved is: $quotevalue = $dbn->quote($rawvalue);
My guess is that the real error is one or two lines previous to that one,
but the compiler didn't catch the problem until line 221. Could your
previous line be missing a semicolon, or have some other syntax error?
Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 31 May 1999 14:47:04 GMT
From: markro@nortelnetworks.com (Mark R.)
Subject: Re: Running a Background Process from CGI
Message-Id: <37529cfc.236664476@carnews0>
Bob,
Actually, I don't think it works. That was my first guess. Following
is my exact call:
system "$rs1CallPre $rs1CallPost > /tmp/.h.log";
Any ideas?
Mark
Bob Walton <walton@frontiernet.net> wrote:
>Put & after the Unix command in the system call.
>> I have a Perl-CGI script which makes a call to another script (not a
>> Perl script). I want the script which is called from the Perl script
>> to be run in the background. Is there any easy way to do this?
>> Presently, using the "system" command to make the call, the procedure
>> must be fully completed before the user sees the response page. The
>> procedure that I want in the background eventually emails the user
>> something. The reason I want it in the background is because it
>> updates web pages of data and depending on what the user selects, it
>> could take a very long time.
------------------------------
Date: 30 May 1999 11:47:56 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Running a Background Process from CGI
Message-Id: <7ir8hd$3ne$1@gellyfish.btinternet.com>
[ I have fixed the quoting but please do it yourself next time ]
On Sun, 30 May 1999 01:02:13 -0400 Bob Walton wrote:
> "Mark R." wrote:
>
>>
>> I have a Perl-CGI script which makes a call to another script (not a
>> Perl script). I want the script which is called from the Perl script
>> to be run in the background. Is there any easy way to do this?
>> Presently, using the "system" command to make the call, the procedure
>> must be fully completed before the user sees the response page. The
>> procedure that I want in the background eventually emails the user
>> something. The reason I want it in the background is because it
>> updates web pages of data and depending on what the user selects, it
>> could take a very long time.
>>
>
> Put & after the Unix command in the system call.
>
This will probably not do what the original poster wanted as the program
run by system() will inherit the STDIO of the parent the & ampersand
not withstanding. The server will not think that the program has
completed until the STDIO is closed thus the processing might continue
after the system() but the browser/server connection will remain open
until the program has completed.
I think that what is needed here is to fork(), close STDIN & STDOUT and
the exec() the program required:
#!/usr/bin/perl -w
use CGI qw(:standard);
$| = 1;
if (my $pid = fork)
{
print header,start_html("Blah blah");
print h1('Away we go ...');
print end_html();
}
else
{
close STDIN;
close STDOUT;
exec 'yourproghere'
die "couldnt exec - $!\n";
}
You probably want to do something a bit more sensible than simply die
if the exec failed - however it is too late to send anything back to
the client so putting amessage in the log will be enough.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Mon, 31 May 1999 13:24:35 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Running a Background Process from CGI
Message-Id: <1dso7s5.uao6og1nvkxs0N@p29.block2.tc4.state.ma.tiac.com>
Mark R. <markro@nortelnetworks.com> wrote:
> I have a Perl-CGI script which makes a call to another script (not a
> Perl script). I want the script which is called from the Perl script
> to be run in the background. Is there any easy way to do this?
> Presently, using the "system" command to make the call, the procedure
> must be fully completed before the user sees the response page. The
> procedure that I want in the background eventually emails the user
> something. The reason I want it in the background is because it
> updates web pages of data and depending on what the user selects, it
> could take a very long time.
I think you want to use fork(). The parent should print out the
response page and exit. The child should close STDOUT, and run the
system command.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Mon, 31 May 1999 17:25:10 GMT
From: tgy@chocobo.org (Fuzzy Warm Moogles)
Subject: Re: Shorter solution ?
Message-Id: <3752c32d.69167332@news.oz.net>
On Sun, 30 May 1999 20:06:52 -0700, lr@hpl.hp.com (Larry Rosler) wrote:
>UNTESTED (except in principle):
>
>my @regexen = (
> [ qr/X4/ => \*DATA ],
> [ qr/XY/ => \*DATA_XY ],
> [ qr/UP/ => \*XY_Z ],
> [ qr/DOWN/ => \*F2_DATA ],
> [ qr/MP/ => \*LS ],
> [ qr/C4/ => \*XYZ ],
>);
>
>for my $regex (@regexen) {
> next unless $in_file_name =~ /$regex->[0]/;
> my $fh = $regex->[1];
> print OUTFILE while <$fh>;
> close $fh;
> last;
>}
This should work the same. IOW, also UNTESTED.
my %fh = (
X4 => \*DATA ,
XY => \*DATA_XY ,
UP => \*XY_Z ,
DOWN => \*F2_DATA ,
MP => \*LS ,
C4 => \*XYZ ,
);
if ($in_file_name =~ /(X4|XY|UP|DOWN|MP|C4)/) {
my $fh = $fh{$1};
print OUTFILE while <$fh>;
close $fh;
}
--
Fuzzy | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=
------------------------------
Date: 30 May 1999 11:21:48 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Trying to make custom start page for users via cookie and perl. Help please?
Message-Id: <7ir70c$3mu$1@gellyfish.btinternet.com>
On 28 May 1999 14:15:08 -0500 SiKnight wrote:
>
> On my domain home page (http://home.siliconknight.com), I provide a
> news feed and weather report. I want to make it where the user can
> set the news feed to their preferences and change the weather report
> to their own hometown. I have NO clue as how to do this though.
Oh thats a shame. I think that you will probably want to ask in a group
that is interested in such matters - comp.infosystems.www.authoring.cgi
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 31 May 1999 11:55:38 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Use binmode for binary files (Was: Re: PB writing an uploaded file in perl (size changes!))
Message-Id: <x7emjxfd39.fsf@home.sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> Whether a file is 'text' or 'binary' depends on the program that writes
LR> the file, not on system properties. A 'text' file has an internal
LR> logical structure of records terminated by newlines (however represented
LR> in external storage by the particular implementation); a 'binary' file
LR> does not. The programmer knows this. All the time. And should use
LR> 'binmode' for binary files. All the time.
reasonable idea. but of course it never seems to get done.
LR> On output, binmode() translates each newline to its external
LR> representation as a record terminator; on input, it translates the
LR> external representation of a record terminator to a newline. Nothing
LR> more, nothing less.
i think you have it reversed. binmode allows for transparent i/o with no
modification of the i/o stream. the default i/o behavior (NON-binmode)
on winblows and others with this issue, will translate the file version
of line endings (CR/LF) to/from perl's stdio version of line endings
(\n).
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Mon, 31 May 1999 10:19:01 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Use binmode for binary files (Was: Re: PB writing an uploaded file in perl (size changes!))
Message-Id: <MPG.11bc6449d053dbfb989b3b@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <x7emjxfd39.fsf@home.sysarch.com> on 31 May 1999 11:55:38 -
0400, Uri Guttman <uri@sysarch.com> says...
> >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
> LR> Whether a file is 'text' or 'binary' depends on the program that writes
> LR> the file, not on system properties. A 'text' file has an internal
> LR> logical structure of records terminated by newlines (however represented
> LR> in external storage by the particular implementation); a 'binary' file
> LR> does not. The programmer knows this. All the time. And should use
> LR> 'binmode' for binary files. All the time.
>
> reasonable idea. but of course it never seems to get done.
That is because neither the teachers nor the books nor the docs present
it that way. It's like *always* checking the results of system calls.
Proper behavior has to be taught.
> LR> On output, binmode() translates each newline to its external
> LR> representation as a record terminator; on input, it translates the
> LR> external representation of a record terminator to a newline. Nothing
> LR> more, nothing less.
>
> i think you have it reversed. binmode allows for transparent i/o with no
> modification of the i/o stream. the default i/o behavior (NON-binmode)
> on winblows and others with this issue, will translate the file version
> of line endings (CR/LF) to/from perl's stdio version of line endings
> (\n).
I hope I didn't fool anybody with this goof.
A few more comments:
1. Tom Phoenix reminded me that where I said 'Nothing more, nothing
less." I overlooked that unless binmode() is used, a Control-Z character
is interpreted as input end-of-file on Windows/DOS systems.
2. On some legacy systems, records ('lines') are defined by structures
imposed by the file system, rather than by embedded characters in a byte
stream. On such systems, the binmode() distinctions become critical.
3. I have seen discussion (in p5p) about making the error message that
currently reports file position in 'chunks' report 'lines' if the value
of $/ is the default "\n". Good. Now also let it report 'records'
instead of 'chunks' in the other case. $/ is $INPUT_RECORD_SEPARATOR,
not $INPUT_CHUNK_SEPARATOR.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 31 May 1999 08:46:38 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: where can i get a free Perl compiler on line?
Message-Id: <m3d7zhthyp.fsf@moiraine.dimensional.com>
"Bastiaan S van den Berg" <office@asc.nl> writes:
> there is NO perl compiler
Wrong.
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: Sun, 30 May 1999 01:58:01 -0400
From: Ralph Daugherty <ralph@ee.net>
Subject: Re: Y2K infected Perl code
Message-Id: <3750D369.63CA2736@ee.net>
Scott McMahan wrote:
>
> > Sorry, are you saying that you have seen a specification for a *Perl*
> > program that prescribes the use of: $year = '19' . $year ? Whoaaa .
>
> The nice thing about Open Source is, you can always hack
> the interpreter to change any string concatenation of
> a three-digit number to the literal "19" to be an addition.
> Problem solved.
>
> Scott
Is this one of the brilliant Perl programmers that you guys are so
arrogant about? Problem solved. Yes indeed.
Ralph
------------------------------
Date: Mon, 31 May 1999 12:56:56 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: Y2K infected Perl code
Message-Id: <3752bf22.0@usenet.fccj.cc.fl.us>
In article <x7iu99gaqx.fsf@home.sysarch.com>, Uri Guttman <uri@sysarch.com>
wrote:
> i don't mean to be down on you, but why would you (or anyone) post a
> script if you are not a programmer? what bewilders me is why there is so
> much free perl/cgi stuff out there in those archives and how little was
> written by someone who IS a professional programmer.
Maybe because professional programmers know what it means to
'support' what they write; and being professional enough
not to torture the 'innocents' with code they (the non-
programmers) couldn't change themselves without
pestering the original programmer?
These non-programmers are posting, possibly, because
they see a need that isn't being met (discounting those
that want something for nothing.)
There is a market out there - maybe the
SourceXchange will help fill that need?
(No, this isn't an ad for SourceXchange;
but times are slowly changing...)
/^Just a Thought$/
-Sneex- :]
______________________________________________________________________
Bill Jones Data Security Specialist http://www.fccj.org/cgi/mail?dss
Need to get started in Perl? See http://jacksonville.pm.org/Letter.cgi
------------------------------
Date: Mon, 31 May 1999 13:06:06 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: Y2K infected Perl code
Message-Id: <3752c142.0@usenet.fccj.cc.fl.us>
[Cross-posts snipped...]
In article <iPn43.241$T7.36659@typhoon-sf.snfc21.pbi.net>,
snowhare@long-lake.nihongo.org (Benjamin Franz) wrote:
> In article <x7iu99gaqx.fsf@home.sysarch.com>,
> Uri Guttman <uri@sysarch.com> wrote:
>>>>>>> "K" == Kristina <kristina@greatbasin.net> writes:
>>
>> K> I could also mention that some of us who post scripts are not (as you can
>> K> see from my code) programmers, and thus could probably really benefit
>> K> from someone saying, "Hey, look, your stuff is broken. Look at the damn
>> K> man page for thus-and-so!" :)
>>
>>i don't mean to be down on you, but why would you (or anyone) post a
>>script if you are not a programmer? what bewilders me is why there is so
>>much free perl/cgi stuff out there in those archives and how little was
>>written by someone who IS a professional programmer.
>
> Not that bewildering, really. Most professional programmers have very
> little _time_ available for writing and supporting free scripts.
> I have lots of scripts I would like to write - and no time to
> do so.
Time is an issue, but more so is the
"individual's" project requirements and
scope creep.
Each 'individual' potentially has a different
requirement for what 'they' want done; while
I am not defending the 'script' archives, I
am stating they at least tried to meet a widely
sought after need.
Maybe, instead of writing FAQs, this group
could collaborate on fixing some widely
looked for scripts?
I mean, no offense to the poster, Uri, or the
group - but we are mostly prone to bitching or
RTFM'ing people. I say we should take a
break from clpm and maybe spend the time
re-writing a portable solution?
/^Just Another Thought$/
-Sneex- :]
______________________________________________________________________
Bill Jones Data Security Specialist http://www.fccj.org/cgi/mail?dss
Need to get started in Perl? See http://jacksonville.pm.org/Letter.cgi
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 5841
**************************************