[17640] in Perl-Users-Digest
Perl-Users Digest, Issue: 5060 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 8 03:08:17 2000
Date: Fri, 8 Dec 2000 00:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <976262712-v9-i5060@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 8 Dec 2000 Volume: 9 Number: 5060
Today's topics:
Re: ActivePerl Problem (Homer Simpson)
Re: ActivePerl Problem <joelnelson@home.com>
Re: ActivePerl Problem <cmon_209@hotmail.com>
Re: Alternating Prints from Two Files <e.roselli@volusoft.com>
Re: Apache on Linux - Error on scripts called thru brow <joelnelson@home.com>
Re: Apache on Linux - Error on scripts called thru brow (Rafael Garcia-Suarez)
behavior of open "+>>" <johnlin@chttl.com.tw>
Re: behavior of open "+>>" <joe+usenet@sunstarsys.com>
Re: behavior of open "+>>" <johnlin@chttl.com.tw>
Re: Compiled Perl modules. <bwalton@rochester.rr.com>
Re: Compiled Perl modules. <dan@tuatha.sidhe.org>
Re: CSS files in a cgi script (Chris Fedde)
Re: CSS files in a cgi script (Tim Hammerquist)
Re: GD.pm constructor hangs <bwalton@rochester.rr.com>
Re: HASH OF LISTS - Question (Eric Bohlman)
help with form encoding <preetham@india.hp.com>
Re: How could I get the time of a server? <sgp22@ipartner.net>
Re: how to get DOS 8.3 current directory (Eric Bohlman)
Newbie Perl CGI and Netscape Prob <bill.jeanes@gte.net>
Re: newbie question about flatfiles (Chris Fedde)
Re: Offtopic: Can this script be done in a one-liner <derekr@escape.ca>
Opening Location thru Perl-CGI <kartik_4u@yahoo.com>
Re: Opening Location thru Perl-CGI <bwalton@rochester.rr.com>
Re: Precedence, or other ??? <bwalton@rochester.rr.com>
Re: Precedence, or other ??? (Chris Fedde)
Re(OT): Can this script be done in a one-liner with sed <derekr@escape.ca>
Re: Re(OT): Can this script be done in a one-liner with (Tad McClellan)
Re: Re(OT): Can this script be done in a one-liner with (Ilya Zakharevich)
Redirection? <enigmabomb@home.gotohellspammers.ihopeyourotinghellyouspamminggarbage.com>
Sending email attachments <pastry1001@aol.com>
Re: Sending email attachments (Chris Fedde)
Tripod Perl users? <shanen@my-deja.com>
Re: Use PERL or Java? Which is faster? <kenny@kennypearce.net>
Win32::Process::Create Question on Win98 <fischerm@my-deja.com>
Re: Win32::Process::Create Question on Win98 (Sam Holden)
Re: Yesterdays Date (Randal L. Schwartz)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Dec 2000 06:21:45 GMT
From: homer.simpson@springfield.nul (Homer Simpson)
Subject: Re: ActivePerl Problem
Message-Id: <90pulp$pls$0@216.39.130.77>
In article <90p262$6ae$1@nnrp1.deja.com>, alazarev1981@my-deja.com wrote:
>I've installed ActivePerl 5.6.0.620 on my windows NT. I can run my file
>(blah.cgi) from the command line and it works perfectly, spits out the
>html taged code with no errors. However, when I try to run that same
>script from an HTML form (action="blah.cgi") it doesn't work. All I get
>is the .cgi file literally printed into my browser.
>
>I have the exact same files running and working on a unix server, so I
>think the error is not in my code.
>
>I suspect the problem is in the first line of the .cgi file:
>#!/usr/local/bin/perl
>
>That line is needed for the unix server, but should it be changed for
>ActivePerl on a WinNT system?
>
lines with a # sign are comments.
On Unix file systems setting the execute attribute on the file causes the
shell to understand that the comment is the path to the interpreter.
This is not the case on dos-derived systems like NT. None of the CGI scripts
I run on IIS have a ShBang line and they run just fine.
More likely your webserver doesn't understand that file is an executable. Try
renaming it with a .pl extention... my NT installation knows that .pl is a
Perl file... I would assume yours does as well
good luck
------------------------------
Date: Fri, 08 Dec 2000 06:28:31 GMT
From: Joel Nelson <joelnelson@home.com>
Subject: Re: ActivePerl Problem
Message-Id: <3A307F69.138946D1@home.com>
alazarev1981@my-deja.com wrote:
> I've installed ActivePerl 5.6.0.620 on my windows NT. I can run my file
> (blah.cgi) from the command line and it works perfectly, spits out the
> html taged code with no errors. However, when I try to run that same
> script from an HTML form (action="blah.cgi") it doesn't work. All I get
> is the .cgi file literally printed into my browser.
Your web server is misconfigured for running .cgi scripts.
> I have the exact same files running and working on a unix server, so I
> think the error is not in my code.
Quite possibly.
> I suspect the problem is in the first line of the .cgi file:
> #!/usr/local/bin/perl
Thats not the problem. However, when you get the web server configured
correctly you will get 'Internal Server Error' because your shebang line
'#!/usr/local/bin/perl' is indeed incorrect. It should point to your perl
executable something like '#!d:\perl\bin\perl'. Note the slashes are
windows style but just for that line.
> That line is needed for the unix server, but should it be changed for
> ActivePerl on a WinNT system?
See last statement.
------------------------------
Date: Fri, 08 Dec 2000 07:16:03 GMT
From: CM <cmon_209@hotmail.com>
Subject: Re: ActivePerl Problem
Message-Id: <90q1rh$u47$1@nnrp1.deja.com>
In article <90p262$6ae$1@nnrp1.deja.com>,
alazarev1981@my-deja.com wrote:
> I've installed ActivePerl 5.6.0.620 on my windows NT. I can run my
file
> (blah.cgi) from the command line and it works perfectly, spits out the
> html taged code with no errors. However, when I try to run that same
> script from an HTML form (action="blah.cgi") it doesn't work. All I
get
> is the .cgi file literally printed into my browser.
Have you configured your Perl for the Server Software that you are
using?The server software could be IIS/Apache etc.
>
> I have the exact same files running and working on a unix server, so I
> think the error is not in my code.
This is because the Server software does not undertand the
extension .cgi and is simply throws it as output.
You have to explictly mention to your server that when encounterd with
the .cgi extension use the Perl.exe to execute the script.This can be
accomplished by making entries in the Server software
>
> I suspect the problem is in the first line of the .cgi file:
> #!/usr/local/bin/perl
>
> That line is needed for the unix server, but should it be changed for
> ActivePerl on a WinNT system?
You do not need the above lines for Perl on windows!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 8 Dec 2000 08:41:12 +0100
From: "Elisa Roselli" <e.roselli@volusoft.com>
Subject: Re: Alternating Prints from Two Files
Message-Id: <90q3b2$ldm$1@wanadoo.fr>
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> a écrit dans le message
news: 90ov3u$fp6$1@lublin.zrz.tu-berlin.de...
> while ( <HEAD> ) { # run all lines of HEAD through $_
> last if eof TAIL; # ...unless TAIL runs out of data
> chomp; # we don't want a newline in the middle, it's
confusing
> $_ .= <TAIL>; # append line from tail. keep final newline
> print; # output the line
> }
If I get a moment today, I'll see what I can do with that. However, one
thing I don't want is to stop the copying if one or the other file runs out
of lines. It's perfectly normal for them to have different numbers of lines,
and all the information needs to be recovered. As I think of it, it's as
though the two files were both printed out onto tracing paper and the
desired result is the transparent superposition of everything they contain.
They have been spliced apart so that they are negatives of eachother, with
no two elements ever occupying the same line-column position on both.
Thanks again for addressing the question!
Elisa Francesca Roselli
------------------------------
Date: Fri, 08 Dec 2000 06:41:27 GMT
From: Joel Nelson <joelnelson@home.com>
Subject: Re: Apache on Linux - Error on scripts called thru browser
Message-Id: <3A308272.1B8C0945@home.com>
CM wrote:
> Hi.
>
> I am running Perl on Apache .My scripts are running OK when called from
> the command prompt.
>
> However when I call them thru the browser I get these *two* messages on
> the error_log .
>
> [Thu Dec 7 04:42:31 2000] [error] (2)No such file or directory: exec
> of /home/httpd/cgi-bin/test.pl failed
>
> [Thu Dec 7 04:42:31 2000] [error] [client 192.168.100.132] Premature
> end of script headers: /home/httpd/cgi-bin/test.pl
>
> To clarify
>
> For the first error--> the file *does* exist in the specified directory.
> Forthe second error--> The Perl file does start with #!/usr/bin/perl.
>
> I have followed the guidelines in
>
> www.apache.org- 'Running CGI scripts on server' documentation
>
> and made sure that all the .conf files
>
> httpd.conf
> srm.conf
> access.conf
>
> are as per requirements.
>
> Since I am used to Perl on Windows I am finding it difficult to grasp
> the other parameters that are involved in Linux.
>
> I have been sitting on this for 5 hours now with two 10 minute
> breaks ....so I guess if somebody can help me out with this I will
> really *appreciate* it.
>
> [yawn] Thank you very much!!
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
We could keep guessing, but I think you'll find we will all lose interest.
How about posting the actual script? Is there a blank line after the
'#!/usr/bin/perl'? If you type '/usr/bin/perl' from the shell prompt does
anything happen? Your second error is most likely due to the first error.
You'll need to solve that. Typically with linux/apache/perl you don't need
to edit any conf files for the cgi scripts to work. Let us see the script!
Joel
------------------------------
Date: Fri, 08 Dec 2000 07:26:18 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Apache on Linux - Error on scripts called thru browser
Message-Id: <slrn9313aj.hbv.rgarciasuarez@rafael.kazibao.net>
CM wrote in comp.lang.perl.misc:
> >
> > And is perl in /usr/bin ? To execute a script file, the linux kernel
> > looks for the interpreter that's after the #! characters. The "No such
> > file or directory" error may referer to /usr/bin/perl. If you execute
> > your scripts from the command-line via 'perl test.pl' you won't notice
> > this error.
>
> Yes Perl is in the specified directory
Your script is perhaps in MS-DOS format. The kernel is looking for a
program named "perl\r". Convert it to UNIX file format with a suitable
editor.
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Fri, 8 Dec 2000 10:29:28 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: behavior of open "+>>"
Message-Id: <90ph6p$p3n@netnews.hinet.net>
Dear all,
I just wanted to test the behavior of open "+>>"
stated in perlopentut, section "Mixing Reads and Writes". It says:
"it will allow you to read at any point in the file,
but all writes will always go to the end."
The following is my testing program:
open F,"+>>nonexist" or die $!;
print F "hello 1\n";
print F "hello 2\n";
close F;
open F,"+>>nonexist" or die $!;
seek F,0,0;
print my $line = <F>;
print F "hello 3\n";
print F "hello 4\n";
close F;
I got the result:
STDOUT
hello 1 <-- so reading is OK
F (the file)
hello 1
hello 2
<-- nothing is appended
All my many other experiments came to a conclusion:
Pure reading is OK.
Pure writing is OK.
Writing then reading is OK.
Reading then writing - writing is gone.
Is there anything wrong here?
Thank you.
John Lin
------------------------------
Date: 07 Dec 2000 21:44:02 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: behavior of open "+>>"
Message-Id: <m31yvjljil.fsf@mumonkan.sunstarsys.com>
"John Lin" <johnlin@chttl.com.tw> writes:
> The following is my testing program:
>
> open F,"+>>nonexist" or die $!;
> print F "hello 1\n";
> print F "hello 2\n";
> close F;
>
> open F,"+>>nonexist" or die $!;
> seek F,0,0;
> print my $line = <F>;
> print F "hello 3\n";
> print F "hello 4\n";
> close F;
>
> I got the result:
>
> STDOUT
> hello 1 <-- so reading is OK
>
> F (the file)
> hello 1
> hello 2
> <-- nothing is appended
>
% try.pl
hello 1
% cat nonexist
hello 1
hello 2
hello 3
hello 4
% perl -v
This is perl, version 5.005_03 built for i386-linux
...
Ditto for 5.6. How do you get what you got?
--
Joe Schaefer
------------------------------
Date: Fri, 8 Dec 2000 14:09:08 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: behavior of open "+>>"
Message-Id: <90pu2i$hnh@netnews.hinet.net>
"Joe Schaefer" wrote
> % try.pl
> hello 1
> % cat nonexist
> hello 1
> hello 2
> hello 3
> hello 4
> % perl -v
>
> This is perl, version 5.005_03 built for i386-linux
> ...
>
> Ditto for 5.6. How do you get what you got?
C:\>perl try.pl
hello 1
C:\>type nonexist
hello 1
hello 2
C:\>perl -v
This is perl, v5.6.0 built for MSWin32-x86-multi-thread
...
Thank you.
John Lin
------------------------------
Date: Fri, 08 Dec 2000 04:33:20 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Compiled Perl modules.
Message-Id: <3A306536.77B1BBCA@rochester.rr.com>
Mike wrote:
>
> Guys,
> is there an easy way for me to find out the list of modules that
> has been compiled with PERL? There doesn't seem to be a command line
> option to do this - or is there?
Check out -MCPAN as a command line option. But first, you might want to
look at http://www.perl.com and click on the CPAN link.
--
Bob Walton
------------------------------
Date: Fri, 08 Dec 2000 05:02:27 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Compiled Perl modules.
Message-Id: <DXZX5.84227$P82.9271184@news1.rdc1.ct.home.com>
Mike <numberdog@hotmail.com> wrote:
> Guys,
> is there an easy way for me to find out the list of modules that
> has been compiled with PERL? There doesn't seem to be a command line
> option to do this - or is there?
If you're interested in the modules that have been installed in a particular
perl installation, take a look at the perllocal docs, either with man or
perldoc. Everytime someone does a "make install" of a module, or installs
it with the CPAN module, a note is made in this file.
Dan
------------------------------
Date: Fri, 08 Dec 2000 03:16:20 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: CSS files in a cgi script
Message-Id: <8oYX5.48$B9.170956288@news.frii.net>
In article <EAWX5.2387$tR1.44412@news2-win.server.ntlworld.com>,
Virgin News <c.darlington@virgin.net> wrote:
>Is it possible to link a .css file in a cgi script to format the html output
>of the script?
>
CSS is part of what the perl script generates. So it is trivial
to output <style> tags directly in the output from the CGI program
or to emit <link> tags just as you would <P> or <h1> tags in your
html. BTW this is not specificly a perl question. the answer would
be the same regardless of what languages you use to implement your
CGI scripts.
Good Luck
chris
--
This space intentionally left blank
------------------------------
Date: Fri, 08 Dec 2000 05:57:39 GMT
From: tim@localhost.localdomain (Tim Hammerquist)
Subject: Re: CSS files in a cgi script
Message-Id: <slrn930u5p.3e9.tim@localhost.localdomain>
Virgin News <c.darlington@virgin.net> wrote:
> Is it possible to link a .css file in a cgi script to format the html output
> of the script?
Of course! =)
: print "Content-type: text/html\n\n";
: print <<EOH;
: <HTML>
: <HEAD>
: <TITLE>Sample CGI with CSS</TITLE>
: <LINK rel="stylesheet" href="/path/to/cssfile.css" type="text/css">
: </HEAD>
: <BODY>
: <!-- rest of html -->
: </BODY>
: </HTML>
: EOH
The thing to remember here is that the browser doesn't necessarily know
nor care where the content comes from. As far as it's concerned, as
long as the Content-Type header it receives says 'text/html', it'll
interpret it as such.
Cheers.
--
-Tim Hammerquist <timmy@cpan.org>
Legend -- a lie that has attained the dignity of age.
-- H. L. Mencken
------------------------------
Date: Fri, 08 Dec 2000 04:30:49 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: GD.pm constructor hangs
Message-Id: <3A30649F.50723A93@rochester.rr.com>
JL Goldstein wrote:
>
> (crosspost from comp.lang.perl.moderated)
>
> I am having a hell of a time with GD.pm, so I hope one of you gurus can
> help me.
>
> I have, according to the docs with GD.pm v. 1.32, installed the gd
> graphics library (1.83), the PNG graphics library (1.08), and zlib
> (1.13) as well as the JPEG library (6b).
>
> After much wailing and gnashing of teeth, I can execute "perl -e 'use
> GD' " without receiving an error. Example scripts from the GD.pm
> distribution compile just fine.
>
> However, when I attempt to create a new image either from scratch (as in
> "my $im = new GD::Image(100,100)") or from a PNG file (as in "my $im =
> new GD::newFromPNG($file)"), the script hangs.
...
Hmmmm...I ran your program verbatim, and it ran fine. Windoze 98 SE,
Website 1.1, Perl 5.6, ActiveState build 618.
--
Bob Walton
------------------------------
Date: 8 Dec 2000 07:15:19 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: HASH OF LISTS - Question
Message-Id: <90q1q7$jnm$2@bob.news.rcn.net>
nobull@mail.com wrote:
> HTML fields hold strings! If you want to put a more complex structure
> into an HTML field you have to convert it into a string.
> One way to convert a arbitrarily complex nested hash/list construct
> into a string is to use Data::Dumper module (although it is probably
> not the best).
> use Data::Dumper;
> my $structures = Data::Dumper->new([\%HoL],['*HoL'])->Indent(0)->Useqq(1);
> use CGI;
> my $query = CGI->new;
> print $query->hidden('structures',$structures->Dump);
> Hopefully, when you chose a mechanism to convert your hash to a string
> you chose one you could reverse.
> In the above case you could reverse it with eval():
> eval $query->param('structures');
> But you _do_not_want_to_do_that! This would allow anyone to execute
> arbitary code on your computer.
XML::Simple would probably be a better choice here, though using Storable
and Base64 encoding/decoding the result would also be a possibility.
------------------------------
Date: Fri, 8 Dec 2000 11:13:45 +0530
From: "preetham" <preetham@india.hp.com>
Subject: help with form encoding
Message-Id: <90pseq$cih$1@web1.cup.hp.com>
hi,
the form encoding generated by HTTP::Request for POST method is different
from the one generated by the Internet Explorer or Netscape
for ex:
if i have a string
"I don't know"
HTTP::Request encodes as
I%20don't%20know
but IE/Netscape encodes it as
I+don%27+know
How to get the encoding as in IE/Netscape ?
------------------------------
Date: Fri, 08 Dec 2000 02:15:54 GMT
From: Scott Wiersdorf <sgp22@ipartner.net>
Subject: Re: How could I get the time of a server?
Message-Id: <3A30457C.BB607C69@ipartner.net>
Lucas wrote:
>
> Hi,
>
> How could I get the time, date of a server by script?
> I just checked some documents about telnet and Net::FTP,
> but I couldn't find any clues.
you could try something like this (if you're running sshd on the remote
server):
my $host = 'foo.bar.com';
my $cmd = 'date';
my $ans = `/path/to/your/ssh -x $host $cmd`;
$ans now contains the results of the remote execution.
Scott
------------------------------
Date: 8 Dec 2000 07:05:29 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: how to get DOS 8.3 current directory
Message-Id: <90q17p$jnm$1@bob.news.rcn.net>
Jonathan Kuhn <jonathan.kuhn@gsfc.nasa.gov> wrote:
> How can I get the current working directory with everything DOS 8.3
> formatted?
GetShortPathName, exported by the Win32 module, will translate a long
pathname to a short (8.3) one.
------------------------------
Date: Fri, 08 Dec 2000 03:55:17 GMT
From: "Bill Jeanes" <bill.jeanes@gte.net>
Subject: Newbie Perl CGI and Netscape Prob
Message-Id: <FYYX5.1301$h06.389330@dfiatx1-snr1.gtei.net>
Hi,
I'm having problems with some Perl CGI scripts. I can run them from the
command prompt successfully, but cannot access them via my browser. Here's
the error from the log file:
could not fork new process (exec() failure [No such file or directory])
I suspect it is a configuration problem, but I'll be you-know-what if I can
figure out what it is. The cgi-bin re-direct is correct. Perl is installed
correctly. Help!
Here are the system particulars:
Perl: Perl v5.6.0
OS: Solaris 8
Webserver: Netscape 4.0 SP3
TIA,
Bill
------------------------------
Date: Fri, 08 Dec 2000 02:46:03 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: newbie question about flatfiles
Message-Id: <LXXX5.46$B9.170958336@news.frii.net>
In article <OjWX5.81618$751.1971364@typhoon.ne.mediaone.net>,
bigtiny <khedger@mindspring.com> wrote:
>Chris Fedde <cfedde@fedde.littleton.co.us> wrote in message
>news:tLUX5.39$B9.188722176@news.frii.net...
>>
>> The best way to accomplish your task is to get something working
>> and show it to the customer. Then fix what the customer does not
>> like. Flat file is as good as anything else from that point of
>> view.
>
>Uhhhgg...errrr....I have to disagree with Chris here.....
>
>I would suggest getting a clearly understood list of requirements from the
>customer, designing your program to fill those requirements....THEN show it
>to the customer. And if they don't like it...you can talk about your fee to
>start work on the next release....
>
>k
>
What can you expect from someone who uses jeoparday style posting. ;-)
I fixed it for you. Maybe you can do it your self next time.
Have a look at http://www.extremeprogramming.org/ then get back to me on
this methodology of yours.
chris
--
This space intentionally left blank
------------------------------
Date: Fri, 08 Dec 2000 06:03:03 GMT
From: "Derek Ross" <derekr@escape.ca>
Subject: Re: Offtopic: Can this script be done in a one-liner
Message-Id: <rQ_X5.38041$Z9.1914234@news1.rdc1.mb.home.com>
[posted & mailed]
> Today I thought of this:
>
> paste a.txt b.txt|sed -e 's/$/+p/'|dc
>
That one's quite slick actually. (Yes, I have some strange critera for what
I consider slick).
How would this one be expanded to accept more than two files as input, with
an unlimited variety of mathematical operations on the files, more than just
addition?
For example, say I had 3 files a.txt, b.txt and c.txt.. would it be possible
to combine them with, say,
output = log(a)+b*sqrt(c)
Or some other mathematical operation?
My nonworking guess would be:
paste a.txt b.txt c.txt|sed -e 's/(\d+)(\d+)(\d+)/log($1)+$2*sqrt($3)/g'|dc
(Don't think sed can use regexp variables.)
Derek Ross.
------------------------------
Date: Fri, 08 Dec 2000 02:30:06 -0000
From: Kartik <kartik_4u@yahoo.com>
Subject: Opening Location thru Perl-CGI
Message-Id: <t30htekchp8kb3@corp.supernews.com>
Does any one know, how to open a HTTP location using perl?
Like, what do i have to type infront of `print' statement for opening an
URL like http://www.help.com/index.htm?
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Fri, 08 Dec 2000 02:57:20 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Opening Location thru Perl-CGI
Message-Id: <3A304EB6.2A1F4ECA@rochester.rr.com>
Kartik wrote:
>
> Does any one know, how to open a HTTP location using perl?
>
> Like, what do i have to type infront of `print' statement for opening an
> URL like http://www.help.com/index.htm?
...
perldoc LWP::Simple
--
Bob Walton
------------------------------
Date: Fri, 08 Dec 2000 03:59:11 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Precedence, or other ???
Message-Id: <3A305D35.44B94914@rochester.rr.com>
"Michael D. Schleif" wrote:
>
> my $i = 1;
> my $j;
> $j = ++$i*$i--;
> print "j is now $j\n";
>
> What is happening here?
>
> Why is $j == 2 ???
>
> How can I trace $i every step of the way?
...
> mds
...
Hmmmmm...the docs (perldoc perlop) say operators that exist in C are
evaluated as C evaluates them, at least as far as precedence goes. If
that extends to the evaluation mechanism, your result is explainable.
In C, you can't store something in a variable twice between sequence
points and count on a particular order of evaluation. Your expression
$j=++$i*$i-- does not contain an internal sequence point; therefore, you
may not alter the value of $i more than once in this expression and
count on a particular order of evaluation. In other words, Perl could
evaluate the arguments to the * operator in either order: it could, for
example, pick up the value of $i from the $i-- expression, then do the
increment, then the multiply, and then decrement $i, etc. 2 is a
possible result, as is 0 or 4. HTH. If you want to inspect what Perl
is doing, maybe looking at
perldoc perlcompile
would help?
--
Bob Walton
------------------------------
Date: Fri, 08 Dec 2000 05:08:17 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Precedence, or other ???
Message-Id: <51_X5.50$B9.173316608@news.frii.net>
In article <3A3034E5.76106C82@mediaone.net>,
Michael D. Schleif <mds@helices.org> wrote:
>
> my $i = 1;
> my $j;
> $j = ++$i*$i--;
> print "j is now $j\n";
>
>What is happening here?
>
>Why is $j == 2 ???
>
>How can I trace $i every step of the way?
>
I wonder if this sheds any light on what's happening?
sub mul {
print "mul($_[0], $_[1])\n";
return $_[0] * $_[1];
}
my $i = 1;
my $j;
$j = mul(++$i, $i--);
print "j is now $j\n";
prints
mul(1, 2)
j is now 2
This does not convince me that evaluation will be the same for
multiplication but it does lend support for one order
of evaluation. I'd have expected "mul(2, 2)" and "j is now 4".
But that might be because I'm nieve.
chris
--
This space intentionally left blank
------------------------------
Date: Fri, 08 Dec 2000 04:51:20 GMT
From: "Derek Ross" <derekr@escape.ca>
Subject: Re(OT): Can this script be done in a one-liner with sed
Message-Id: <cNZX5.37936$Z9.1912091@news1.rdc1.mb.home.com>
[posted & mailed]
> Today I thought of this:
>
> paste a.txt b.txt|sed -e 's/$/+p/'|dc
>
That one's quite slick actually. (Yes, I have some strange critera for what
I consider slick).
How would this one be expanded to accept more than two files as input, with
an unlimited variety of mathematical operations on the files, more than just
addition?
For example, say I had 3 files a.txt, b.txt and c.txt.. would it be possible
to combine them with, say,
output = log(a)+b*sqrt(c)
Or some other mathematical operation?
My nonworking guess would be:
paste a.txt b.txt c.txt|sed -e 's/(\d+)(\d+)(\d+)/log($1)+$2*sqrt($3)/g'|dc
(Don't think sed can use regexp variables.)
Derek Ross.
------------------------------
Date: Thu, 7 Dec 2000 23:35:57 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Re(OT): Can this script be done in a one-liner with sed
Message-Id: <slrn930p9d.vmf.tadmc@magna.metronet.com>
Derek Ross <derekr@escape.ca> wrote:
>[posted & mailed]
>
>> Today I thought of this:
>>
>> paste a.txt b.txt|sed -e 's/$/+p/'|dc
>
>That one's quite slick actually. (Yes, I have some strange critera for what
>I consider slick).
For slick, it's hard to beat this directory lister:
find . -print | sed -e 's,[^/]*/\([^/]*\)$,`--\1,' -e 's,[^/]*/,| ,g'
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 8 Dec 2000 06:08:04 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Re(OT): Can this script be done in a one-liner with sed
Message-Id: <90pts4$eub$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Tad McClellan
<tadmc@metronet.com>],
who wrote in article <slrn930p9d.vmf.tadmc@magna.metronet.com>:
> For slick, it's hard to beat this directory lister:
>
> find . -print | sed -e 's,[^/]*/\([^/]*\)$,`--\1,' -e 's,[^/]*/,| ,g'
Interesting! I find this
find . -print | sed -e 's,[^/]*/\([^/]*\)$,|`--\1,' -e 's,[^/]*/,| ,g'
better looking, though. If it would remove empty branches, though -
but this needs to know that "this entry is the last one in its directory"...
Ilya
------------------------------
Date: Fri, 08 Dec 2000 05:16:07 GMT
From: "EnIgMaBoM" <enigmabomb@home.gotohellspammers.ihopeyourotinghellyouspamminggarbage.com>
Subject: Redirection?
Message-Id: <r8_X5.26177$w35.4676159@news1.rdc1.nj.home.com>
I have just written an anonymous message board script for my site, It works
quite nicely, It takes the input from a form, and plops it out into a html
file. Unfotunately, I need the script to re-direct it to the msg board
file...any ideas?
------------------------------
Date: Fri, 08 Dec 2000 04:30:04 -0000
From: Ryan Hubbard <pastry1001@aol.com>
Subject: Sending email attachments
Message-Id: <t30ouc9nm5hhc0@corp.supernews.com>
I would like to automate some email by sending attachments. Which program
should I use on a unix platform. Can Pine do it? Should I use Mutt?
Which should I use and how should I go about doing it?
Thanks
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Fri, 08 Dec 2000 04:35:25 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Sending email attachments
Message-Id: <hyZX5.49$B9.170958336@news.frii.net>
In article <t30ouc9nm5hhc0@corp.supernews.com>,
Ryan Hubbard <pastry1001@aol.com> wrote:
>I would like to automate some email by sending attachments. Which program
>should I use on a unix platform. Can Pine do it? Should I use Mutt?
>Which should I use and how should I go about doing it?
> Thanks
>
Use Mime::Lite available at CPAN.
Good Luck
chris
--
This space intentionally left blank
------------------------------
Date: Fri, 08 Dec 2000 04:33:29 GMT
From: Shannon Jacobs <shanen@my-deja.com>
To: shanen@acm.org
Subject: Tripod Perl users?
Message-Id: <90poap$ng0$1@nnrp1.deja.com>
Are there any folks out there who are having success with the Perl CGI
on Tripod? I'd love to pick your brains.
Problem is with some Perl that still runs fine on an intranet server,
and that used to run fine on Tripod, but... It apparently dropped dead
a few months ago, and I can't revive it--I can't even remember how I
finally managed to get enough feedback to fix it in the first place
when I moved it to Tripod. Right now my leading theory is that the
Tripod Perl/CGI service is de facto defunct--it was probably just an
overly ambitious project that they dropped when they found out how hard
it actually was. But I'd be glad to hear otherwise from someone who is
having success there.
--
Spamnuts--not just for breakfast anymore. Be sure to crack the shells
before adding soy sauce.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 07 Dec 2000 20:14:10 -0800
From: Kenny Pearce <kenny@kennypearce.net>
Subject: Re: Use PERL or Java? Which is faster?
Message-Id: <3A306012.744F649B@kennypearce.net>
I read the link you included, and I would still say the same thing. However,
a few factors should be taken into account.
1. I am much more familiar with Perl
2. I have no interest in a graphical programming enviroment (IDE) I've never
tried one and won't be trying one in the near future.
3. I have never coded for a web-site which is busy enough for differences in
performance between Java and Perl to make a major difference, however, when
running console based java applications, as opposed to similar Perl
applications, Perl has been much faster.
4. I have found that Java for Windows is unstable. I attribute this to the
fact that Windows itself is inherently unstable, but I've had only very
limited experience using Java on Linux, as I just recently got it installed
on my box. In this experience I have found it to be stable but incredibly
slow.
5. Perl is my "native" language (the first one I learned to program with) and
I am therefore biased toward it.
Note that none of these factors are specific to servlets, as I have never
used them. Also, I have never interacted with a database application
programmatically. I have found it easier to use plain text files, and no one
has ever given me any feature of database applications which appeals to me. I
therefore know nothing about database connectivity in Java or Perl.
All these things said, I personally would choose Perl over Java for any
application which did not require a GUI.
Tim Tyler wrote:
> In lots of ngs, Kenny Pearce <kenny@kennypearce.net> wrote:
>
> : If my choices were Java or Perl, I'd only use Java for an app that has a
> : GUI.
>
> Many would do otherwise:
>
> "Servlets or CGI/Perl?" : http://www.idg.net/crd_java_9-117546.html
>
> Servlets have now become pretty popular.
> --
> __________ http://alife.co.uk/ http://mandala.co.uk/
> |im |yler tt@cryogen.com http://hex.org.uk/ http://atoms.org.uk/
------------------------------
Date: Fri, 08 Dec 2000 04:31:28 GMT
From: Michael Fischer <fischerm@my-deja.com>
Subject: Win32::Process::Create Question on Win98
Message-Id: <90po71$n7k$1@nnrp1.deja.com>
Ok, here's the question. I have code like this that doesn't launch the
application like it is supposed to. However, Win32::FormatMessage
prints out "the operation completed successfully." $Result holds 0 so
it should have an error. but I can't find out what it is.
$Result = Win32::Process::Create($process, "C:\\winnt\\system32
\\notepad.exe", "", 0, CREATE_NEW_CONSOLE | NORMAL_CLASS_PRIORITY, ".");
#error = Win32::GetLastError();
print "Last Error: " . Win32::FormatMessage( $error ) . "\n";
This code works fine on NT but not on 98.
Help!!!!
Thank you.
--
Michael Fischer
fischerm@my-deja.com
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 8 Dec 2000 05:02:32 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Win32::Process::Create Question on Win98
Message-Id: <slrn930qr8.jmb.sholden@pgrad.cs.usyd.edu.au>
On Fri, 08 Dec 2000 04:31:28 GMT, Michael Fischer <fischerm@my-deja.com> wrote:
>
>
>Ok, here's the question. I have code like this that doesn't launch the
>application like it is supposed to. However, Win32::FormatMessage
>prints out "the operation completed successfully." $Result holds 0 so
>it should have an error. but I can't find out what it is.
>
>$Result = Win32::Process::Create($process, "C:\\winnt\\system32
>\\notepad.exe", "", 0, CREATE_NEW_CONSOLE | NORMAL_CLASS_PRIORITY, ".");
>#error = Win32::GetLastError();
>print "Last Error: " . Win32::FormatMessage( $error ) . "\n";
>
>This code works fine on NT but not on 98.
It should be $error, not #error, but that may be a typo in your post...
I suspect that under win98 the 'winnt' directory doesn't exist and thus
the operation fails. FormatMessage says 'successfully' because you
are passing it undef which it is treating is 0, which means no error...
Of course I have never used any of the win32 modules so what would I'm just
guessing...
------------------------------
Date: 07 Dec 2000 23:15:36 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Yesterdays Date
Message-Id: <m1d7f3gz8n.fsf@halfdome.holdit.com>
>>>>> "Bjoern" == Bjoern Kaiser <bkaiser@trans-it.de> writes:
Bjoern> Hi
Bjoern> (my $day,my $month,my $year) = (localtime(time))[3,4,5];
Bjoern> gives me todays date but what's the most simple way to get yesterdays date
Bjoern> in the same format?
(my $day,my $month,my $year) = (localtime(time))[3,4,5];
sleep 86400;
print "Yesterday's date was $day $month $year\n";
Note precisely the "same format" requirements fulfilled (even though
you should really fix month and year to be normalized) and that this
algorithm is messed up a couple of times a year on those days
that don't have 86400 seconds.
print "Just another Perl hacker,"
p.s. Yes, I'm joking.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 5060
**************************************