[13985] in Perl-Users-Digest
Perl-Users Digest, Issue: 1395 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 16 12:12:21 1999
Date: Tue, 16 Nov 1999 09:10:22 -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: <942772221-v9-i1395@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 16 Nov 1999 Volume: 9 Number: 1395
Today's topics:
Re: Making a Perl/Tk standalone executable <nigel_williams@my-deja.com>
Maximum number of open files <jklein@alerts.co.il>
Re: Move files. . . (Brett W. McCoy)
Multiple page form <mark.tait@capgemini.co.uk>
Now it works... (Lab. - konto &)
Re: O, and the answer is - (Abigail)
Re: OO woes (Abigail)
openin file on client machine <mbickham@photographics.co.uk>
Re: openin file on client machine <gellyfish@gellyfish.com>
Re: openin file on client machine <jxu@wcom.net>
Re: openin file on client machine <mbickham@photographics.co.uk>
Re: openin file on client machine <mbickham@photographics.co.uk>
Perl on AS/400 <arg@milvus.com>
Re: PerlShop, Minivend <jojo@buchonline.net>
Re: PerlShop, Minivend emarkert@my-deja.com
Problem with glob on NT host <dennis.kowalsk@daytonoh.ncr.com>
Re: Q: Dodgy use of undef on global variables? <uri@sysarch.com>
Re: Question... Carriage Returns in PERL <linberg@literacy.upenn.edu>
Re: Question... Carriage Returns in PERL <lr@hpl.hp.com>
Re: Question... Carriage Returns in PERL <linberg@literacy.upenn.edu>
reading html files <nigell.boulton@rade.net>
Re: reading html files (Michael Budash)
Re: Slurping output form system(runme.exe) <sariq@texas.net>
Re: Slurping output form system(runme.exe) <hattons@cpkwebser5.ncr.disa.mil>
Re: Sys::Syslog setlogsock (M.J.T. Guy)
system() on Win 32 doesn't seem to do anything <jkerper@edgil.com>
Thanks for nothing (Lab. - konto &)
Re: Thanks for nothing <gellyfish@gellyfish.com>
Re: Thanks for nothing <rhomberg@ife.ee.ethz.ch>
Re: Too much Perl? <uri@sysarch.com>
Re: Trying to use a variable as an operator <sariq@texas.net>
Re: Trying to use a variable as an operator (Kragen Sitaker)
unbuffered input <hakjo733@student.liu.se>
Re: unbuffered input (M.J.T. Guy)
Using Open2() Win32 NT ? <hattons@cpkwebser5.ncr.disa.mil>
Re: Where can i find more information on Schwartzian tr <uri@sysarch.com>
Re: Why isn't the HTML::Parser an HTML::Parser? (Eric Bohlman)
Re: Why perl won't print to STDOUT? <aviva.starkman@exchange.sp.trw.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 16 Nov 1999 13:43:06 GMT
From: Nigel W <nigel_williams@my-deja.com>
Subject: Re: Making a Perl/Tk standalone executable
Message-Id: <80rn1a$trb$1@nnrp1.deja.com>
> Nigel W wrote:
> >
> > Does anyone know if it's possible to make a wrapper for a Perl/Tk
> > script so that it can run on a system which doesn't have Perl/Tk
> > installed.
>
> In theory. I've found it more useful to write a simple script
> which just installs Perl and Tk on the machine I want to use.
I suppose that's possible if I include Perl/Tk on the CD, install it
then delete it when done. Ideally I'd like to include Perl/Tk on the CD
and run the scripts from there.
What do I need to include on the CD? I normally use /use/local/bin &
lib for perl5 - if I put these on CD and use #!../bin/perl (a relative
path) will Perl still be able to find it's libraries or is there an
environment variable that can be used?
>
> > The reason for this is to generate software/Oracle DB installation
> > scripts with a nice GUI which I can use on any Solaris box without
> > having to install Perl/Tk.
>
> Or, for real convenience, if Oracle is on your NFS network,
> just put Perl & TK on the same network. We use Perl over our
> NFS network with no trouble [well, not any more than NFS
> produces ordinarily].
That's fine when I'm in the office but I often visit customer sites to
perfrom installs - ideally, some customers will want to do the install
of Oracle 8 and our software themselves so I want a friendly GUI rather
than the current command-line text.
Nigel
>
> David
> --
> David Cassell, OAO cassell@mail.cor.epa.gov
> Senior computing specialist
> mathematical statistician
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 16 Nov 1999 16:54:51 +0200
From: Yossi Klein <jklein@alerts.co.il>
Subject: Maximum number of open files
Message-Id: <Pine.SO4.4.10.9911161546010.19468-100000@tree.alerts.co.il>
I'm in shock.
I'm working on a Solaris machine, and using ulimit, I upped the maximum
number of file descriptors to 700. I then ran a test program using open
and found that open() will only allow me to have to 256 files open at a
time.
Okay, I thought "Perl open() is based on C's fopen() which only supports
fds up to 255".
So I tried FileHandle and found that it also failed above 256; I can live
with that.
With supreme confidence, I decided to run the test with sysopen. Imagine
my surprise when I found that still only 256 open fds were supported!!!
This seems to me to be a major bug. I searched the archives and looked
through the perlfaq, but there is no reference to this anywhere. Is this a
real problem or am I missing something very obvious?
PS I ran my program using truss and verified that the system call open()s
were succeeding and that Perl was deciding to fail the Perl sysopen()
call nonetheless.
Below is the program that I used to test this. The 3 open() lines are
mutually exclusive - ie. only uncomment one at a time.
Any help would be greatly appreciated,
Thanks,
Yossi Klein
---------------------
#!/usr/local/bin/perl
use FileHandle;
use Fcntl;
$i = 0;
while ($i < 350)
{
$fd = "fd$i";
$fname = '/dev/null';
#$rc = open ($fd, "<$fname");
#$rc = ($ffh[$i] = new FileHandle)->open($fname, "r");
#$rc = sysopen($fd, $fname, O_RDONLY);
if (!$rc)
{
die "open $i failed\n";
}
$i++;
}
------------------------------
Date: Tue, 16 Nov 1999 15:32:15 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: Move files. . .
Message-Id: <slrn832ubt.5io.bmccoy@moebius.foiservices.com>
Also Sprach Sphere <sbrook@nildram.co.uk>:
>Is there a "safe" command in Perl that I can use to move text files from one
>place to another on a unix system - or should I be asking a unix group?
perldoc File::Copy
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: Tue, 16 Nov 1999 16:58:24 -0000
From: "Mark Tait" <mark.tait@capgemini.co.uk>
Subject: Multiple page form
Message-Id: <80s2fm$36r$2@taliesin.netcom.net.uk>
Keywords: perl, cgi, form, multiple page
Hi - does anyone know of a script which will process a multiple page form
(for a survey questionairre) - all the data has to be processed together -
to enable each persons answers to be kept together - and written to a text
file.
I'm using MS IIS...
Many thanks in anticipation, and kindest regards,
Mark Tait
------------------------------
Date: 16 Nov 1999 14:58:57 GMT
From: nproj-2@mdstud.chalmers.se (Lab. - konto &)
Subject: Now it works...
Message-Id: <80rrfh$s72$1@nyheter.chalmers.se>
Sorry that I bothered you, I don't know why i didn't work last time.
/Joakim
------------------------------
Date: 16 Nov 1999 06:37:28 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: O, and the answer is -
Message-Id: <slrn832k6n.cvu.abigail@alexandra.delanet.com>
Uri Guttman (uri@sysarch.com) wrote on MMCCLXVIII September MCMXCIII in
<URL:news:x7n1sfuifc.fsf@home.sysarch.com>:
() >>>>> "RB" == Re'em Bar <reembar@netvision.net.il> writes:
()
() RB> $text=~s/<!--.*?-->//gs;
() RB> did the trick just fine.
() RB> thanks, Larry Rosler, for your remark about the /s modifier.
()
() and that will fail for various forms of comments. if abigail didn't
() killfile you (i doubt she hasn't) she would show you some typical
() counter examples.
I already did on his first posting. Apparently, he either has killfiled
me, doesn't read my postings, or doesn't understand them. Repeating
the counterexamples would be utterly pointless.
Abigail
--
perl -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
print chr 0x$& and q
qq}*excess********}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 16 Nov 1999 06:34:15 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: OO woes
Message-Id: <slrn832k0n.cvu.abigail@alexandra.delanet.com>
Damian Conway (damian@cs.monash.edu.au) wrote on MMCCLXVIII September
MCMXCIII in <URL:news:80qsvk$oip$1@towncrier.cc.monash.edu.au>:
;; abigail@delanet.com (Abigail) writes:
;;
;; >How far away is the errata list?
;;
;; Oops! Abigail was charmingly pointing out in the subtlest manner that I had
;; fallen into the old "Not Of This Package" trap.
Uhm, no, I wasn't. It's just that I'm reading your book, and I found a typo.
Now, if only I can find the typo again, so I check whether it's already
reported.....
Abigail
--
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print
qq{Just Another Perl Hacker\n}}}}}}}}}' |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Tue, 16 Nov 1999 16:00:11 -0000
From: "Mike Bickham" <mbickham@photographics.co.uk>
Subject: openin file on client machine
Message-Id: <z9fY3.99$Sn.6068@newsr2.u-net.net>
Hi All,
I hope this is the right newsgroup for what I am about to ask.
Is it possible to use a Perl-CGI script to create and open a file on a
clients machine and place some binary data (in the form of a TIFF graphic
file) into this file???
If so, how would I do it?
Regards,
Mike Bickham
------------------------------
Date: 16 Nov 1999 16:03:52 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: openin file on client machine
Message-Id: <38318068_1@newsread3.dircon.co.uk>
Mike Bickham <mbickham@photographics.co.uk> wrote:
> Hi All,
>
> I hope this is the right newsgroup for what I am about to ask.
Lets see now ...
> Is it possible to use a Perl-CGI script to create and open a file on a
> clients machine and place some binary data (in the form of a TIFF graphic
> file) into this file???
>
Nope its not the right newsgroup.
/J\
--
"Like Anne Robinson in a Korean restaurant, it'll be dog eat dog" -
Graham Norton
------------------------------
Date: Tue, 16 Nov 1999 11:30:28 -0500
From: "Jun Xu" <jxu@wcom.net>
Subject: Re: openin file on client machine
Message-Id: <80s0ub$msa$1@news.cis.ohio-state.edu>
The simple answer is NO. CGI script runs on the server, and its output is
directed to the client browser through the web server. CGI script does not
have access to the client machine's file system. Otherwise, there will be a
huge security hole.
Unless you are asking for something else. If you want the user to download a
graphic file, you can give an URL for it. Or you can use a CGI script to
read the graphic file on the server, and dump it in its binary form to the
output. In either case, the user will be prompted to save the file.
Mike Bickham <mbickham@photographics.co.uk> wrote in message
news:z9fY3.99$Sn.6068@newsr2.u-net.net...
> Is it possible to use a Perl-CGI script to create and open a file on a
> clients machine and place some binary data (in the form of a TIFF graphic
> file) into this file???
> If so, how would I do it?
------------------------------
Date: Tue, 16 Nov 1999 16:55:55 -0000
From: "Mike Bickham" <mbickham@photographics.co.uk>
Subject: Re: openin file on client machine
Message-Id: <RZfY3.101$Sn.7486@newsr2.u-net.net>
Thats exactly what I needed to know. Thanks for your help.
Regards,
Mike Bickham.
Jun Xu <jxu@wcom.net> wrote in message
news:80s0ub$msa$1@news.cis.ohio-state.edu...
> The simple answer is NO. CGI script runs on the server, and its output is
> directed to the client browser through the web server. CGI script does not
> have access to the client machine's file system. Otherwise, there will be
a
> huge security hole.
>
> Unless you are asking for something else. If you want the user to download
a
> graphic file, you can give an URL for it. Or you can use a CGI script to
> read the graphic file on the server, and dump it in its binary form to the
> output. In either case, the user will be prompted to save the file.
>
> Mike Bickham <mbickham@photographics.co.uk> wrote in message
> news:z9fY3.99$Sn.6068@newsr2.u-net.net...
> > Is it possible to use a Perl-CGI script to create and open a file on a
> > clients machine and place some binary data (in the form of a TIFF
graphic
> > file) into this file???
> > If so, how would I do it?
>
>
>
------------------------------
Date: Tue, 16 Nov 1999 16:56:33 -0000
From: "Mike Bickham" <mbickham@photographics.co.uk>
Subject: Re: openin file on client machine
Message-Id: <p_fY3.102$Sn.7625@newsr2.u-net.net>
why isnt it the right group then?
Mike.
Jonathan Stowe <gellyfish@gellyfish.com> wrote in message
news:38318068_1@newsread3.dircon.co.uk...
> Mike Bickham <mbickham@photographics.co.uk> wrote:
> > Hi All,
> >
> > I hope this is the right newsgroup for what I am about to ask.
>
> Lets see now ...
>
> > Is it possible to use a Perl-CGI script to create and open a file on a
> > clients machine and place some binary data (in the form of a TIFF
graphic
> > file) into this file???
> >
>
> Nope its not the right newsgroup.
>
> /J\
> --
> "Like Anne Robinson in a Korean restaurant, it'll be dog eat dog" -
> Graham Norton
------------------------------
Date: Tue, 16 Nov 1999 12:52:09 +0000
From: Alex Guilbert <arg@milvus.com>
Subject: Perl on AS/400
Message-Id: <38315379.A9F594DD@milvus.com>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I've downloaded the AS/400 Perl 5.003 software from CPAN and followed
<br>the instructions to install it on an AS/400 running V4R2M0. However,
<br>when I get to restoring items from the PERLPGM savf I get a CPF3743
<br>which is implying that the savf came from a later version of the OS.
<br>Does anyone know what versions of OS/400 Perl 5.003 was built for?
<p>TIA
<p>Alex Guilbert
<p> </html>
------------------------------
Date: Tue, 16 Nov 1999 15:01:50 +0100
From: Hans-Joachim Leidinger <jojo@buchonline.net>
Subject: Re: PerlShop, Minivend
Message-Id: <383163CE.D52D236B@buchonline.net>
Hi John,
without any experience with perl. I have started to build a online shop
last year. I have test PerlShop. But as a newbie! No success! I have
test minivend. As a newbie! Big success! You are able to use the special
minivend tag as a special html tag (if you know, how to write a html
file). After any experience with perl, you are able to do more with
minivend.
Sorry for my poor english!
Regards,
Joachim
John Considine schrieb:
>
> Has any one had experience using PerlShop, Minivend or anyother shopping
> cart. Which one do you find more useful? Which one is better for larger
> shopping carts? I am looking to use a shopping cart but want to invest
> my time in learning the one that will provide the most benefit.
>
> Thanks
--
Hans-Joachim Leidinger
buch online jojo@buchonline.net
Munscheidstr. 14 FAX: +49 209 1971449
45886 Gelsenkirchen
------------------------------
Date: Tue, 16 Nov 1999 15:40:45 GMT
From: emarkert@my-deja.com
Subject: Re: PerlShop, Minivend
Message-Id: <80rtts$3ff$1@nnrp1.deja.com>
Go with Minivend... It's complex but worth the effort to get up and
running and really not difficult.
I tried Perlshop and while it's ok I found it very limiting and kludgy.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 16 Nov 1999 11:07:25 -0500
From: "Dennis Kowalski" <dennis.kowalsk@daytonoh.ncr.com>
Subject: Problem with glob on NT host
Message-Id: <38317faf@rpc1285.daytonoh.ncr.com>
I have a script that does the following
@scripts = (<*.pl>);
There are some .pl files file names like this
AxxBxx.pl
Zxxwxx.pl
Notice that the A file has a capital B and the Z file has a lower case W.
The AxxBxx.pl file name comes into the array just as is shown.
The Zxxxx.pl file names shows up the the array as all capital letters ( i.e.
ZXXWXX.PL)
If i change the w to W in the file name, then the ZxxWxx.pl name comes into
the array just fine.
So the question is
Why does the glob convert a name to all upper case if the 1st letter is a
capital letter and none of the others are?
I am running ActiveWare build 315 on a NT 4.0 host
Thank You
------------------------------
Date: 16 Nov 1999 09:22:53 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Q: Dodgy use of undef on global variables?
Message-Id: <x73du6v7lu.fsf@home.sysarch.com>
>>>>> "IZ" == Ilya Zakharevich <ilya@math.ohio-state.edu> writes:
IW> The answer is yes (I've done it), but are there any nasty side-effects
IW> that I should be aware of?
>>
>> no you haven't. and you shouldn't use undef on aggregates. it has no
>> proper meaning for most programs.
IZ> What are you talking about? undef %hash is the *only* way to
IZ> completely reclaim storage associated to hash. (Maybe with an
IZ> exception of "shared" keys: I made patches, but never understood how
IZ> this actually works.)
ilya, try to read the original post sometimes. i was addressing what he
did which had nothing to do with reclaiming storage. also note i said
MOST programs. that leaves room for those few cases where reclaiming
storage is warranted.
IZ> Hope this helps,
not it didn't. he was trying to wipe out the data and recover it. he
didn't really want to undef the hash. assigning () was more
appopriate. he was also using defined on the aggregate which is wrong in
even more cases. he had no real reason to undef the ahs and use defined
on it.
it is like newbies using symrefs and eval. if they don't know why
not do do it they don't know enough when to do it.
we have to make these 3 (or more) things so evil for newbies so they
don't get into bad habits.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 16 Nov 1999 10:40:49 -0500
From: Steve Linberg <linberg@literacy.upenn.edu>
Subject: Re: Question... Carriage Returns in PERL
Message-Id: <m3ln7y8mwu.fsf@projdirc.literacy.upenn.edu>
Doug Fleming <nyc_investment_banker@yahoo.com> writes:
> If one hits the enter key, the tab key, or the space bar, my program
> recognizes that as a message, even though a tangible message is not
> really posted. I managed to get PERL to recognize a continuous string of
> spaces as something that does not constitute a message, but I have not
> been able to do so with a continuous string of enter keys, a continuous
> string of tab keys, or any combination of spaces, tabs, or enters.
All of those entites are whitespace and are matched by the \s operator
(newlines will be recognized with the /s modifier). So, to detect strings
containing only whitespace, you could do this (untested but pretty simple):
use strict;
use CGI;
my $q = new CGI;
my $message_text = $q->param('form_control_name'); # or whatever
$message_text =~ s/^\s+//gs; # strip leading whitespace including newlines
$message_text =~ s/\s+$//gs; # strip trailing whitespace including newlinea
complain_loudly('No text specified') unless $message_text;
__END__
Hope this helps. And btw, it's Perl, not PERL. :)
--
Steve Linberg, Chief Goblin
Silicon Goblin Technologies
http://silicongoblin.com
Be kind. Remember, everyone you meet is fighting a hard battle.
------------------------------
Date: Tue, 16 Nov 1999 08:35:44 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Question... Carriage Returns in PERL
Message-Id: <MPG.129b27ba171d14aa98a212@nntp.hpl.hp.com>
In article <m3ln7y8mwu.fsf@projdirc.literacy.upenn.edu> on 16 Nov 1999
10:40:49 -0500, Steve Linberg <linberg@literacy.upenn.edu> says...
...
> All of those entites are whitespace and are matched by the \s operator
> (newlines will be recognized with the /s modifier). So, to detect strings
> containing only whitespace, you could do this (untested but pretty simple):
...
> $message_text =~ s/^\s+//gs; # strip leading whitespace including newlines
> $message_text =~ s/\s+$//gs; # strip trailing whitespace including newlinea
The /s modifier has nothing to do with the '\s' pattern, which always
includes newlines. The /s modifier affects *only* whether the '.'
pattern matches newlines.
So the /s modifier in those statements is meaningless, as is the /g
modifier, for those patterns don't contain '.' and can match at most
once each.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 16 Nov 1999 12:02:39 -0500
From: Steve Linberg <linberg@literacy.upenn.edu>
Subject: Re: Question... Carriage Returns in PERL
Message-Id: <m3iu328j4g.fsf@projdirc.literacy.upenn.edu>
Larry Rosler <lr@hpl.hp.com> writes:
> The /s modifier has nothing to do with the '\s' pattern, which always
> includes newlines. The /s modifier affects *only* whether the '.'
> pattern matches newlines.
>
> So the /s modifier in those statements is meaningless, as is the /g
> modifier, for those patterns don't contain '.' and can match at most
> once each.
Eeek! Thanks for the correction, Larry. Jeez, I need a brain implant for
that one. That fact just won't stick for me.
--
Steve Linberg, Chief Goblin
Silicon Goblin Technologies
http://silicongoblin.com
Be kind. Remember, everyone you meet is fighting a hard battle.
------------------------------
Date: Tue, 16 Nov 1999 16:23:38 -0000
From: "Nigell Boulton" <nigell.boulton@rade.net>
Subject: reading html files
Message-Id: <38317a1a.0@news.netdirect.net.uk>
I am developing a system to read HTML files from a news feed web site and
place it code within my template.
How can I read a html file as code and import it into my code?
regards
Nigell
------------------------------
Date: Tue, 16 Nov 1999 08:56:09 -0800
From: mbudash@wcws.com (Michael Budash)
Subject: Re: reading html files
Message-Id: <mbudash-1611990856090001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>
In article <38317a1a.0@news.netdirect.net.uk>, "Nigell Boulton"
<nigell.boulton@rade.net> wrote:
> I am developing a system to read HTML files from a news feed web site and
> place it code within my template.
>
> How can I read a html file as code and import it into my code?
>
> regards
> Nigell
IIUYQ, try LWP (available at CPAN)
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@wcws.com
------------------------------
Date: Tue, 16 Nov 1999 08:58:42 -0600
From: Tom Briles <sariq@texas.net>
Subject: Re: Slurping output form system(runme.exe)
Message-Id: <38317122.8E6C0312@texas.net>
"Steven T. Hatton" posted in Jeopardy style, which is just plain wrong:
>
> Tom Briles wrote:
>
> > "Steven T. Hatton" wrote:
> > >
> > > We have been trying to figure out it there is a way to run a command
> > > line executable in NT and slurp the output back into a perl variable.
> >
> > From perldoc -f system:
> >
> > "This is NOT what you want to use to capture the output from a command,
> > for that you should use merely..."
> >
> > Oh darn, the rest scrolled by too quickly to read. You'll have to read
> > it yourself, I guess.
> >
> > - Tom
> Tom,
>
> That works for half the problem. I still can't figure out how to stream
> the contents of $variable to the invoked system process. This is what I
> have:
>
> $result=`commandname.exe`;
>
> I still need to send the contents of $variable to the command.
Ummm...I surely must be misunderstanding your question.
After all, as stated clearly in perlop, `` (qx) interpolates.
$result=`commandname.exe $variable`;
You did try that, didn't you?
- Tom
------------------------------
Date: Tue, 16 Nov 1999 10:32:24 -0500
From: "Steven T. Hatton" <hattons@cpkwebser5.ncr.disa.mil>
Subject: Re: Slurping output form system(runme.exe)
Message-Id: <38317908.991D5246@cpkwebser5.ncr.disa.mil>
Tom,
Yes I did that. $result=`commandname.exe $variable`; uses $variable for the
arguments, but will not stream the data into the process. If I dump the
contents of $variable to a file called dump.txt and then do this:
commandname.exe -a this -b that <dump.txt
I get what I want except I don't want to create the temp file. If I set
$variable="-a this -b that" I can pass the command line arguments as
$variable. This does not stream the data into the process as does the
<dump.txt. Got any ideas.
Thanks again,
Sterve
Tom Briles wrote:
> "Steven T. Hatton" posted in Jeopardy style, which is just plain wrong:
> >
> > Tom Briles wrote:
> >
> > > "Steven T. Hatton" wrote:
> > > >
> > > > We have been trying to figure out it there is a way to run a command
> > > > line executable in NT and slurp the output back into a perl variable.
> > >
> > > From perldoc -f system:
> > >
> > > "This is NOT what you want to use to capture the output from a command,
> > > for that you should use merely..."
> > >
> > > Oh darn, the rest scrolled by too quickly to read. You'll have to read
> > > it yourself, I guess.
> > >
> > > - Tom
> > Tom,
> >
> > That works for half the problem. I still can't figure out how to stream
> > the contents of $variable to the invoked system process. This is what I
> > have:
> >
> > $result=`commandname.exe`;
> >
> > I still need to send the contents of $variable to the command.
>
> Ummm...I surely must be misunderstanding your question.
>
> After all, as stated clearly in perlop, `` (qx) interpolates.
>
> $result=`commandname.exe $variable`;
>
> You did try that, didn't you?
>
> - Tom
------------------------------
Date: 16 Nov 1999 16:57:52 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Sys::Syslog setlogsock
Message-Id: <80s2eg$mfe$1@pegasus.csx.cam.ac.uk>
James Vahn <jvahn@short.circuit.com> wrote:
>The old method was use Sys::Syslog;
>
>The new method is use Sys::Syslog qw(:DEFAULT setlogsock);
> setlogsock 'unix';
>
>How do we program perl to accomodate whichever method is
>appropriate for whatever version?
>
>Specifically, I need to run the same script on perl versions
>5.003_07 and 5.004_05.
^^^^^^^^
That's a *very* ancient version, with CERT advisories against it.
You'd be better off upgrading.
But, to answer your question: the general technique is to test
the $] variable. See perldoc perlvar.
Of course, you'll need to take appropriate precautions because "use"
happen at compile time - something like
BEGIN {
require Sys::Syslog;
if ($] >= 5.004) {
Sys::Syslog->import( qw(:DEFAULT setlogsock) );
Sys::Syslog::setlogsock('unix');
} else {
Sys::Syslog->import;
}
};
Actually, in this particular case, all you want to do is call setlogsock()
if available, so the simpler
use Sys::Syslog;
Sys::Syslog::setlogsock('unix') if defined &Sys::Syslog::setlogsock;
should do the trick.
Mike Guy
------------------------------
Date: Tue, 16 Nov 1999 10:21:23 -0500
From: "Jodi Kerper" <jkerper@edgil.com>
Subject: system() on Win 32 doesn't seem to do anything
Message-Id: <3JeY3.118076$Ow5.196348@dfw-read.news.verio.net>
I have a script which calls an external command. When I pass the command
line to the system, using system($cmd), nothing occurs. The script runs
successfully (executes the external command) if I run in on Windows NT 4.0
Workstation, but only echoes if I run it on Windows NT 4.0 Server. We're
using Active Perl 509.
The script fragment looks something like this:
----------------------------------------------------------------------------
-----------
$cmd = 'dbbackup -c "dsn='.$file.';uid=DBA;pwd='.$pwd.'" ' ;
$cmd = $cmd.'-y -x -o'.$dev.'\\backup\\'.$day.'.txt ' ;
$cmd = $cmd.$dev.'\\backup' ;
print $cmd, "\n" ;
system($cmd) ;
----------------------------------------------------------------------------
-------------
I only see the command I've built up ($cmd) printed out to the console.
dbbackup doesn't execute.
Does anyone know of a problem with the system() implementation, and a
solution or workaround?
Jodi Kerper
jkerper@edgil.com
------------------------------
Date: 16 Nov 1999 15:32:09 GMT
From: nproj-2@mdstud.chalmers.se (Lab. - konto &)
Subject: Thanks for nothing
Message-Id: <80rtdp$sq9$1@nyheter.chalmers.se>
Maybe your'e a great programmer and so on mr Rhomberg, but your social
competence seems to be quite low. Please don't bother to answer my
question if you don't know it!
I don't need any smartass comments.
/Joakim
------------------------------
Date: 16 Nov 1999 15:43:18 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Thanks for nothing
Message-Id: <38317b96_1@newsread3.dircon.co.uk>
Lab. - konto & <nproj-2@mdstud.chalmers.se> wrote:
<I have added back the quoted material>
> Alex Rhomberg <rhomberg@ife.ee.ethz.ch> wrote:
> > Lab. - konto & wrote:
> >>
> >> Hi,
> >> I have a problem with generating random numbers.
> >> I'm using srand and rand but it doesn't work.
> >> Any code-examples how to solver this are welcome!
> >
> > Wow, it doesn't work. How useful.
> >
> > prompt> perl -le 'print rand'
> > Doesn't work
> > prompt>
>
> Maybe your'e a great programmer and so on mr Rhomberg, but your social
> competence seems to be quite low. Please don't bother to answer my
> question if you don't know it!
>
Lets put this another way - please dont bother to ask any questions
here if you are incapable of providing us with the slightest bit of
information that might assist us in helping you. Saying 'it doesnt
work' is really not a great deal of help here - in what way doesnt it
work : does smoke and flame start belching from the back of your computer
does it sit around on teh sofa eating pizza and drinkuing beer all day
does it wipe all of the other programs out on your computer *what* does
it do whilst its not working and where is the example code ...
> I don't need any smartass comments.
>
Then you abviously dont want any answers here then ...
*plonk*
/J\
--
"I thought homogenous culture was a kind of yogurt used to alleviate
thrush" - Ben Elton
------------------------------
Date: Tue, 16 Nov 1999 17:09:29 +0100
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Thanks for nothing
Message-Id: <383181B9.957557B6@ife.ee.ethz.ch>
Lab. - konto & wrote:
>
> Maybe your'e a great programmer and so on mr Rhomberg, but your social
> competence seems to be quite low. Please don't bother to answer my
> question if you don't know it!
Looking back at your original post, I do not see a question. However, I
do see a code example using rand in my response.
And I do see great social competence in your answer
- Alex
------------------------------
Date: 16 Nov 1999 09:25:27 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Too much Perl?
Message-Id: <x7yabytsx4.fsf@home.sysarch.com>
>>>>> "h" == hoz <hoz@rocketmail.com> writes:
>> There's the perl-jobs
>> mailing list, which has lots of Silicon Valley and NYC positions.
h> What is the address for this list? how do I subscribe?
find them at www.pm.org.
uri (perl jobs lists owner)
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Tue, 16 Nov 1999 08:21:08 -0600
From: Tom Briles <sariq@texas.net>
Subject: Re: Trying to use a variable as an operator
Message-Id: <38316854.721DD746@texas.net>
Scott Lanning wrote:
>
> Tom Briles <sariq@texas.net> writes:
> > eval STRING is evil... eval STRING is evil...
>
> bah.. Like any judgement of good/evil, it depends on context.
> If eval() were evil in and of itself, then why did Larry Wall
> put it in Perl? Surely you're not claiming Larry was evil. :)
No. Larry, like the gods, created both good and evil. Larry, I
believe, is Pure Neutral. Did someone recently mention Perl druids
recently?
Please note the word 'STRING' in my mantra. eval BLOCK I have no
problem with, and use it often - but probably not often enough,
considering all the times I find myself going back and adding additional
exception handling to old, worn out code. ;)
- Tom
------------------------------
Date: Tue, 16 Nov 1999 16:57:25 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Trying to use a variable as an operator
Message-Id: <V1gY3.18604$YI2.798318@typ11.nn.bcandid.com>
In article <slrn831rdu.cvu.abigail@alexandra.delanet.com>,
Abigail <abigail@delanet.com> wrote:
>eval is good. It allows us the calculate the average of an array of
>numbers easily.
>
> $avg = do {local $" = "+"; eval ("@array") / @array};
I always thought it was a shame Perl didn't have anything like APL's
"reduce" operator -- +/, x/, etc. Now I know the shocking truth.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Tue, 16 Nov 1999 16:12:16 +0100
From: =?iso-8859-1?Q?H=E5kan?= Jonsson <hakjo733@student.liu.se>
Subject: unbuffered input
Message-Id: <38317450.6CB19F94@student.liu.se>
Hi,
I am trying to make a loop, which is automatically exited if the user
presses any key on the keyboard. Meanwhile, the loop is suppoused to be
running. Therefore, the input must be unbuffered, and the program must
proceed without waiting for any input.
How can this be done in Perl?
/H=E5kan Jonsson
hakjo733@student.liu.se
------------------------------
Date: 16 Nov 1999 17:04:02 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: unbuffered input
Message-Id: <80s2q2$ms4$1@pegasus.csx.cam.ac.uk>
=?iso-8859-1?Q?H=E5kan?= Jonsson <hakjo733@student.liu.se> wrote:
>Hi,
>
>I am trying to make a loop, which is automatically exited if the user
>presses any key on the keyboard. Meanwhile, the loop is suppoused to be
>running. Therefore, the input must be unbuffered, and the program must
>proceed without waiting for any input.
perlfaq5: How can I read a single character from a file? From the keyboard?
Mike Guy
------------------------------
Date: Tue, 16 Nov 1999 09:20:31 -0500
From: "Steven T. Hatton" <hattons@cpkwebser5.ncr.disa.mil>
Subject: Using Open2() Win32 NT ?
Message-Id: <3831682F.891EDEA@cpkwebser5.ncr.disa.mil>
I am trying to call a command line program, stream data to it, and read
data from it. I have been trying to do this with open2() , but it
seems like my code keeps going to sleep. The conceptual model that
I want is:
Get $variable
Stream $Variable into | commandLine.exe | read $results from pipe.
I can't seem to find example code that does this. Does anybody have any
ideas? Another twist is that $Variable is a multi line objec and
commandLine.exe needs the entire stream at onece. I.e., I can dump
$Variable to a file and redirect the file into commandLine.exe with the
correct multi line results.
Thanks,
Steve
------------------------------
Date: 16 Nov 1999 09:13:48 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Where can i find more information on Schwartzian transform!
Message-Id: <x766z2v80z.fsf@home.sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
>> larry: (i know you will read this) should our article/sort pages link to
>> tom's article and other pages?
LR> How did you know? :-)
i used the PSI::Rosler module.
LR> The HTML version includes the following references and hyperlinks:
LR> 9. How do I sort an array by (anything)?,
LR> 10. Christiansen, T. & Torkington, N. (1998). The Perl Cookbook, Recipe
LR> 4.15: "Sorting a List by Computable Field". O´Reilly.
LR> 11. Christiansen, T., Far More Than Everything You´ve Ever Wanted to
LR> Know About Sorting, http://www.perl.com/CPAN/doc/FMTEYEWTK/sort.html
but it had a bug and i should have known/remembered we had those
links. hell, i could have checked myself. fix the module!
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 16 Nov 1999 13:03:19 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Why isn't the HTML::Parser an HTML::Parser?
Message-Id: <80rkmn$5es$1@nntp9.atl.mindspring.net>
Alexander Lazic (A.Lazic@Austria.EU.net) wrote:
: in some article i have read that, but i don't anderstand it because i
: use it and i haven't any problems.
A true HTML parser needs to cope with various SGML constructs (e.g.
entity definitions, marked sections) that can in principle occur in any
SGML application. These constructs are in fact seldom found in HTML
documents because most user agents can't process them either, so *that*
shortcoming is seldom a problem.
A more serious problem is that a true HTML parser should give identical
results for a document that uses tag omission, abbrieviated attributes,
etc. and one that doesn't. For example, a true parser would return the
same information for the following fragments:
1)
<p>This is the first paragraph.
<p>This is the second paragraph.
2)
<p>This is the first paragraph.</p>
<p>This is the second paragraph.</p>
But HTML::Parser will not generate an end-element event unless the
element has an explicit end-tag. This means that you need to use
application logic to figure out where certain elements end, and if you
get it wrong, your application will stumble over perfectly legal constructs.
A true HTML parser uses an HTML DTD to guide its parsing. HTML::Parser
is really only a tokenizer. For many applications that's all you really
need, but the name *is* misleading.
------------------------------
Date: Tue, 16 Nov 1999 07:12:27 -0800
From: avivA Starkman <aviva.starkman@exchange.sp.trw.com>
Subject: Re: Why perl won't print to STDOUT?
Message-Id: <3831745B.A1DAF7A@exchange.sp.trw.com>
To everybody: the $| variable fixed my problem. Thanks! (BTW, I knew
it was a buffering problem, but didn't bother mentioning that in my
original post for brevity.)
To David Cassell:
> On another note, why oh why are you calling a Perl program
> from a csh script from another csh script? Is this some
> dinosaur you're not allowed to replace with a better-evolved
> genus? Surely this would be a lot more straighforward if
> written entirely in Perl...
No kidding! But I have to work with the stuff that's already in place
here: a hodge-podge of (primarily) csh and awk. If it was up to me I
would for sure stick to perl.
--
__ __ _ __ \ | Aviva Starkman (or spelled backwards, avivA)
| | | | |\| Georgia Tech, B. CmpE '96!
| | __|_ __|_ | \ avivas@emu.sp.trw.com.NOSPAM
------------------------------
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 1395
**************************************