[22021] in Perl-Users-Digest
Perl-Users Digest, Issue: 4243 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 10 21:06:06 2002
Date: Tue, 10 Dec 2002 18:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 10 Dec 2002 Volume: 10 Number: 4243
Today's topics:
Re: A formating problem (Jan Fure)
Brand new to Perl. Version and compatibility question. (Robert F.)
Re: Brand new to Perl. Version and compatibility questi (Walter Roberson)
Re: Brand new to Perl. Version and compatibility questi <jeff@vpservices.com>
Re: can somebody explain this statement? (Malcolm Dew-Jones)
Re: can somebody explain this statement? (Walter Roberson)
Comparison confusion (Rob Richardson)
Re: convert a date-time to an absolute value (in second (Tad McClellan)
Re: Currency Regular expression (Elf)
debug in cgi environment (indigoperl) ? <os7man@attbi.com>
Re: debug in cgi environment (indigoperl) ? <flavell@mail.cern.ch>
Re: Filenames on Win32: the bane of my existence.... (drsmith)
Re: Filenames on Win32: the bane of my existence.... <pkent77tea@yahoo.com.tea>
HELP.... problem splitting fields (KTyson9426)
Re: HELP.... problem splitting fields <eric.ehlers@btopenworld.com.spamoff>
Re: HELP.... problem splitting fields (Jay Tilton)
How DO YOU CONSTRUCT A URL STRING FROM A POST METHOD IN (gnuist006)
HOW DO YOU CONSTRUCT A URL STRING FROM A POST METHOD IN (gnuist006)
Re: How to do 32-bit calculations WITH overflow? <mikkon@excelsql.com>
Re: Max fork'd proc limit...? <pkent77tea@yahoo.com.tea>
Re: multi procs, how to stop child <mgjv@tradingpost.com.au>
Newbie question <ihave@noemail.com>
perl bad interpreter: No such file or directory (Stas Neuberger)
Re: perl bad interpreter: No such file or directory <flavell@mail.cern.ch>
Prototype mismatch: sub POE::Wheel::SocketFactory <rivow@nogaworld.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Dec 2002 16:32:05 -0800
From: jan_may2002_fure@attbi.com (Jan Fure)
Subject: Re: A formating problem
Message-Id: <e47a84bf.0212101632.5916ae1d@posting.google.com>
Jeff 'japhy' Pinyan <pinyaj@rpi.edu> wrote in message
<--------------------------- Snip -------------------------------->
> # step 1 -- read the file into a hash of array-references:
> my (%data, @points);
>
> while (<INFO>) {
> my ($field, $val) = split;
> push @{ $data{$field} }, $val;
> }
>
> # step 2 -- convert hash of array-references
> # into array of array-references
>
> @points = (
> [ keys %data ],
> [ values %data ],
> );
>
> That's all he wrote!
Jeff;
I like your solution a lot, but unfortunately it does not work for
getting the proper format. The @points array needs to be an array of
arrays, where the first element (the keys) is an array, and the second
element is an array of arrays, with one element per key, and each
element is an array containing the data points for the corresponding
key.
How must the code be modified to provide the given structure?
I have functional code below, but it looks more elegant if I can
achieve the same without using a loop.
BTW, upon experimenting with the boxplot module, I have determined
that the data does not have to be sorted, but I don't want to loose
the order of the keys (first column of INFO/@data2), which must be
alphanumerically sorted.
Jan
my $n3=0;
(my $TOOL, my $DISCARD) = split /\t/, $data2[0];
my @TOOLS;
$TOOLS[0]=$TOOL;
my $NEWTOOL;
my $KUDD2;
my $n4=0;
my $d2;
my @DD;
my @defdata;
foreach $d2 (@data2){
($NEWTOOL, $KUDD2) = split /\t/, $d2;
if($NEWTOOL ne $TOOL){
push @defdata, [ @DD ];
$n4++;
$TOOLS[$n4]=$NEWTOOL;
@DD=();
}
$TOOL=$NEWTOOL;
push @DD, $KUDD2;
}
push @defdata, [ @DD ];
my @points=(
[@TOOLS],
[@defdata]
);
------------------------------
Date: 10 Dec 2002 15:34:18 -0800
From: rfrigerio@northropgrumman.com (Robert F.)
Subject: Brand new to Perl. Version and compatibility question.
Message-Id: <4e11f28b.0212101534.b14942e@posting.google.com>
Hi, I am absolutely brand new to perl. I am upgrading a system here
at work that has perl on it. First question is how can I find out
what version we currently have? Second question is a two parter,
should I upgrade it to a newer version, and will our current scripts
run on a new version?
Thanks for any help.
------------------------------
Date: 10 Dec 2002 23:46:58 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: Brand new to Perl. Version and compatibility question.
Message-Id: <at5udi$rek$1@canopus.cc.umanitoba.ca>
In article <4e11f28b.0212101534.b14942e@posting.google.com>,
Robert F. <rfrigerio@northropgrumman.com> wrote:
:Hi, I am absolutely brand new to perl. I am upgrading a system here
:at work that has perl on it. First question is how can I find out
:what version we currently have?
perl -V
: Second question is a two parter,
:should I upgrade it to a newer version, and will our current scripts
:run on a new version?
We don't know what you have now and we don't know what features your
scripts rely on, so we cannot say for sure. I'd estimate that it is
more likely than not that in -your- situation that some of the scripts
would break when you upgraded: newer versions of Perl are usually
better at finding lingering errors that had been overlooked before.
--
The Knights Of The Lambda Calculus aren't dead --this is their normal form!
------------------------------
Date: Tue, 10 Dec 2002 15:47:20 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Brand new to Perl. Version and compatibility question.
Message-Id: <3DF67D08.30603@vpservices.com>
Robert F. wrote:
> Hi, I am absolutely brand new to perl. I am upgrading a system here
> at work that has perl on it. First question is how can I find out
> what version we currently have?
Type this at a command prompt:
perl -v
> Second question is a two parter,
> should I upgrade it to a newer version,
If your current version is less than 5.005, very definitely, yes you
*definitely* should. If it is between 5.005 and 5.8, yes, you probably
should, though you could get by without doing so. If it is 5.8, no :-).
> and will our current scripts
> run on a new version?
The answer is yes they will run. Will you need to change them? Yes,
but not humongously if your current version is 4.x. If your version is
5.x, probably not, and if so only minorly. You should test in any case.
Install the new version *in addition* to the old version rather than
*instead* of the old version so you can fall back on the old version if
it takes you some time to do the testing.
--
Jeff
------------------------------
Date: 10 Dec 2002 11:26:13 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: can somebody explain this statement?
Message-Id: <3df63fd5@news.victoria.tc.ca>
HamuNaptra (hamunaptra@pandora.be.NOSPAM) wrote:
: can somebody explain this statement?
: grep /^[^\.]/
^ = match must start at first char in the "line" being grep'd
[^\.] = match a single char that is not a dot
some lines that match are (The quotes are not the data)
"hello"
"w.w"
some lines that do not match are
".hello"
".."
"."
: foreach (grep /^[^\.]/, readdir D){
: $_="$_[0]\\$_";
: -f $_ ?():()
: }
For file name in directory D that does not start with a dot, implicitly
put a string (the filename) into the variable $_, and then modify the
string in the variable, and then test if the new string is the file name
of a plain file, and then do either one of two things that appear to do
nothing - () or () .
------------------------------
Date: 10 Dec 2002 19:35:29 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: can somebody explain this statement?
Message-Id: <at5fm1$l06$1@canopus.cc.umanitoba.ca>
In article <3df63fd5@news.victoria.tc.ca>,
Malcolm Dew-Jones <yf110@vtn1.victoria.tc.ca> wrote:
|HamuNaptra (hamunaptra@pandora.be.NOSPAM) wrote:
|: can somebody explain this statement?
|: foreach (grep /^[^\.]/, readdir D){
|: $_="$_[0]\\$_";
|: -f $_ ?():()
|: }
|For file name in directory D that does not start with a dot, implicitly
Small point: it isn't the directory D, it's the DIRHANDLE D.
There would have been an opendir() further up that gave the association
between D and the directory name to be processed.
--
And the wind keeps blowing the angel / Backwards into the future /
And this wind, this wind / Is called / Progress.
-- Laurie Anderson
------------------------------
Date: 10 Dec 2002 16:51:51 -0800
From: therobs@n2net.net (Rob Richardson)
Subject: Comparison confusion
Message-Id: <f79bc007.0212101651.294b7e32@posting.google.com>
Greetings!
Yet another newbie question:
The Perl script I am modifying contains the following line:
if ((param('step')) eq "")
A little test script I wrote contained the following line:
if (param('selection') eq "")
The first comparison works just fine. The first time through the
script, the comparison is true and the initial web page is displayed
to the user. The user makes a choice, the parameter named 'step' is
set to "step2", and the comparison is false. The second comparison
did not work. It is true whether or not 'selection' is set to
anything.
I'm pretty sure that I'm getting my contexts confused, but I don't
know why. Can anyone explain it?
Thanks again!
Rob
P.S. Is there a list that is preferred to this one for asking newbie
questions like these?
------------------------------
Date: Tue, 10 Dec 2002 15:35:46 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: convert a date-time to an absolute value (in seconds or so)
Message-Id: <slrnavcnhi.3lq.tadmc@magna.augustmail.com>
Brian McCauley <nobull@mail.com> wrote:
> ZZT <a@b.c> writes:
[ a FAQ, yet again ]
> It is not considered polite behaviour to post a question to a Usenet
> group without looking to see if it is in the FAQ first.
By now it should be clear that his time is valuable and that
your time, and the time of the hundreds/thousands of others here,
is not valuable.
So you should spend your time polishing your swastika instead! <g>
"Just what we need, another Newsgroup Nazi."
Message-ID: <sg3d8u80fi1hg13r9iekv780jrrssigo4l@4ax.com>
"He was rude and didn't give any help" (pot, kettle, black)
Message-ID: <kovi8u0ah2p1jpvu4pk9fcna4cfv8thiq1@4ax.com>
"Is there a kind of sleep or wait function?" (SAQ)
Message-ID: <asqabk$8kd$1@news1.wdf.sap-ag.de>
^^
^^ hmmm.
"is there a way to read a value from standard-input (keyboard)
with one command"
Message-ID: <asq7rp$6je$1@news1.wdf.sap-ag.de>
"how can I simulate a telnet session to a specific port in perl"
^^^^^^
Message-ID: <aprs5f$1ij$1@news1.wdf.sap-ag.de>
"is there a not to difficult way to retrieve+delete mails
from an IMAP server within a perl-script?"
Message-ID: <apr6iv$ete$1@news1.wdf.sap-ag.de>
"Is there a way to make such an ass. array clearer?" (SAQ)
Message-ID: <al7nbd$bu9$1@news1.wdf.sap-ag.de>
"I have a line with the following format (undefined spaces
between the entries) and would like to extract the value"
^^^^^^^
Message-ID: <al7f1i$623$1@news1.wdf.sap-ag.de>
"a way to open a file and set the readposition without reading
the whole file"
Message-ID: <al76vr$jp$1@news1.wdf.sap-ag.de>
"I have $string="xxx/STRING.yyy" and would like to extract
STRING while xxx can be anything"
Message-ID: <ag1jab$sh3$1@news1.wdf.sap-ag.de>
"Now I want to get the string xxx (length not defined) in a $value."
Message-ID: <afrjat$ogr$1@news1.wdf.sap-ag.de>
"exists a substring in a string"
Message-ID: <ag1ga9$q28$1@news1.wdf.sap-ag.de>
"I would like to give the perl-script some startup-parameters.
How can I access them inside the script?"
Message-ID: <afs2cf$6k1$1@news1.wdf.sap-ag.de>
"How to generate the next foreach loop?" (SAQ)
^^^^
Message-ID: <3CC6D363.8050402@b.c>
"How to find out, how many elements an array has?"
Message-ID: <3CC14B8A.80007@b.c>
"a simple routine that tells me if for instance "file1* exists"
Message-ID: <3C9F1ADD.1090903@b.c>
"I call perl with the script and some parameters. How can I
get these parameters inside the script?"
Message-ID: <3C99F165.40003@b.c>
"with $string=~ s/string1/string2/; I can replace the 1st
occurence of string1 in $string. Is there a way to replace all?"
Message-ID: <3C875646.5070903@b.c>
"switch/case question"
^^^^^^
Message-ID: <3C80D6A2.4070402@b.c>
"execute an external program and would like to get the output
^^^^^^^^
of this program in a @-variable. How can I do that?"
Message-ID: <3C7F30F9.9050505@b.c>
"is there a way to split a string by another string?" (SAQ)
^^^^^
Message-ID: <3C7CA93D.6000408@b.c>
"is that possible? I have string "6.23" and want to get "6,23"."
Message-ID: <3C4ED5F8.8010403@b.c>
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 10 Dec 2002 16:55:05 -0800
From: smltestau@yahoo.com.au (Elf)
Subject: Re: Currency Regular expression
Message-Id: <6c45ec57.0212101655.3a32b4ee@posting.google.com>
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnavajin.2qt.tadmc@magna.augustmail.com>...
> Elf <smltestau@yahoo.com.au> wrote:
>
> > (?:\.\d{1,2}){0,1} - Optional group of full stop followed by 1-2
>
> > On the last bit, can I potentialy do (?:\.\d{1,2})? .
>
>
> Yes.
>
>
> > The reason I
> > ask is that the docko says says that the ? following a ) makes the
> > pattern a non-greedy pattern match.
>
>
> Then the docko is wrong. What doc are you referring to?
AUUUGGGHHH! Thanks Tod. I looked back at the docko muttering "I'm
sure I'm right..." It says...
When this character immediately follows any of the other quantifiers
(*, +, ?, {n}, {n,}, {n,m}), the matching pattern is non-greedy.
Looking at it now, it would appear that the ()'s are to group the
quantifiers, not part of the list judging by the placement of the
separating comma's!
>
> A ? following a _quantifier_ makes it non-greedy:
>
> +?
> *?
> ??
> {0,1}?
>
>
> > Any comments (again this is for JavaScript)?
>
>
> Ask in the Perl newsgroup, get the Perl answer.
*grin*
Elf
------------------------------
Date: Wed, 11 Dec 2002 00:40:06 GMT
From: Eric Osman <os7man@attbi.com>
Subject: debug in cgi environment (indigoperl) ?
Message-Id: <3DF689E1.8E19D606@attbi.com>
Hi,
If I run my perl from win98 dos box, I have no
trouble debugging it.
BUT, when I attempt to run it as a cgi response to
a web page, using my indigoperl apache environment,
I don't see how to debug.
The dead ends I seem to be hitting:
o When I hit the SUBMIT button on my test
web page, the CGI perl just HANGS.
o I looked in documentation and it talked about
various -w and other switches to use on the
perl command, but since I'm invoking the perl
in CGI environment, how do I get opportunity
to even use -w ??
o Even the use of "print" doesn't work well
because of the CGI environment. I managed
to do a bit of "SELECT STDOUT" and get
minimal info, but this was cumbersome.
o I found the indigoperl/logs/error.log file
but only certain dire errors even show up
there, not the bulk of what I want to see.
What simple ways have you used to win here ?
Is there a more specific newsgroup for indigoperl ?
Is there another section in the indigoperl documentation
I have missed that will help ?
Thanks for some help here if you have some ideas.
/Eric
------------------------------
Date: Wed, 11 Dec 2002 02:14:37 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: debug in cgi environment (indigoperl) ?
Message-Id: <Pine.LNX.4.40.0212110159580.507-100000@lxplus073.cern.ch>
On Dec 11, Eric Osman inscribed on the eternal scroll:
> BUT, when I attempt to run it as a cgi response to
> a web page, using my indigoperl apache environment,
> I don't see how to debug.
Check out CGI::Carp , and in particular:
use CGI::Carp qw(fatalsToBrowser);
and friends.
But also, don't omit to look in your server's error log. (Oh, I see
you already did that).
I had already installed Activestate Perl and then Win32 Apache before
I got to hear about Indigoperl, so my answers about the latter will be
a bit generic I'm afraid.
> o I looked in documentation and it talked about
> various -w and other switches to use on the
> perl command, but since I'm invoking the perl
> in CGI environment, how do I get opportunity
> to even use -w ??
-w and -T can go on the 'shebang' line at the start of your script.
Apache respects them when invoking CGI scripts, even in Win32
situations. (It would be different if you were using Certain Other
web servers, but steer clear of anything from MS as they tend to be
non-standard, whereas with Apache one is gaining transferrable
skills, ready for the move to a real OS ;-)
> o Even the use of "print" doesn't work well
> because of the CGI environment.
Indeed. that's why it's good to get most of the details out of the
way from a command shell (as you noted before) before moving to the
actual server situation.
And to avoid disappointment - do be aware that -w and -T and 'use
strict;' don't in themselves cure any problems - they produce _extra_
diagnostics, which are meant to help _you_ cure the problems: but
you want to sort those before trying to run the script from the
server.
> Is there a more specific newsgroup for indigoperl ?
comp.infosystems.www.authoring.cgi (auto-moderated - check its FAQ) is
a better place to deal with CGI issues as opposed to Perl language
issues. there's comp.infosystems.www.servers.ms-windows for the
specifics of ms-windows-based servers. (And of course the server
documentation and FAQs at httpd.apache.org ).
> Is there another section in the indigoperl documentation
> I have missed that will help ?
We don't quite know what you've found yet and what you haven't,
but there's useful references in perlfaq9.
------------------------------
Date: 10 Dec 2002 11:09:43 -0800
From: drsmithhm@hotmail.com (drsmith)
Subject: Re: Filenames on Win32: the bane of my existence....
Message-Id: <c7c208d1.0212101109.268c9cd6@posting.google.com>
pkent <pkent77tea@yahoo.com.tea> wrote in message news:<pkent77tea-87D383.01101710122002@news-text.blueyonder.co.uk>...
> In article <c7c208d1.0212091255.6b0849cb@posting.google.com>,
> drsmithhm@hotmail.com (drsmith) wrote:
>
> > The problem is that many of the filenames contain dates, spaces, and
> > other special characters like umlat's. Perl's readdir function is
> > returning '?' characters in place of the special characters which
> > later on causes unlink() to fail.
>
> Is the filesystem where these files are stored a native windows local
> volume? I only ask because we use sharity, I think, on some linux
> machines to mount windows SMB shares and we get '?' is filenames in
> place of, say, Unicode characters. It might be the same thing, or maybe
> not.
>
> P
alright - I posted a follow up this morning and it's still not here...
I'll try again.
This server is running a standard NTFS filesystem with Mac Services.
The problem is files that get created from the Mac have a different
encoding for some of the characters. For instance, if I save a file
with a date - 'My Research Grant - 12/10/2002' becomes 'My Research
Grant - 12?10?2002' on the server. The / is a legal character on the
Mac, but it get's turned into '?' characters on the actual server.
Trying to unlink() these files always fails.
If anyone has a solution or suggestion, I'd appreciate it.
--drsmith
------------------------------
Date: Wed, 11 Dec 2002 01:02:16 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Filenames on Win32: the bane of my existence....
Message-Id: <pkent77tea-35DB67.01021411122002@news-text.blueyonder.co.uk>
In article <c7c208d1.0212100441.5d12f418@posting.google.com>,
drsmithhm@hotmail.com (drsmith) wrote:
> Yes - it's a Windows 2000 Server running NTFS. Every file on the
> server with an 'extended' character fails to unlink() - If it weren't
> for that, I wouldn't really care. Furthermore when a mac saves a file
> with a date - 12/10/2002, the '/' characters get the macintosh
> encoding and show up as '?' instead(as in 12?10?2002). These files
> can't be unlink()'d either.
hmm, well I have no solution, you'll be glad to hear, but I would guess
that this problem could be coming from the C routines which actually (or
at least appear to) get the next directory entry from the directory. It
may be that perl is, say, coercing unicode strings (returned by the
operating system) into 8 bits/character NULL terminated C style strings.
I can't find anythign in the perlunicode man page, although it does note
that there may be problems if you use, directly or indirectly, code
which do not cope with unicode.
Maybe this has been fixed in perl 5.8 though, with its apparently better
Unicode support.
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: 10 Dec 2002 19:54:46 GMT
From: ktyson9426@aol.com (KTyson9426)
Subject: HELP.... problem splitting fields
Message-Id: <20021210145446.00430.00000200@mb-fl.aol.com>
I'd like to thank everyone in advance
I've got to move some data from one database and into another.... But what I'm
seeing on the export of one of the databases is the second field (customer
phone number and name) are indexed together.... Which looks like this
'8474569483joe'... What I need to do is split the number and first name out
from each other so I can import them into the other database seperately....
I would have expected the following to work
/(\w+) \W+ (\w+) \W+ (\w+) \W+ (\w+) (\w+) (\w+)\W+ (\w+) \W+ (\w+)/;
$_ = $2;
$phone = ~ s/^.{1,10}/^.{1,10},/;
But it doesn't, for reasons I'm not aware of, which I'm sure is obvious to most
of you.... If anyone could share any light on how to do this I would greatly
appreciate it....
Once again... Thanks
------------------------------
Date: Tue, 10 Dec 2002 21:15:55 +0000 (UTC)
From: "eric" <eric.ehlers@btopenworld.com.spamoff>
Subject: Re: HELP.... problem splitting fields
Message-Id: <at5lib$k0l$1@helle.btinternet.com>
hello
no offense but i'm baffled as to why you think your code would come close to
solving the stated problem ...
anyway please try the below.
regards
eric
use strict;
use warnings;
my $field="8474569483joe";
my ($num,$name)=$field=~/(\d+)(\w+)/;
print "num=$num, name=$name\n";
------------------------------
Date: Tue, 10 Dec 2002 22:50:17 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: HELP.... problem splitting fields
Message-Id: <3df66c91.2676854@news.erols.com>
ktyson9426@aol.com (KTyson9426) wrote:
: I've got to move some data from one database and into another....
Have you tried using the database system's native tools or Perl's DBI
instead of all this export/import jazz?
: But what I'm
: seeing on the export of one of the databases is the second field (customer
: phone number and name) are indexed together.... Which looks like this
: '8474569483joe'
Looks like the data is being exported in fixed-width fields.
Have you tried exporting as CSV, or importing as fixed-width?
: /(\w+) \W+ (\w+) \W+ (\w+) \W+ (\w+) (\w+) (\w+)\W+ (\w+) \W+ (\w+)/;
Kinda pointless to show that without also showing a sample string it's
supposed to match against.
If the fields are whitespace-separated, is there a reason for not using
split()?
If the fields are fixed-width, have you tried using unpack() instead of a
capturing m// to burst the record?
: $_ = $2;
Never use the dollar-digit scalars without testing that the match
succeeded.
: $phone = ~ s/^.{1,10}/^.{1,10},/;
Where is $phone getting its value? Is that thing you just assigned to $_
in the previous step what you want in $phone? Are you writing this
program without warnings enabled?
The second half of the s/// operator is a string, not a regex.
$phone = ~ s/^(.{1,10})/$1,/;
------------------------------
Date: 10 Dec 2002 17:42:43 -0800
From: gnuist006@hotmail.com (gnuist006)
Subject: How DO YOU CONSTRUCT A URL STRING FROM A POST METHOD IN A FORM ?
Message-Id: <b00bb831.0212101742.369f0040@posting.google.com>
Hi,
I do not know if this is the right group for my question sorry if I am
wrong here.
I have the following html page:
<html><head></head>
<form method=post action=http://www.some_site.zzz/tt.t >
<input type="text" name="ID" value="5">
<INPUT type="submit" name="down_load" VALUE="button">
</form>
</body></html>
and when I click the button the site sends a file and a dialog box opens
with the filename in it asking your to save it.
I want to automate this. One method is to construct some url like this:
http://www.some_site.zzz/tt.t-ID=5&down_load=submit&method=post
I am not sure if this is correct approach. I know little about wget although
it comes with NTRK and I know little about perl. If a kind soul can give me
a very simple working solution in either wget, perl or both, it would be
very nice. I know C/C++ and can hack a little if you get me started.
Thanks for reading
--
gnuist
------------------------------
Date: 10 Dec 2002 17:35:06 -0800
From: gnuist006@hotmail.com (gnuist006)
Subject: HOW DO YOU CONSTRUCT A URL STRING FROM A POST METHOD IN A FORM
Message-Id: <b00bb831.0212101735.5c253170@posting.google.com>
Hi,
I do not know if this is the right group for my question sorry if I am
wrong here.
I have the following html page:
<html><head></head>
<form method=post action=http://www.some_site.zzz/tt.t >
<input type="text" name="ID" value="5">
<INPUT type="submit" name="down_load" VALUE="button">
</form>
</body></html>
and when I click the button the site sends a file and a dialog box opens
with the filename in it asking your to save it.
I want to automate this. One method is to construct some url like this:
http://www.some_site.zzz/tt.t-ID=5&down_load=submit&method=post
I am not sure if this is correct approach. I know little about wget although
it comes with NTRK and I know little about perl. If a kind soul can give me
a very simple working solution in either wget, perl or both, it would be
very nice. I know C/C++ and can hack a little if you get me started.
Thanks for reading
--
gnuist
------------------------------
Date: Tue, 10 Dec 2002 21:23:28 +0200
From: "Mikko Noromaa" <mikkon@excelsql.com>
Subject: Re: How to do 32-bit calculations WITH overflow?
Message-Id: <at5evd$hf2$1@phys-news1.kolumbus.fi>
> Not necessarily. The bit patterns you get are the same with signed and
> unsigned arithmetic, so if you don't tell the C program they're signed
> you'll be fine. The difference is just interpretation.
>
> You may have problems during your calculations if you have to compare
> quantities, but if you can disregard signs, just plow ahead under
> "use integer". If you need the value a result would have under
> unsigned arithmetic, you can use your modulo operation *without* "use
> integer".
Thanks for you reply. Indeed, rewriting some comparisons, and creating my
own modulo function solved the problem. In case anyone else is interested,
my modulo function looks as follows:
sub mod32
{
my $n=shift(@_);
my $i=shift(@_);
my $r;
no integer;
if ($n<0) { $n+=4294967296; }
if ($i<0) { $i+=4294967296; }
$r=$n%$i;
use integer;
return ($r);
}
--
Mikko Noromaa (mikkon@excelsql.com)
Noromaa Solutions - see http://www.excelsql.com
------------------------------
Date: Wed, 11 Dec 2002 01:14:07 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Max fork'd proc limit...?
Message-Id: <pkent77tea-90B7DB.01140511122002@news-text.blueyonder.co.uk>
In article <at3hu3$53l$1@bolt.sonic.net>,
SPAMBLOCKER@BLOCKEDTOAVOIDSPAM.com (Spammay Blockay) wrote:
> This is probably a well-known topic, but I looked all 'round Deja and Google,
> and perused perl.org, perl.com and CPAN, and wasn't able to find an answer.
>
> Running Perl 5.6 and 5.8 on Windows, I found I was only able to fork() 64
> times. Running under Linux, I got 38.
>
> Is this an OS limit? Or a Perl limit?
It's a limit imposed on your program by the system. See the 'ulimit'
manpage on Unix. No idea what to do on Windows.
I've just run a little program that forks, and then the child forks and
then the child of that forks... it got up to 181 generations before I
hit control C. Maybe you ran out of memory? Or did you mean that your
parent forked off 38 first-generation children?
If you could post a short, strict, warnings-free example I can try it on
my system and see what happens.
> What's the scoop on fork() and processes? perlfunc/fork doesn't say
> anything about fork() dying like that.
The fork() docs tell you that fork() returns three things depending on
what happened when the fork(2) system call was called (or equivalent).
Although it doesn't say I would imagine that, as it's a system call, the
variable $! will be set appropriately.
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: Wed, 11 Dec 2002 01:44:18 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: multi procs, how to stop child
Message-Id: <slrnavd673.865.mgjv@verbruggen.comdyn.com.au>
On Tue, 10 Dec 2002 21:15:23 +1100,
who <someone@somewhere.com> wrote:
> Hi,
>
> I have a shell script that I want to convert to perl and make a few
> modifications. I understand that fork in perl is almost the same as C.
> Is it possible to execute say 3 different functions in the background
> and before each child completes the function call, exit before the
> script is complete. I want the parent to execute some code after this
> point, but the child procs should not.
Then make sure that only your parent executes that code, and the
children do not. The return value of fork should tell you whether the
code is running in a child or a parent.
See the documentation for fork() in the perlfunc pages, and the
perlipc documentation for some examples.
Martien
--
|
Martien Verbruggen | If it isn't broken, it doesn't have enough
Trading Post Australia | features yet.
|
------------------------------
Date: Wed, 11 Dec 2002 00:40:50 GMT
From: "TBN" <ihave@noemail.com>
Subject: Newbie question
Message-Id: <mQvJ9.1$dwA4.65629@news2.randori.com>
I've got the following code that works fine...
open (STUFF, $myFile) || open (STUFF, $defFile) || ¬Found;
The code works great, but I want to use the same variable for the file in
both opens, so I tried something like:
open (STUFF, $myFile) || $myFile="aDefaultFile.txt"; open (STUFF, $myFile)
|| ¬Found;
Which does not work. I know there's an easy solution to this one probably,
but can't find an example for this.
Thanks.
------------------------------
Date: 10 Dec 2002 16:04:46 -0800
From: stas@epost.de (Stas Neuberger)
Subject: perl bad interpreter: No such file or directory
Message-Id: <bea0b7d7.0212101604.27680982@posting.google.com>
i get this message on every perl script i'm trying to start. doesn't
matter via cgi or shell. the script runs normally if i add -w at the
end of #!/usr/bin/perl. also perl test.pl runs the file. the files
have normal unix LF.
does somebody knows the solution for this problem?
thx. stas
------------------------------
Date: Wed, 11 Dec 2002 02:18:49 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: perl bad interpreter: No such file or directory
Message-Id: <Pine.LNX.4.40.0212110215100.507-100000@lxplus073.cern.ch>
On Dec 10, Stas Neuberger inscribed on the eternal scroll:
> i get this message on every perl script i'm trying to start. doesn't
> matter via cgi or shell. the script runs normally if i add -w at the
> end of #!/usr/bin/perl. also perl test.pl runs the file.
This should be an FAQ. I'm convinced you have a stray CR from e.g
MS-Win-land at the end of that line in your unix file.
> the files have normal unix LF.
I have to express doubt about that. Your description of symptoms
is just too good a match.
------------------------------
Date: Tue, 10 Dec 2002 23:47:23 +0100
From: RiVoW <rivow@nogaworld.com>
Subject: Prototype mismatch: sub POE::Wheel::SocketFactory
Message-Id: <nbrcvuc9bmmo8p81oabv8ifcqgskhrn2v0@4ax.com>
Hi, I'm a newbie at Perl and trying to get the bot example in the POE
cookbook to work .... But even without changing anything is wont work
for me.
I keep on getting these errors:
Prototype mismatch: sub POE::Wheel::SocketFactory::EADDRNOTAVAIL vs
()at (eval
42) line 1.
Prototype mismatch: sub POE::Wheel::SocketFactory::EINPROGRESS vs ()
at (eval 42
) line 1.
Prototype mismatch: sub POE::Wheel::SocketFactory::EWOULDBLOCK vs ()
at (eval 42
) line 1.
Prototype mismatch: sub POE::Wheel::SocketFactory::F_GETFL vs () at
(eval 42) li
ne 1.
Prototype mismatch: sub POE::Wheel::SocketFactory::F_SETFL vs () at
(eval 42) li
ne 1.
SuccessState is deprecated. Use SuccessEvent at
H:/perl/site/lib/POE/Component/
IRC.pm line 336
I tried to find what to do about this but I can't find anything ... do
I need to reinstall anything? I run ActivePerl And just downloaded
the new POE component ............
RiVoW
------------------------------
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 4243
***************************************