[17504] in Perl-Users-Digest
Perl-Users Digest, Issue: 4924 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 19 14:10:33 2000
Date: Sun, 19 Nov 2000 11:10:14 -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: <974661014-v9-i4924@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 19 Nov 2000 Volume: 9 Number: 4924
Today's topics:
Re: Perl beginner <captmarvil@rcn.com>
Re: Perl beginner (Colin Watson)
Re: Perl beginner (Colin Watson)
perl ftp script question? halcali@aol.com
Re: Perl List Question (GMc)
Re: Perl List Question (Garry Williams)
Re: Perl List Question <jtk@_nospam_jtkconsulting.com>
Re: Perl List Question <jtk@_nospam_jtkconsulting.com>
Re: Perl List Question (Adam)
Re: print 'Location: <bart.lateur@skynet.be>
Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
Re: Realrates.com needs your Rate and Salary Data! (Mark W. Schumann)
Re: Setting up apache for SSI not working. What might b <lauren_smith13@hotmail.com>
Re: Setting up apache for SSI not working. What might b <joe+usenet@sunstarsys.com>
Re: Sort files by date <iltzu@sci.invalid>
Re: Sorting Numeric Lists sfcq2@my-deja.com
Re: Sorting Numeric Lists (Tad McClellan)
Re: System command, limit on number of ARGV? dtbaker_dejanews@my-deja.com
Re: System command, limit on number of ARGV? (Adam)
Re: System command, limit on number of ARGV? (Tad McClellan)
Re: System command, limit on number of ARGV? dtbaker_dejanews@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 19 Nov 2000 09:45:37 -0500
From: "David Marvil" <captmarvil@rcn.com>
Subject: Re: Perl beginner
Message-Id: <8v8p0e$mnf$1@bob.news.rcn.net>
I am still having difficulty in getting this script to work. I can't get any
values to print using eq if I use = I can get a value for $user but I can't
get a value for $a. I am not sure if I am am suppose to have a $ in front of
name on line 11, I have tied both with and without. I have also moved the
the quotes around. Thanks.
"Wyzelli" <wyzelli@yahoo.com> wrote in message
news:yZGR5.6$dm1.2290@vic.nntp.telstra.net...
> "David Marvil" <captmarvil@rcn.com> wrote in message
> news:8v75dn$jba$1@bob.news.rcn.net...
> > #! /usr/bin/perl -w
> > print "Enter users name: ";
> > chomp ($user = <STDIN>);
> > open (FILE, "/user_info") || die "File not found";
> > while (<FILE>) {
> > chomp;
> > ($name, $ip) = /(\w+\s+\w+)\s+(\d+\.\d+\.\d+\.\d+)/;
> > $a{$name} = $ip;
> > }
>
> if ($name eq $user){
> print "$user\t"$a{name};
> }
>
> Hope that helps
>
> Wyzelli
> --
> #Modified from the original by Jim Menard
> for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
> wall,\n";
> print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
> $_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
> wall\n\n";}print'*burp*';
>
>
------------------------------
Date: 19 Nov 2000 14:45:53 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: Perl beginner
Message-Id: <8v8p31$3v9$1@riva.ucam.org>
Wyzelli <wyzelli@yahoo.com> wrote:
>"David Marvil" <captmarvil@rcn.com> wrote in message
>news:8v75dn$jba$1@bob.news.rcn.net...
>> #! /usr/bin/perl -w
>> print "Enter users name: ";
>> chomp ($user = <STDIN>);
>> open (FILE, "/user_info") || die "File not found";
You mean:
open (FILE, "/user_info") || die "Couldn't open /user_info: $!";
The open might fail for other reasons.
>> while (<FILE>) {
>> chomp;
>> ($name, $ip) = /(\w+\s+\w+)\s+(\d+\.\d+\.\d+\.\d+)/;
>> $a{$name} = $ip;
>> }
Some indentation is nice inside blocks, otherwise it's much harder to
read.
>if ($name eq $user){
> print "$user\t"$a{name};
>}
Case-insensitivity was specified, so either:
if (lc $name eq lc $user) { ... }
... or:
if ($name =~ /\Q$user/i) { ... }
--
Colin Watson [cjw44@flatline.org.uk]
"Engfeh ngggg *znork*"
"Was that a zombie?" "It's 9:30 in the morning."
"Ahhhh. That was a kernel hacker." - http://www.userfriendly.org/
------------------------------
Date: 19 Nov 2000 17:28:42 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: Perl beginner
Message-Id: <8v92ka$6je$1@riva.ucam.org>
David Marvil <captmarvil@rcn.com> wrote:
>"Wyzelli" <wyzelli@yahoo.com> wrote in message
>news:yZGR5.6$dm1.2290@vic.nntp.telstra.net...
>> if ($name eq $user){
>> print "$user\t"$a{name};
>> }
>
>I am still having difficulty in getting this script to work. I can't get any
>values to print using eq if I use = I can get a value for $user but I can't
>get a value for $a. I am not sure if I am am suppose to have a $ in front of
>name on line 11, I have tied both with and without. I have also moved the
>the quotes around.
Heh. The various corrections all missed $a{$name} ... I guess none of us
test our code. ;)
A corrected version of your script that works for me is:
===== cut here =====
#! /usr/bin/perl -w
use strict;
my $user;
my %info;
print "Enter user's name: ";
chomp ($user = <STDIN>);
open (FILE, "/user_info") || die "Couldn't open /user_info: $!";
while (<FILE>) {
chomp;
my ($name, $ip) = /(\w+\s+\w+)\s+(\d+\.\d+\.\d+\.\d+)/;
$info{lc $name} = [$name, $ip];
}
if (exists $info{lc $user}) {
my ($name, $ip) = @{$info{lc $user}};
print "$name\t$ip\n";
}
===== cut here =====
Since you want case-insensitivity, I've stored a reference (see 'perldoc
perlref') to a list of the username and IP address in a hash indexed by
the username in lower case. I assume there's some reason why you don't
just test as you're reading the file - perhaps you're doing some other
processing?
I've made the code work under 'use strict' by lexically scoping
variables with my(), and I've also used something other than %a for the
hash; not strictly necessary, but since $a has special meaning in sort()
it might avoid confusion if you ever end up sorting the input data.
Your code is pretty sensitive to the exact format of the input file
(like assuming that names have two components separated by the same
amount of space as in whatever the user types on stdin). You might find
that split() gives you more tolerant code quite concisely.
And, if that doesn't work, you could actually try some proper debugging.
Insert print statements at various points in your program to show you
what values are contained in variables, or use 'perl -d' (see 'perldoc
perldebug'). Debugging by trying random code changes and seeing if the
whole thing works afterwards is a recipe for spending a great deal of
time debugging and frustrated, I'm afraid.
--
Colin Watson [cjw44@flatline.org.uk]
"However, most netters acknowledge the offline world's advantages,
despite the fact that it is slow, clunky, and hogs bandwidth."
- "Surfing on the Internet", J.C. Herz
------------------------------
Date: Sun, 19 Nov 2000 17:06:22 GMT
From: halcali@aol.com
Subject: perl ftp script question?
Message-Id: <8v91ac$jg7$1@nnrp1.deja.com>
I am having trouble building a perl script to upload files to an ftp
account...
the problem is the script is connecting and uploading, but only part of
the file... and this is with tiny files @10kb
someone in this newsgroup gave a url to
http://search.cpan.org/doc/GBARR/libnet-1.0703/Net/FTP.pm
but will the methods there work with the perl 5.0... that is on most
web hosts, or does that require an extra module be installed (if so it
won't work for me)
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 19 Nov 2000 15:28:53 GMT
From: gmccroryX@Xhome.com (GMc)
Subject: Re: Perl List Question
Message-Id: <Xns900F6D988gmc641603@24.14.77.6>
>try this:
>
> @Email = map { "$_:" } @Email;
Even better:
$Email[$ListPos + 1] = ":";
GMc
------------------------------
Date: Sun, 19 Nov 2000 15:47:52 GMT
From: garry@zweb.zvolve.net (Garry Williams)
Subject: Re: Perl List Question
Message-Id: <ICSR5.1064$xb1.62143@eagle.america.net>
On Sun, 19 Nov 2000 15:28:53 GMT, GMc <gmccroryX@Xhome.com> wrote:
>>try this:
>>
>> @Email = map { "$_:" } @Email;
>
>Even better:
>
>$Email[$ListPos + 1] = ":";
I doubt that that is "better". I doubt that that is even useful.
--
Garry Williams
------------------------------
Date: Sun, 19 Nov 2000 12:29:16 -0500
From: "Jtk" <jtk@_nospam_jtkconsulting.com>
Subject: Re: Perl List Question
Message-Id: <t1g3ef593dure2@corp.supernews.com>
> try this:
>
> @Email = map { "$_:" } @Email;
This is allot more compact than what I was doing and has
taught me a good lesson, however it is still
adding the colon to the front of each item and
I need it to add it to the end of each item.
In other words I still have the same problem.
With what I posted and with what you posted I get:
:Z@aol.com
:Z@whatever.com
:Z@anyserver.com
And what I need is:
Z@aol.com:
Z@whatever.com:
Z@anyserver.com:
Thanks for your help
Jtk
------------------------------
Date: Sun, 19 Nov 2000 12:39:46 -0500
From: "Jtk" <jtk@_nospam_jtkconsulting.com>
Subject: Re: Perl List Question
Message-Id: <t1g40jcvf8e7bb@corp.supernews.com>
Bob Walton <bwalton@rochester.rr.com> wrote :
> $Email[$ListPos].=':';
> @Email=map{$_.':'}@Email;
Bob thanks for your help, however as with Adam's
example these lines are still adding the colon at the
front of each item instead of the end of each, so I
am right where I started.
So at it's very simplest form the code reads like this:
open ( InFile, 'email.txt') or die "Can't Open the email.txt file.\n";
@Email = <InFile>;
@Email=map{$_.':'}@Email;
print @Email;
Any ideas why I can't get this colon added to the end of each
item instead of the front of each item?
With what I posted and with what you posted I get:
:Z@aol.com
:Z@whatever.com
:Z@anyserver.com
And what I need is:
Z@aol.com:
Z@whatever.com:
Z@anyserver.com:
Thanks for your everyone's help
Jtk
------------------------------
Date: Sun, 19 Nov 2000 18:04:09 GMT
From: adamf@box43.gnet.pl (Adam)
Subject: Re: Perl List Question
Message-Id: <3a18144f.25733554@nntp.lucent.com>
On Sun, 19 Nov 2000 12:29:16 -0500, "Jtk"
<jtk@_nospam_jtkconsulting.com> wrote:
>> try this:
>>
>> @Email = map { "$_:" } @Email;
>
> This is allot more compact than what I was doing and has
> taught me a good lesson, however it is still
> adding the colon to the front of each item and
> I need it to add it to the end of each item.
really? 8-O
i cannot figure out how you did it.
so, respectivelly following code shoud add colons to the end of each
item?:
@Email = map { ":$_" } @Email;
...no way ;). look for typos.
> In other words I still have the same problem.
>
> With what I posted and with what you posted I get:
>
>:Z@aol.com
>:Z@whatever.com
>:Z@anyserver.com
>
> And what I need is:
>
>Z@aol.com:
>Z@whatever.com:
>Z@anyserver.com:
good luck
--
Adam.
------------------------------
Date: Sun, 19 Nov 2000 17:28:54 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: print 'Location:
Message-Id: <aa3g1to61iu48b9h055n2h737im25foh1a@4ax.com>
Todd Anderson wrote:
>I am trying to write a script that would be run by cron. I'm not sure of
>how to prompt another scipt on another server.
"Location" is typical for CGI. You cannot run scripts from cron and
expect them to behave and interface like CGI scripts. For example, the
"Location" header serves to send the browser to another page. When you
run it from cron: what browser? There isn't any browser!
--
Bart.
------------------------------
Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v8n9b$iec$1@newstoo.ericsson.se>
Hi all,
I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:
$bitfile = param("bitfile");
open (SAVE,">./bitfile.bit") || die $!;
binmode(SAVE);
while ( read($bitfile,$data,1024) ) {
print SAVE $data;
}
close SAVE;
What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.
Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?
Johan
------------------------------
Date: 19 Nov 2000 14:02:27 -0500
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Realrates.com needs your Rate and Salary Data!
Message-Id: <8v9843$8of@junior.apk.net>
[posted and emailed to Janet Ruhl]
In article <8uov5i$o6t$1@bob.news.rcn.net>,
Janet Ruhl <ruhl@realrates.com> wrote:
>I'm posting this message on the newsgroups where we've seen Realrates.com
>recommended as a resource over the past year.
Hey, Janet. I know you from those great years on the Compuserve CONSULT
forum. The survey is neat. Your contributions to the consulting industry
have been superb. But I gotta tell you one thing.
comp.lang.perl.misc isn't a "jobs" group. It's for discussion of _using_
Perl, not for discussion of getting jobs with Perl.
You know how we had a pretty well formalized set of rules on CONSULT?
We kept advertising within certain bounds, and there was a special
library section for resumes, and a different message area for job
offers, that kind of thing?
Well, Usenet is like that too. One of the rules is that if a group
doesn't have ".jobs" in its name it's not for recruting or rate surveys
or anything of the sort. And another rule is that if a group begins
with "comp." it's presumed to be for technical discussions unless you
know otherwise.
You're doing the right thing here, in the wrong way.
Have you read the Emily Postnews articles in news.announce.newusers
yet? They're Usenet's equivalent of reading the forum bulletins.
Please check them out and apply what you learn.
Good luck with this year's survey.
------------------------------
Date: Sun, 19 Nov 2000 17:49:33 GMT
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Setting up apache for SSI not working. What might be missing?
Message-Id: <NoUR5.3217$ba3.677290@dfiatx1-snr1.gtei.net>
"Gonçalo" <tabs_paradise@yahoo.com> wrote in message
news:8v8h64$7fr$1@venus.telepac.pt...
> Hello all.
> I am trying to run some cgi scripts in my site with SSI.
> Well, I have set up Apache with all the correct settings advised in
> www.apache.org and I tried all that I could (the includes_module is
> installed, I added "includes" to the options line, I uncommented the
AddType
> and AddHandler for parsing the shtml files), and still the server
isn't
> reckoning the SSI call. I'm calling the scripts using the <!--#exec
> cgi="/cgi-bin/script.pl" --> that I always used, and the server isn't
> parsing the page.
> What might be missing here?
>
This always seems to rub people the wrong way, but you are asking this
question in the wrong newsgroup. You may want to find on that has
'servers' or 'Apache' in its name. Those guys know this stuff like the
back of their hands.
Lauren
------------------------------
Date: 19 Nov 2000 13:37:37 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Setting up apache for SSI not working. What might be missing?
Message-Id: <m37l5zu7ta.fsf@mumonkan.sunstarsys.com>
I've narrowed f'ups back to the appropriate ng.
"Lauren Smith" <lauren_smith13@hotmail.com> writes:
> "Gonçalo" <tabs_paradise@yahoo.com> wrote in message
> news:8v8h64$7fr$1@venus.telepac.pt...
> > Hello all.
> > I am trying to run some cgi scripts in my site with SSI.
> > Well, I have set up Apache with all the correct settings advised in
> > www.apache.org and I tried all that I could (the includes_module is
> > installed, I added "includes" to the options line, I uncommented the
> AddType
> > and AddHandler for parsing the shtml files), and still the server
> isn't
> > reckoning the SSI call. I'm calling the scripts using the <!--#exec
> > cgi="/cgi-bin/script.pl" --> that I always used, and the server isn't
> > parsing the page.
> > What might be missing here?
> >
>
> This always seems to rub people the wrong way, but you are asking this
> question in the wrong newsgroup. You may want to find on that has
> 'servers' or 'Apache' in its name. Those guys know this stuff like the
> back of their hands.
>
He already did, but he didn't crosspost it. I guess he's not satisfied
with the answer he got in c.i.w.s.unix, so he's reposted it here.
At least this time the "space dash dash angle" is there.
In short, there is no way to know what OP has done wrong given the info
provided. My guess is that he hasn't read the "Options" documentation
fully w.r.t merging options via (+/-) and SSI/CGI directives:
------------
ExecCGI
Execution of CGI scripts is permitted.
Includes
Server-side includes are permitted.
IncludesNOEXEC
Server-side includes are permitted, but the #exec command and
#include of CGI scripts are disabled.
------------
Personally I would add a "<!--#printenv -->" statement to the file
in question to see if *any* SSI directives are parsed.
--
Joe Schaefer
------------------------------
Date: 19 Nov 2000 15:25:10 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Sort files by date
Message-Id: <974647367.18622@itz.pp.sci.fi>
In article <8uvk1g$cnb@netnews.hinet.net>, John Lin wrote:
>
>Well then, for subsitiution of these very frequently written codes,
>I would suggest to provide a module (or build in?) like:
>
> use List::Utilities;
> my ($min,$max) = minmax {-M $a <=> -M $b} @files;
> if(first {$_ eq 'target'} @array) { print "found" }
>
>so we can write conveniently without losing efficiency.
You're being just slightly too verbose..
http://search.cpan.org/search?module=List::Util
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post
something, we discuss its implications. If the discussion happens to
answer a question you've asked, that's incidental." -- nobull in clpm
------------------------------
Date: Sun, 19 Nov 2000 14:00:12 GMT
From: sfcq2@my-deja.com
Subject: Re: Sorting Numeric Lists
Message-Id: <8v8mda$bpb$1@nnrp1.deja.com>
I tried that, but nothing has changed. I've checked the sort
documentation at www.perl.com and it seems to say that all that is
needed to sort a list is the following line:
@sorted = sort { $a <=> $b } @unsorted;
But do I need more than this? Do any modules need to be declared, and if
so which ones?
Rob.
In article <ChPR5.12$Wq1.484@vic.nntp.telstra.net>,
"Wyzelli" <wyzelli@yahoo.com> wrote:
> <sfcq2@my-deja.com> wrote in message
news:8v8e27$6ee$1@nnrp1.deja.com...
> > Hello,
> >
> > I have a file with a list of numbers (date stamps) of the following
> > type:
> >
> > 730527
> > 730589
> > 730457
> >
> > And I want to sort this list in ascending numerical order. I have
tried
> > reading the file contents into an array, and then using the built in
> > sort function as follows:
> >
> > @sorted = sort { $x <=> $y } @unsorted;
> >
>
> That only sorts 'ascii" because the sort function uses the 'special'
> variables $a and $b.
>
> Change your $x and $y to $a and $b and see what happens.
>
> To reverse, the order, reverse the $a and $b.
>
> Check on the sort documentation is perlfunc.
>
> Wyzelli
> --
> #Modified from the original by Jim Menard
> for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on
the
> wall,\n";
> print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
> $_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
> wall\n\n";}print'*burp*';
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 19 Nov 2000 10:20:38 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Sorting Numeric Lists
Message-Id: <slrn91fru6.85s.tadmc@magna.metronet.com>
[ Please put your comments *following* the quoted text that you
are commenting on.
Please do not quote an entire article.
Please never quote .signatures.
Please see news.announce.newusers
Thanks.
]
[ Jeopardectomy performed ]
On Sun, 19 Nov 2000 14:00:12 GMT, sfcq2@my-deja.com <sfcq2@my-deja.com> wrote:
>In article <ChPR5.12$Wq1.484@vic.nntp.telstra.net>,
> "Wyzelli" <wyzelli@yahoo.com> wrote:
>> <sfcq2@my-deja.com> wrote in message
>> > @sorted = sort { $x <=> $y } @unsorted;
>> Change your $x and $y to $a and $b and see what happens.
>I tried that, but nothing has changed. I've checked the sort
>documentation at www.perl.com
Phew! You don't need to go all the way over there to check docs.
They are already on your hard disk, just check them there!
perldoc -f sort
perldoc -q sort
>and it seems to say that all that is
>needed to sort a list is the following line:
>
>@sorted = sort { $a <=> $b } @unsorted;
Right.
>But do I need more than this?
No.
>Do any modules need to be declared,
No.
There is something that you are not telling us then, as the
code above should work. Show us a *complete* and short program
that we can run where the numbers get sorted in ASCII order.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 19 Nov 2000 15:14:02 GMT
From: dtbaker_dejanews@my-deja.com
Subject: Re: System command, limit on number of ARGV?
Message-Id: <8v8qno$ep1$1@nnrp1.deja.com>
hhhhmmmm, thanx for the interesting ideas Martien and Abe.... I havent
found out yet if the limitation is the number of arguements, or on the
total number of characters. I have a feeling that the limitation might
be a "feature" of the system() implementation for win32. I am running
this on a windows98 PC.
I'd really like to use the system() call because it is ndoing some
processing for a web cgi.... I want the main script to return a message
to the browser quickly while the processing contiues.
I think I'll have to change the logic to write a temp file.... ;(
Dan
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 19 Nov 2000 16:37:11 GMT
From: adamf@box43.gnet.pl (Adam)
Subject: Re: System command, limit on number of ARGV?
Message-Id: <3a180064.20634194@nntp.lucent.com>
On Sun, 19 Nov 2000 15:14:02 GMT, dtbaker_dejanews@my-deja.com wrote:
>hhhhmmmm, thanx for the interesting ideas Martien and Abe.... I havent
>found out yet if the limitation is the number of arguements, or on the
>total number of characters. I have a feeling that the limitation might
>be a "feature" of the system() implementation for win32. I am running
>this on a windows98 PC.
not at all, system() works as good as underlying OS allows...
it is a "feature" of the win32 and its predecessor MS-DOS,
the "faetures" exactly are:
- maximum of 9 command line parameters, and
- command line cannot exceed 127 characters.
>I'd really like to use the system() call because it is ndoing some
>processing for a web cgi.... I want the main script to return a message
>to the browser quickly while the processing contiues.
HTH
--
Adam.
------------------------------
Date: Sun, 19 Nov 2000 09:57:26 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: System command, limit on number of ARGV?
Message-Id: <slrn91fqim.85s.tadmc@magna.metronet.com>
On Sun, 19 Nov 2000 05:58:18 GMT, dtbaker_dejanews@my-deja.com
<dtbaker_dejanews@my-deja.com> wrote:
>I just ran into a "feature" of the system() command
It is not a feature of the system() function.
It is a feature of the shell underlying the use of the system() function.
>that I am not sure
>how to deal with,
man xargs
would be an expedient solution.
>so I thought I'd continue this thread on a related
>topic if ya'll dont mind.
>
>I have been using a script with lines like this:
> system( "$SysCmd" ) ;
You should not include worthless double quotes, it only slows
down understanding:
system( $SysCmd ) ;
>which has worked ok until I put in too many @ImageList ... then the
>system() command fails with "access denied."
Since that messages does not appear in perldiag.pod, it must
not be coming from perl.
It is coming from the shell. So you have a shell question, not a
Perl question.
( but the usual shell message is something like "argument list too long",
what shell is saying "access denied" instead?
)
>I looked for some info on
>what the limit of args passed might be, but didnt see anything.
You probably were looking in the wrong place :-)
You needed to be looking at shell docs, but you probably looked
at Perl docs instead.
>Is there a limit?
Not in Perl.
>Ideas on passing a large list? do I need to write a temp file or
>something like that?
I would go with a shell solution (xargs) to a shell problem :-)
Or, switch to a different shell that does not have that limit.
Or best yet, don't use system() to run perl. Rewrite the Perl
program as a Perl function, then just call it directly (but
you might want to pass a reference to @ImageList instead of
passing @ImageList itself).
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 19 Nov 2000 17:00:42 GMT
From: dtbaker_dejanews@my-deja.com
Subject: Re: System command, limit on number of ARGV?
Message-Id: <8v90vo$j5h$1@nnrp1.deja.com>
> not at all, system() works as good as underlying OS allows...
> it is a "feature" of the win32 and its predecessor MS-DOS,
> the "faetures" exactly are:
> - maximum of 9 command line parameters, and
> - command line cannot exceed 127 characters.
>
------------------
aha..... I suspected as much. good to get confirmation on that. I am
surprised this caveat wasnt easier to find in the docs I looked thru?!
thanx,
dan
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
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 4924
**************************************