[19239] in Perl-Users-Digest
Perl-Users Digest, Issue: 1434 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 3 11:05:37 2001
Date: Fri, 3 Aug 2001 08:05:08 -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: <996851108-v10-i1434@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 3 Aug 2001 Volume: 10 Number: 1434
Today's topics:
Re: #### HELP NEEDED #### (noident)
Adding values of an array to an array in a hash (J.C.Posey)
Re: Adding values of an array to an array in a hash <tom.melly@ccl.com>
Re: data collection and file management (Anno Siegel)
Re: FAQ: How do I handle circular lists? (Anno Siegel)
FAQ: How do I select a random element from an array? <faq@denver.pm.org>
Re: FAQ: What is the difference between $array[1] and @ (Michel Dalle)
FLATTEXT: Have it display random entries? (charles)
FORMAT_TOP (Andrew Hutchinson)
Generating Graphs <3b533a81314e4@heavyk.org>
Re: How to extract non-character data from socket strea (Mark Johnson)
how2make @MYARGV from my "cmd-line"? (Might have STRING (David Combs)
Re: how2make @MYARGV from my "cmd-line"? (Might have ST (Anno Siegel)
I have forgotten... (Nils-Eric Pettersson)
Net::Ping and alarm troubles <mcgeeb@jot.nb.ca>
Re: parallel execution of shell commands in Perl script <simon.andrews@bbsrc.ac.uk>
perl "INFO" files? (emacs) Where? (Search for perl-inf (David Combs)
Re: PERL is cool - DBD: CHarts <fty@mediapulse.com>
Re: PPM fails in SOAP/Parser.pm <bart.lateur@skynet.be>
Problem setting a cookie in Netscape (Nils-Eric Pettersson)
Q:Of negative numbers and logical operations <rs55862@nospamyahoo.com>
Regex library? <yf32@cornell.edu>
Re: Regex library? <NOSPAM.dogansmoobs@ctel.net>
Re: Reporting Questionable Programming Activity <fty@mediapulse.com>
Re: Reporting Questionable Programming Activity <mjcarman@home.com>
Re: Reporting Questionable Programming Activity <tom.melly@ccl.com>
Re: Script works on PWS but not IIS? (Alex)
Re: Splitting a text list into smaller lists? (Yves Orton)
Re: Strange behavior? (Anno Siegel)
Re: Strange behavior? (Anno Siegel)
Win32 Apahce NPH equivalent <bhess@techrg.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Aug 2001 03:58:58 -0700
From: noident@my-deja.com (noident)
Subject: Re: #### HELP NEEDED ####
Message-Id: <66fba11b.0108030258.2167829@posting.google.com>
Carlos Beguigne <beguigne@hotmail.com> wrote in message news:<2a8kmtgggvd8ddsphsjsmfi63tte8o8f3a@4ax.com>...
> #############################################################################
> #
> #
> # BSS: Create a Database file
> #
> #
> #
> # Info:
> #
> #
> #
> &make_db;
>
> sub make_db {
> use strict;
> my $day = (time);
> my $file = "order.$day.dat";
>
> print "$day \n";
> print "$file \n\n";
>
> open(file_1, "> $file") or die "$file: REASON -> $!";
> close(file_1) or die "$file: REASON -> $!";
> }
>
> This works well when I run it locally from my PC but it bombs out on
> my ISP web server with the following error:
> 500 internal server error
> reason: Premature end of script headers
>
> Any help will be really appreciated...
>
> Regards,
>
> Carlos
There might be a number of reasons why this happens, depending on
server software. The most likely 2 are:
1. Did you forget to include a line
print "Content-type: text/plain\n\n";
or similar before you tried printing something?
2. die prints its messages to STDERR which isn't available to your
browser unless you redirect it to STDOUT. You may try something like
this instead:
open(file_1, "> $file") or do{print "$!\n";exit};
Cheers
------------------------------
Date: 03 Aug 2001 12:08:46 +0100
From: jcp@myrtle.ukc.ac.uk (J.C.Posey)
Subject: Adding values of an array to an array in a hash
Message-Id: <jkog0b9cse9.fsf@myrtle.ukc.ac.uk>
I've searched groups.google.com (probably asking the wrong question), and
looked in the Camel (probably not understanding what I've read), and
looked at perldoc (see above).
I'm taking a log file line by line, and I want to add the values of
a, b, c, d (my four fields), to the same fields for the same unique
key (a url).
My codes snippet:
# take the first value off and use it as the unique identifier
# this leaves the four fields I'm interested in
my $key = shift(@fields);
# I then want to add a,b,c,d to the same fields already in the
# hash--so a is added to a, etc.
$urls{$key} += [$fields[0], $fields[1], $fields[2], $fields[3]];
I thought the above method would add the array to the same fields
in the array accessed by the key--but the results are wrong, I
end up with my key, and one value, not four.
Thanks for the help.
Jake
------------------------------
Date: Fri, 3 Aug 2001 12:39:01 +0100
From: "Tom Melly" <tom.melly@ccl.com>
Subject: Re: Adding values of an array to an array in a hash
Message-Id: <3b6a8d55$0$3756$ed9e5944@reading.news.pipex.net>
"J.C.Posey" <jcp@myrtle.ukc.ac.uk> wrote in message
news:jkog0b9cse9.fsf@myrtle.ukc.ac.uk...
> # take the first value off and use it as the unique identifier
> # this leaves the four fields I'm interested in
> my $key = shift(@fields);
>
> # I then want to add a,b,c,d to the same fields already in the
> # hash--so a is added to a, etc.
> $urls{$key} += [$fields[0], $fields[1], $fields[2], $fields[3]];
A bit hard to tell what you are doing here - do you expect $urls{$key} to
already have values in it?
If not, then it would be just:
$urls{$key} = [@fields];
However, you should note that you are creating a reference to an anon. array
here, so accessing, e.g., $fields[0] would be
$urls{$key}[0]
If you are trying to add numeric values to existing numeric values (as your code
implies), then:
for($n=0;$n<=$#fields;$n++){
$urls{$key}[$n] += $fields[$n];
}
------------------------------
Date: 3 Aug 2001 12:54:08 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: data collection and file management
Message-Id: <9ke6tg$58c$1@mamenchi.zrz.TU-Berlin.DE>
According to katherine <kstar8864@hotmail.com>:
> Hi!
>
> I am trying to write a data collection program (in Perl) that will
> gather system statistics synchronously using utilities like iostat,
> vmstat, cpustat, netstat, etc.
Okay.
> My basic approach is to fork a process to manage each utility and
> gather the data from the utility (using pipes) which is then stored
> into a file. Therefore each utility is started and will output data
> every second; this data is stored into a file.
Apparently "a file" here means "an individual file for each utility".
Will all of the command output be stored, or a summary? Will the
information accumulate in the files or is each file overwritten with
the next run? BTW, on some systems running the iostat/vmstat/cpustat/
netstat combo every second would represent a considerable load.
> Then there is an
> "agent" process that will go and take the last complete line of each
> file (one for each utility) every 5 seconds and store it into one
> global file (I use tail and head commands to do this).
Well obviously you are storing summaries (the last line of netstat
output (say) wouldn't be very informative), and apparently the lines
do accumulate (otherwise there would ever only be one). And why
would you run the utilities every second when you gather data only
every five seconds?
> I am only
> interested in maintaining the one big file to to minimize disk usage.
> Any thoughts on how I could do this?
Do you mean you want to get rid of the individual files? And
"maintaining the one big file" means what? What properties do
you want to maintain?
> Any help/suggestions would be greatly appreciated.
Unfortunately your problem description opens up more questions
than it allows to answer.
Anno
------------------------------
Date: 3 Aug 2001 11:51:14 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: FAQ: How do I handle circular lists?
Message-Id: <9ke37i$2jr$1@mamenchi.zrz.TU-Berlin.DE>
According to James Taylor <SEE_MY_SIG@nospam.demon.co.uk>:
> In article <RRga7.76$l_m.170718720@news.frii.net>,
> PerlFAQ Server wrote:
> >
> > How do I handle circular lists?
> >
> > Circular lists could be handled in the traditional fashion with linked
> > lists, or you could just do something like this with an array:
> >
> > unshift(@array, pop(@array)); # the last shall be first
> > push(@array, shift(@array)); # and vice versa
>
>
> Shouldn't this FAQ entry discuss garbage collection?
>
> If the linked list approach is used it is not enough just to let go of
> the structure because the reference counts will not be zero, and the
> result will be a memory leak. It is necessary to break the cycle
> before letting go. I think the FAQ should at least mention this.
It would also have to explain to the mostly inexperienced FAQ
readership what the "linked list" approach actually is. Moreover,
it should mention that the "unshift..." and "push..." operations do
not create circular lists, they just perform circular shift operations
on ordinary arrays.
Actually, circular lists as such don't play a big role in Perl
programming. They are useful in a language that is poor in aggregate
structures, which Perl isn't. In Perl, circular references happen
more as accidents while you're up to other things.
Anno
------------------------------
Date: Fri, 03 Aug 2001 12:17:02 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How do I select a random element from an array?
Message-Id: <2Dwa7.1$T3.170725888@news.frii.net>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.
+
How do I select a random element from an array?
Use the rand() function (see the rand entry in the perlfunc manpage):
# at the top of the program:
srand; # not needed for 5.004 and later
# then later on
$index = rand @array;
$element = $array[$index];
Make sure you *only call srand once per program, if then*. If you are
calling it more than once (such as before each call to rand), you're
almost certainly doing something wrong.
-
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to
news:news.answers
or to the many thousands of other useful Usenet news groups.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-1999 Tom Christiansen and Nathan
Torkington. All rights reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
04.48
--
This space intentionally left blank
------------------------------
Date: Fri, 03 Aug 2001 13:21:44 GMT
From: news@mikespub.net (Michel Dalle)
Subject: Re: FAQ: What is the difference between $array[1] and @array[1]?
Message-Id: <9ke8dm$4td$1@news.mch.sbs.de>
In article <slrn9milei.qtq.tadmc@tadmc26.august.net>, tadmc@augustmail.com wrote:
[snip]
>So "@array[1]" is how you access the second element of the @array
>in Perl 6, and "$array[1]" is short for "$array.[1]", where $array
>is a reference to an array, and dot is the dereferencing operator.
>
>( $array.[1] in perl6 === $array->[1] in perl5 )
>
I'm sure there are perfectly reasonable reasons for that, but
I shudder at the thought that none of the scripts written in
Perl 5.x will work as expected anymore...
Why not rename perl6 to something else, so that everybody
understands we're dealing with a different language here ?
Michel.
--
Welcome to Mike's Pub
http://mikespub.net/pictures/selection.php
------------------------------
Date: 3 Aug 2001 07:19:26 -0700
From: charles@vortus.com (charles)
Subject: FLATTEXT: Have it display random entries?
Message-Id: <42d4b368.0108030619.9a5cdde@posting.google.com>
Hello. I have had great success with FLATTEXT and the Zip Code
Locator section of the software. However, one step is causing
problems. I would like to have it pull three RANDOM entires from the
text file that meet the criteria. For example, if I do a search for
stores in Chicago, I want it to just return three random stores in
Chicago. Right now, I can only get it to return the first or last
three alphabetically.
Any help is greatly appreciated.
--charles
P.S. The user is not allowed to "view more searches" after the first
three -- a creiteria that I have already implemented.
------------------------------
Date: Fri, 03 Aug 2001 14:21:13 GMT
From: andrew.hutchinson@mcmail.vanderbilt.edu (Andrew Hutchinson)
Subject: FORMAT_TOP
Message-Id: <3b6aad49.79740718@news.vanderbilt.edu>
I have a perl daemon process that I put together which queries a
database every few minutes, gathers a recordset, and uses the
recordset to build a nicely formatted report which is emailed out to a
list of recipients. The report looks great the first time through,
and the FORMAT_TOP header appears at the top of each page. However,
during successive interations, the FORMAT_TOP does not appear at the
top of the first page - but it does appear on subsequent pages
(2,3,etc). I've turned on autoflush for the handle that is bound to
the format ($|=1;) and I've tried to set the lines remaining to 0
($-=0;) after each iteration, but neither seems to work. The output
handle is being closed at the end of each iteration too, and reopened
(and the format re-selected) at the start of each successive
iteration.
I've kluged the problem by removing the forking/daemonizing code, and
just running via cron. This seems to fix it. But it's still bugging
me, and eventually I'll hit a situation where cron isn't an option.
Any Ideas??
andrew.hutchinson@mcmail.vanderbilt.edu
------------------------------
Date: Fri, 03 Aug 2001 09:09:32 -0400
From: Keith Resar <3b533a81314e4@heavyk.org>
Subject: Generating Graphs
Message-Id: <3B6AA28C.8C34DFAD@heavyk.org>
I've been trying to find a powerful interface for graphing data in PERL
and have been relatively unsuccessful so far.
I'm looking for a program that can approximate a function to graph given
the data set, rather then just graphing the data itself.
So far I've had no success using GD::Graph and Chart::Graph.
------------------------------
Date: Fri, 03 Aug 2001 13:20:58 GMT
From: crvmp3@hotmail.com (Mark Johnson)
Subject: Re: How to extract non-character data from socket stream?
Message-Id: <90F25DFACmarkjohnsononfiberco@24.28.95.150>
krahnj@acm.org (John W. Krahn) wrote in <3B6A2AB5.CB6521CB@acm.org>:
>From: "John W. Krahn" <krahnj@acm.org>
>Newsgroups: comp.lang.perl.misc
>Subject: Re: How to extract non-character data from socket stream?
>
>Mark Johnson wrote:
>>
>> I am connecting to a network device (a router actually) over TCP. One
>> of the commands on the router outputs the results using ANSI screen
>> formatting codes (nice for humans, bad for automated system monitors).
>>
>
>And of course since there are several different codes you need something
>more complicated to remove all of them. (untested, don't know if this
>will work!)
>
>sub ReadFromDevice () {
> # replace formatting codes with a space
> ( my $response = <$SOCKET> ) =~ s/\e\[[0-9;]*[ABCDHJKRfhsum]/ /;
> return $response;
> }
>
>
>
Sorry for my ignorance, but does the \e translate to the binary value 27 in
the regular expression?
Would read this as:
substitute anything starting with an ESC,
followed by any number between 0 and 9,
followed by a semicolon,
and then (I'm not sure what this last part is saying)...
thanks again...
------------------------------
Date: 3 Aug 2001 05:36:40 -0400
From: dkcombs@panix.com (David Combs)
Subject: how2make @MYARGV from my "cmd-line"? (Might have STRINGS!)
Message-Id: <9kdrb8$a4d$1@panix6.panix.com>
pnews: perl: 'how2make @MYARGV from my "cmd-line"? (Might have STRINGS!)'
How to "parse" something like this:
(Note that any string must be enclosed in either single OR double
quotes.)
format (in square-brackets: optional):
fruit-name [num-in-a-batch] description [asof-date] price
Texas-grapefruit "inside looks and tastes \"red\"." $0.50
banana 6 "Look and taste \"yellow\"." 2aug01 $0.33
apple 2 'Look and taste "red".' $0.33
WITHOUT the quoted-strings, the above is (I think) *simple* to parse into an
@ARGV-like array: just do a split on whitespace.
QUESTION: But how to do it when strings ARE allowed, and each is to be seen
as a (shell) "word"?
-----
Some ideas I've had so far:
(1) While the chomped-line has a *single* "\" at the end, read-in and paste
on the following line.
(insert a white-space? Or just paste right on? Or maybe require that the
following (continuation)
line begins with whitespace. Or make that a mode passed to the sub?
(I recently saw, in PP3 I believe, some clever piece of code that did
this continuation-stuff, although I don't know where in that enormous
book.)
(2) Trick: *Transform* the *whole line* to make it more tractable for
then *finding* or *recognizing" the *end* the one or more
quoted-strings:
. (temporarily) change every "\\" to, say, "^A^A". (needed?)
. (temporarily) change every "\'" to, say, "^A^B.
. (temporarily) change every '\"' to, say, "^A^C".
(3) Find the quoted-strings -- *now* there's no problem (in finding the
string's ending-quote) from any escaped quotes.
(4) As each quoted-string is found, remove it from the line
and push the string onto an array, eg @stringsAry,
and *replacing* it by an simply-encoded "string-number",
eg "^D7" for the seventh quoted-string on the line (thus "pointing" at
its string, in $stringsAry[7-1]).
(Storing away those strings *along with* their begin and end quotes?
Maybe useful later -- after all, some thought and escaping went into
chosing what to quote it with -- ie, a pair of single or double
quotes.
When "within" a string scanning for the end quote, and you find it,
you of course check that the *immediately following* char is a
white-space or end-of-line (and certainly NOT another quote!) -- else
something is pretty screwy (like thinking that, as in some languages,
you escape a *within-string* quote by *doubling* it, like '""',
instead of the insisted-on '\"'.
(It *does* seem too difficult to distinguish a qqXhelloX quoting;
perhaps later for that.)
(5) For each stored-away (still-quoted) string,
undo those backslash-quote "encodings", putting it back the way it was.
(6) Split on whitespace the now-hacked line:
@MYARGV = split($myCmdLine, '')
(7) (OPTIONAL: Make a parallel array, @MYARGVSTYPES, and fill in each slot
with the somehow-determined "type" (switch, integer, real, string, etc)).
(8) DONE! Now it's easy to "process" that line; you just run through that @MYARGV array.
You've actually almost completed a super-simple "getToken()" routine;
all it has to do is return the next index's @MYARGV value.
------
Now, (with some effort) I can do this. But:
---------------------------------------------------
MY FIRST QUESTION: any other (better?) approaches?
---------------------------------------------------
----------------------------------------------------------
MY SECOND QUESTION: what clever ways to *code* this thing?
----------------------------------------------------------
(Uh, it will take me some multiple 100 lines to code it,
given my Fortran/C/Mainsail thinking-hat.)
(REMEMBER: THERE'S ONE ABSOLUTE REQUIREMENT: since the input
originates from some supposed human typing it into a file, we can absolutely
*not* assume that the input-data is *correctly* formatted. So
we have to *check* for everything: misquoting, etc.)
Thanks!
David
------------------------------
Date: 3 Aug 2001 14:29:13 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: how2make @MYARGV from my "cmd-line"? (Might have STRINGS!)
Message-Id: <9kecfp$9en$1@mamenchi.zrz.TU-Berlin.DE>
According to David Combs <dkcombs@panix.com>:
> pnews: perl: 'how2make @MYARGV from my "cmd-line"? (Might have STRINGS!)'
> How to "parse" something like this:
>
>
> (Note that any string must be enclosed in either single OR double
> quotes.)
>
>
> format (in square-brackets: optional):
> fruit-name [num-in-a-batch] description [asof-date] price
>
> Texas-grapefruit "inside looks and tastes \"red\"." $0.50
> banana 6 "Look and taste \"yellow\"." 2aug01 $0.33
> apple 2 'Look and taste "red".' $0.33
Rather synesthetic, that database.
> WITHOUT the quoted-strings, the above is (I think) *simple* to parse into an
> @ARGV-like array: just do a split on whitespace.
>
> QUESTION: But how to do it when strings ARE allowed, and each is to be seen
> as a (shell) "word"?
[snippage]
That's a FAQ. Look it up with "perldoc -q delimited". I'd normally
have to point out that you're supposed to check the FAQ before posting,
(union regulations, you know) but this one is a tad hard to find.
Anno
------------------------------
Date: Fri, 03 Aug 2001 10:35:42 GMT
From: nils-eric@telia.com (Nils-Eric Pettersson)
Subject: I have forgotten...
Message-Id: <3b6a7e1b.317930159@news1.telia.com>
I have fortotten the "GMT" in the expires value...
instead it looks like this:
print "Set-cookie: mycockie=HALLO; expires=Fri 02-Aug-02 21:00:00 GMT;
path=/; domain=mydomain;"
On Fri, 03 Aug 2001 10:08:03 GMT, nils-eric@telia.com (Nils-Eric
Pettersson) wrote:
>I realy dont know if this is the right group to post this question but
>I dont know a better place....
>
>I have also followed all treads in comp.lang.perl.misc about cookies
>and found that a lot of people have problem, but not the same as
>mine...
>
>I set a cookie in a perlscript and I can read it in both IE and Opera
>but not in Netscape 4,7 and 6.0
>
>I have tried in two different ways but with the same result i cant
>find the cookie in NN but in IE and Opera.
>
>I TRIED WITHOUT CGI MODULE:
>
>print "Set-cookie: mycockie=HALLO; expires=Fri 02-Aug-02 21:00:00;
>path=/; domain=mydomain;"
>
>AND I TRIED WITH CGI MODULE:
>
>my $q = new CGI;
>
>my $cookie = $q->cookie(
>-name => "mycockie",
>-value => "HALLO!",
>-domain => "mydomain",
>-expires => "+1y",
>-path => "/",
>-secure => 0 );
>
>print $q->header(
>-type => "text/html",
>-cookie => $cookie );
>
>WHEN I TRIED WHITHOUT CGI MODULE:
>
>I have tried it with and without a traling ";"
>I have tried it with tre letters for the wekday and full length of the
>wekday name
>I have tried to write te year as only the 2 last digits and as a full
>4 digits value
>I have tried to write the domain as "domainnamne.nu",
>".domainnamne.nu", "www.domainnamne.nu", ".www.domainnamne.nu"
>...and so on.
>
>Is there anyone who can tell me what I'm doing wrong...
>
>
------------------------------
Date: Fri, 03 Aug 2001 14:44:35 GMT
From: "Brian McGee" <mcgeeb@jot.nb.ca>
Subject: Net::Ping and alarm troubles
Message-Id: <nNya7.1254$TQ6.194368@news-nb00s0.nbnet.nb.ca>
On an NT based machine running ActivePerl 5.6+, I can not get Net::Ping to
behave.
The following code always says that my server does not exist
use Net::Ping;
my $ping = Net::Ping->new();
print "The result of pinging $address is: ", $ping->ping($address);
$ping->close();
I have experimented with new('tcp') and new ('icmp') but I get the errors
The Unsupported function alarm function is unimplemented at
D:/Perl/lib/Net/Ping.pm line 308.
and
icmp socket error - Unknown error at c:\inetpub\wwwroot\test1.pl line 11
respectively. Any ideas? It is a simple function but it seems to have just
stopped up on me.
-Brian
PS
I noticed that I can not get the alarm function to work. I have re-installed
ActivePerl with the newest version but alarm does not work. That is the
'tcp' problem at least, though I have no idea how to fix it.
------------------------------
Date: Fri, 03 Aug 2001 12:23:27 +0100
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: parallel execution of shell commands in Perl script
Message-Id: <3B6A89AF.100A2D61@bbsrc.ac.uk>
gnari wrote:
>
> In article <3B69D0E2.7DB98F90@tamu.edu>,
> testaccount <testaccount@tamu.edu> wrote:
> >
> >How can I make command1 and command2 run in parallel instead of
> >sequentially as shown below?
> >
> >#!/usr/local/bin/perl
> >[snip]
> >system("command1");
> >system("command2");
> >[snip]
> >exit;
> >
>
> fork();
>
> perldoc -f fork
>
> gnari
..or in many cases
system("command1 &");
system("command2 &");
..may suffice.
------------------------------
Date: 3 Aug 2001 05:15:26 -0400
From: dkcombs@panix.com (David Combs)
Subject: perl "INFO" files? (emacs) Where? (Search for perl-info fails)
Message-Id: <9kdq3e$99i$1@panix6.panix.com>
Ilya has this in his cperl-mode.el file:
Get perl5-info from
$CPAN/doc/manual/info/perl-info.tar.gz
Well, that was 1995, the most recent(!) version of
cperl-mode.
Does this exist, for eg 5.6?
Thanks,
David
------------------------------
Date: Fri, 03 Aug 2001 13:20:49 GMT
From: "Jay Flaherty" <fty@mediapulse.com>
Subject: Re: PERL is cool - DBD: CHarts
Message-Id: <Ryxa7.46682$4e.2774430@news5.aus1.giganews.com>
"Brad McCormack" <brad7477@!!remoove##aol.com> wrote in message
news:996769725.658199@goodnews.cos.agilent.com...
> Anybody use DBD::Charts yet
No. Nobody in the entire world has used DBD::Charts. Even the author has
never used it. He wrote the module on faith that it would work ;-)
jay
------------------------------
Date: Fri, 03 Aug 2001 13:09:39 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: PPM fails in SOAP/Parser.pm
Message-Id: <2l8lmts6pbnd63iaconphmg8lhfmoupqf9@4ax.com>
Alan Pettigrew wrote:
>Retrieving package 'xxxx'
>
>not well-formed line at line 1, column 17, byte 17 at
>C:/Perl/site/lib/SOAP/Parser.pm line 73
I don't know why, but that "line 1, column 17" always comes back.
I think that somehow, PPM failed to retrieve the PPD file, and this is
how it complains. Getting local copies of the .ppd and .tar.gz files,
making the PPD point to the local .tar.gz file, and installing from
that, usually does work.
--
Bart.
------------------------------
Date: Fri, 03 Aug 2001 10:08:03 GMT
From: nils-eric@telia.com (Nils-Eric Pettersson)
Subject: Problem setting a cookie in Netscape
Message-Id: <3b6a6fcc.314267312@news1.telia.com>
I realy dont know if this is the right group to post this question but
I dont know a better place....
I have also followed all treads in comp.lang.perl.misc about cookies
and found that a lot of people have problem, but not the same as
mine...
I set a cookie in a perlscript and I can read it in both IE and Opera
but not in Netscape 4,7 and 6.0
I have tried in two different ways but with the same result i cant
find the cookie in NN but in IE and Opera.
I TRIED WITHOUT CGI MODULE:
print "Set-cookie: mycockie=HALLO; expires=Fri 02-Aug-02 21:00:00;
path=/; domain=mydomain;"
AND I TRIED WITH CGI MODULE:
my $q = new CGI;
my $cookie = $q->cookie(
-name => "mycockie",
-value => "HALLO!",
-domain => "mydomain",
-expires => "+1y",
-path => "/",
-secure => 0 );
print $q->header(
-type => "text/html",
-cookie => $cookie );
WHEN I TRIED WHITHOUT CGI MODULE:
I have tried it with and without a traling ";"
I have tried it with tre letters for the wekday and full length of the
wekday name
I have tried to write te year as only the 2 last digits and as a full
4 digits value
I have tried to write the domain as "domainnamne.nu",
".domainnamne.nu", "www.domainnamne.nu", ".www.domainnamne.nu"
...and so on.
Is there anyone who can tell me what I'm doing wrong...
------------------------------
Date: Fri, 03 Aug 2001 18:14:55 +0300
From: "Rami Saarinen" <rs55862@nospamyahoo.com>
Subject: Q:Of negative numbers and logical operations
Message-Id: <20010803.181453.774044599.1249@nospamyahoo.com>
Hello,
I'm converting an old C-code to perl and I ran to the following problem:
In one point I need to run three variables throught exclusive or (^) and in
the process I end up having a wrong result if a negative (original) value
was involved. I think this has something to do with the (bit) sizes of
variables (i.e. in C the variable is long integer (32 bit) and something else
in perl) thus instead of marking the negative number the first bit is
translated as a number. Or something...
Is there any easy way to correct this? Any kind of advice is appreciated.
Thank you.
(Apologies, if this has been up too many times)
--
Rami Saarinen
If you want to reply by e-mail, please remove "NOSPAM"
from my e-mail address.
------------------------------
Date: Fri, 3 Aug 2001 10:13:09 -0400
From: "Young C. Fan" <yf32@cornell.edu>
Subject: Regex library?
Message-Id: <9kebi4$nht$1@news01.cit.cornell.edu>
Hi,
I was writing a regex-heavy Perl script, but I've been told to rewrite it in
C/C++. The problem is that I'm having a lot of trouble finding a regex
library which supports regular expressions as well as Perl does.
I need the library to support the following:
- substitutions with the /s, /g, /i, and especially the /e modifiers, with
support for backreferences.
If anyone here knows of any such regex library, can you please let me know?
Thank you so much.
Young
------------------------------
Date: Fri, 3 Aug 2001 11:04:01 -0400
From: Mik Mifflin <NOSPAM.dogansmoobs@ctel.net>
Subject: Re: Regex library?
Message-Id: <tmlf9ssmdt26f@corp.supernews.com>
Just be a smart ass and call the perl script from the c program. That'll
solve it. I see no reason it would have to be in c/c++. If speed really
matters that much, then then you can turn your perl script into C source
and compile it (I believe). I have found that redoing something in C or
C++ takes too much time and effort, and the rewards are not that great
compared to Perl.
- Mik Mifflin
Dogansmoobs at ctel dot net
Young C. Fan wrote:
> Hi,
>
> I was writing a regex-heavy Perl script, but I've been told to rewrite it
> in C/C++. The problem is that I'm having a lot of trouble finding a regex
> library which supports regular expressions as well as Perl does.
>
> I need the library to support the following:
>
> - substitutions with the /s, /g, /i, and especially the /e modifiers, with
> support for backreferences.
>
> If anyone here knows of any such regex library, can you please let me
> know? Thank you so much.
>
> Young
>
>
>
------------------------------
Date: Fri, 03 Aug 2001 13:05:17 GMT
From: "Jay Flaherty" <fty@mediapulse.com>
Subject: Re: Reporting Questionable Programming Activity
Message-Id: <hkxa7.207864$2O6.13515289@news2.aus1.giganews.com>
"Smiley" <gurm@intrasof.com> wrote in message
news:3b672381.218715906@news1.on.sympatico.ca...
> The company I'm working for purchased a Perl CGI Script that turns out
> to be seriously faulty - so much so that my boss asked me to
> investigate whether there's any international agency or organization
> set up that we can report this kind of thing to.
>
> Does anybody know? Thanks :)
>
Like an *International* lemon law? :-)
------------------------------
Date: Fri, 03 Aug 2001 07:51:15 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Reporting Questionable Programming Activity
Message-Id: <3B6A9E43.46C55C@home.com>
Dave Stafford wrote:
>
> "Smiley" <gurm@intrasof.com> wrote in message
> >
> > The company I'm working for purchased a Perl CGI Script that
> > turns out to be seriously faulty - so much so that my boss asked
> > me to investigate whether there's any international agency or
> > organization set up that we can report this kind of thing to.
>
> In Europe (dunno about elsewhere) you have certain rights as a
> consumer. When you buy a product it is expected to work, and if
> it does not you can have the product replaced or your money
> returned.
>
> I would go back to the supplier and threaten to sue.
Heh. Most software sold in the US contains disclaimers in the small
print that says (cynically paraphrased) "This software is not guaranteed
to be suitable for any purpose whatsoever, including (and especially)
that for which it was marketed." >:)
-mjc
PS: comp.lang.perl is a zombie. Please don't post there anymore.
Followups set.
------------------------------
Date: Fri, 3 Aug 2001 14:37:15 +0100
From: "Tom Melly" <tom.melly@ccl.com>
Subject: Re: Reporting Questionable Programming Activity
Message-Id: <3b6aa90b$0$3757$ed9e5944@reading.news.pipex.net>
"Michael Carman" <mjcarman@home.com> wrote in message
news:3B6A9E43.46C55C@home.com...
>
> Heh. Most software sold in the US contains disclaimers in the small
> print that says (cynically paraphrased) "This software is not guaranteed
> to be suitable for any purpose whatsoever, including (and especially)
> that for which it was marketed." >:)
>
I think what it says is (cynically paraphrased)
"If this software turns out to be a lemon and loses your company money, you can
claim the cost of the software back, but not the money you lost". Or, to put it
another way "We didn't know you were going to do THAT with our software! Wooo!
That's one hell of a bug you've found there - I wonder how we missed it?"
------------------------------
Date: 3 Aug 2001 05:52:08 -0700
From: samara_biz@hotmail.com (Alex)
Subject: Re: Script works on PWS but not IIS?
Message-Id: <c7d9d63c.0108030452.2d5a82dc@posting.google.com>
"Sven K?ler" <skoehler@upb.de> wrote in message news:<9kbuon$86c$07$1@news.t-online.com>...
> perhaps you use IE ... and IE automatically logs you in as the user you
> are - for example administrator :-) - which gives the script the rights of
> the administrator ...
Yep. I do use IE and I am logged in as an administrator on the local
machine. That must be the reason why the script works on PWS on the
local machine, but not on IIS on a remote webserver then.
Thanks for your help again. I really appreciate it.
Alex
------------------------------
Date: 3 Aug 2001 06:35:27 -0700
From: demerphq@hotmail.com (Yves Orton)
Subject: Re: Splitting a text list into smaller lists?
Message-Id: <74f348f7.0108030535.6db3f997@posting.google.com>
"John W. Krahn" <krahnj@acm.org> wrote in message news:<3B6A75CF.9CA8355C@acm.org>...
> Yves Orton wrote:
> >
> > "John W. Krahn" <krahnj@acm.org> wrote in message news:<3B69DFD7.BBAE494@acm.org>...
> > >
> > > Or you could do it this way :-)
SNIP
> > > while ( @in >= 50 ) {
> >
> > Sorry, but I tested this and it still fails. I dont think you can get
> > around either $flush or two calls to eof.
>
> Sorry, I _did_ test this code and it _does_ work (from STDIN and the
> command line.) :-)
>
Ok. Well, not to be argumentative :-) , but I dont see how. If after
reading the last line of the file @in<50 then the output while will
never be entered and the output will fail. Consider the following code
which is basically your routine but pared down (no real file stuff and
5 instead of 50)
#!/usr/bin/perl -w
use strict;
my $COUNT=5;
my @in;
while ( <DATA> ) {
local $, = ",";
local $\ = "\n";
chomp;
push @in, split /4/;
while ( @in >= $COUNT ) { # change 1
print splice( @in, 0, $COUNT );
redo if eof(DATA) and @in; # change 2
}
}
__DATA__
Name4Name4Name4Name4Name4
Name4Name4Name4Name4Name4
NAME4NAME4
--------------------------------OUTPUT-----------------------------
Name,Name,Name,Name,Name
Name,Name,Name,Name,Name
--------------------------------END OUTPUT-------------------------
And then if you change the two lines as so:
change 1:while ( @in >= $COUNT || (my $flush=eof(DATA))) {
change 2: last if $flush;
I believe that you _should_ get the following (I do)
--------------------------------OUTPUT-----------------------------
Name,Name,Name,Name,Name
Name,Name,Name,Name,Name
NAME,NAME
--------------------------------END OUTPUT-------------------------
So my first thought would be to check your test data and see if it
actually _does_ test this particular problem. :-)
SNIP
> > > redo if eof() and @in;
> >
> > Hmm, dont quite follow the logic here.
>
> redo goes to the top of the loop _without_ testing ( @in >= 50 ) so if
> <> is at eof _and_ there are still elements in @in (one or more) it
> writes another file with the remaining elements and @in now has zero
> elements. After the file is closed it encounters the redo statement
> again and eof() is still true but @in is false so it goes to the top of
> the loop and tests ( @in >= 50 ) which is false and the program ends.
> Is that clear? :^)
Yup. It made sense on first read, then I got confused, and failed to
rethink it through correctly. Sorry. :-)
Cheers,
Yves
------------------------------
Date: 3 Aug 2001 13:32:34 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Strange behavior?
Message-Id: <9ke95i$58c$2@mamenchi.zrz.TU-Berlin.DE>
According to Kolorove Nebo <sky@mail.lviv.ua>:
> About first question....
>
> ... because %try->{22} and $try(22) just the same...
Nonsense.
Anno
------------------------------
Date: 3 Aug 2001 13:33:45 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Strange behavior?
Message-Id: <9ke97p$58c$3@mamenchi.zrz.TU-Berlin.DE>
According to Roman Khutkyy <sky@mail.lviv.ua>:
> Pardon...... $try{22}
Still nonsense.
Anno
------------------------------
Date: Fri, 3 Aug 2001 08:38:24 -0400
From: "Bill Hess" <bhess@techrg.com>
Subject: Win32 Apahce NPH equivalent
Message-Id: <tml6pchcad9b79@corp.supernews.com>
Is there a way to get Apache on Win32 to perform the old NPH using a Perl
script. I can do this on the UNIX side by setting the $| Perl global
variable
But this does not seem to work on the Win32 side.
Is this a function of Perl or Apache or both?
Bill Hess
------------------------------
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 1434
***************************************