[9833] in Perl-Users-Digest
Perl-Users Digest, Issue: 3426 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 12 11:07:41 1998
Date: Wed, 12 Aug 98 08:00:31 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 12 Aug 1998 Volume: 8 Number: 3426
Today's topics:
Re: Automated script execution (Dermot McKay)
Re: Execute a program then return to perl? <adam@fastfare.co.uk>
Re: Execute a program then return to perl? <jdw@dev.tivoli.com>
Re: floating point number precision? (Dermot McKay)
formmail.cgi... any cgi <mmacdonald@del.net>
HELP !!! Date without century !!! <laurent@gide.isdnet.net>
Re: HELP !!! Date without century !!! (Matthew Bafford)
Re: Help with script (If/Elsif/else) (Bart Lateur)
Line continue character (Mark Conlin)
Re: Line continue character (Mark-Jason Dominus)
Re: Line continue character <tchrist@mox.perl.com>
Re: line of text. <murrayb@vansel.alcatel.com>
Re: Mailing List scrip . Help needed <burt@netonecom.net>
Re: matching problem with (xx)? <jdw@dev.tivoli.com>
Re: method=GET without CGI.pm ?? (Mike)
Need registry extraction <richardr@airmail.net>
Re: Need to Lock files (NFS) sgr@logsoft.com
Re: Newbie pattern match question huntersean@hotmail.com
Re: Newbie Question About 'for' <jdw@dev.tivoli.com>
Re: Newbie Question About 'for' <jdw@dev.tivoli.com>
Perl 5.005.1 core dumps under Irix 6.2 <net@informatik.uni-bremen.de>
problem loading html page via perl location command (Joshua Weinberg)
Q: open2 : whats wrong? (Andre Merzky)
Q: Problems with <system> command (Matthias Kranz)
Question, Net::Ping for Win32 <andrews.76@osu.edu>
Referancing and dereferancing <dougp@global.net.au>
Re: Referancing and dereferancing (Mike Stok)
Re: system() problem (Andrew M. Langmead)
The Perl Institute's Daily News (Chris Nandor)
Re: Where can I find the binary for perl at least 5.002 <aja@DevDaily.com>
Re: X-file (?=...), case postponed. (Ilya Zakharevich)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 12 Aug 1998 13:45:52 GMT
From: MCKAYD@aplbt1.agw.bt.co.uk (Dermot McKay)
Subject: Re: Automated script execution
Message-Id: <6qs6lv$9do$1@pheidippides.axion.bt.co.uk>
In article <zLcA1.1998$KR.134783@news-reader.bt.net>, "Lee Davies"
<lee.davies@NOSPAMsaaconsultants.com> wrote:
>I have a HTML page which needs to collect some server information (hostname
>etc.) and display it in the page text.
>
Is your HTML page a perl script? Do you type
http:/your.server.name/cgi-bin/host.pl to access it
if not you could do your page like this just let perl create a webpage output
around the info your collecting
>I have a CGI script which collects this information and echoes it to stdout
>and need to run this script automatically from the HTML.
>
If you wish then you can add something like
#!/usr/bin/perl
$time=`date`;
$hostname=`hostname`;
print "Content-type: text/html \n\n<HTML><HEAD><\!\-\-This forces pages to
time out \- so directories cached on the client aren\'t reused \-\->
<META HTTP\-EQUIV=\"Refresh\" CONTENT=600>
<META HTTP\-EQUIV=\"Expires\" CONTENT=\"Mon, 04 Mar 1996 00:00:00
GMT\">\n<TITLE>Host info</TITLE>\n</HEAD>\n<BODY TEXT=\"\#000000\"
BGCOLOR=\"\#FFFFFF\" LINK=\"\#0000EE\" VLINK=\"\#551A8B\"
ALINK=\"\#FF0000\">\n";
print "<center><H1><U>Host information for ${hostname}</U></H1></P><H2>at
${time}</H2></center>";
>I can do this via a server-side include, but this requires a rename to
>index.shtml and a dummy index.html to act as a redirector. Is there a way
>of achieving this without resorting to server-side includes?
>
>
This then would run every 15 minutes the
http://your.server.name/cgi-bin/host.pl was on screen
oh by the way the $date=`date`; and $hostname=`hostname`; are for UNIX only.
OK Dermot
------------------------------
Date: Wed, 12 Aug 1998 13:03:45 +0000
From: Adam Ipnarski <adam@fastfare.co.uk>
To: Clas <qmwclka@emw.ericsson.se>
Subject: Re: Execute a program then return to perl?
Message-Id: <35D192B1.AD7231BB@fastfare.co.uk>
Clas wrote:
>
> Hello!
>
> I don't know how to execute a program then return back to perl.
>
> I use the exec method, but this doesn't seem to be right .
> Because after the exec command I come right to the shell... :-(
>
> Any smart idea how I should do to solve this problem??
>
> Thank you for any suggestion!
>
> //Clas
!!!!! READ THE FAQs !!!!!!! (or the man pages)
use 'system()' to return execution, or $response = qx!..command...!;
--adam
Adam Ipnarski
Senior Programmer, Faresearch
adam@fastfare.co.uk | www.travelselect.com
------------------------------
Date: 12 Aug 1998 07:43:11 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: Execute a program then return to perl?
Message-Id: <obsoj2s74w.fsf@alder.dev.tivoli.com>
Clas <qmwclka@emw.ericsson.se> writes:
> I don't know how to execute a program then return back to perl.
>
> I use the exec method, but this doesn't seem to be right .
> Because after the exec command I come right to the shell... :-(
>
> Any smart idea how I should do to solve this problem??
perldoc -f exec will tell you, or if you don't like the markup
characters
man perlfunc
and check out the entry for exec
--
Jim Woodgate
Tivoli Systems
E-Mail: jdw@dev.tivoli.com
------------------------------
Date: Wed, 12 Aug 1998 13:55:19 GMT
From: MCKAYD@aplbt1.agw.bt.co.uk (Dermot McKay)
Subject: Re: floating point number precision?
Message-Id: <6qs77l$9g6$1@pheidippides.axion.bt.co.uk>
In article <6qrqsm$kpe$1@netnews.csie.NCTU.edu.tw>, dennis@info4.csie.nctu.edu.tw (GEMINI) wrote:
>hi all,
> I need to do calculation using floating point number in my perl
>program. Execept for Math::BigFloat module,
>do I have any option to decide the precision of the floating point number?
>such as the float or double for C, or the
>REAL*4, REAL*8, and REAL*16 for fortran?
>
>thanks.
printf "%.3f added to %.3f equals %.3f\n", $num1, $num2, ($num1+$num2);
you can use this type of format.
Dermot
------------------------------
Date: 12 Aug 1998 14:52:48 GMT
From: "Marjorie MacDonald" <mmacdonald@del.net>
Subject: formmail.cgi... any cgi
Message-Id: <01bdc601$624507c0$0e01a8c0@op.net>
I hope you all can help me out.
The service we use to host our web site has set me up a CGI directory.
First of all, it is NOT under my normal HTML directory, it's at a
completely different URL. Is this normal? Does this cause problems?
Secondly, everything (and I do mean EVERYTHING) I try to call from an HTML
document gives me a 403 Forbidden error. Doesn't matter what it is or where
it's from (last one I tried was the FormMail script from Matt's Script
Archive). I finally did get the path to the Perl interpreter from them, so
I can set that correctly now. I just want to get any error other than the
403 Forbidden one, so that I know the script is being accessed.
Is this a problem on their end? Do they have the permissions set wrong on
the server? (They swear they don't, but I don't really believe them) Do I
have to add something to the script? (I've asked that a zillion times, they
say I don't...)
Anything you can tell me would be helpful. If it's really UNIX related,
I'll probably just send it on to them, maybe they'll learn something (I
sincerely hope so!)
Thanks again
Marge MacDonald
Dover, DE
------------------------------
Date: Wed, 12 Aug 1998 15:19:24 +0200
From: Laurent MARTIN <laurent@gide.isdnet.net>
Subject: HELP !!! Date without century !!!
Message-Id: <35D1965C.FE0F0C99@gide.isdnet.net>
Hi !
I'm working with Perl for a few days and I've got a trouble with dates :
localtime(time) doesn't return any century indication. How can I get
dates on 4 digits instead of 2 digits ?
I'm sure you know the answer, so please mail it to me
(laurent@gide.isdnet.net) 'cause I'm not coming there very often. Thank
you !!!
------------------------------
Date: Wed, 12 Aug 1998 14:10:47 GMT
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: HELP !!! Date without century !!!
Message-Id: <MPG.103b63f118cfe27c989696@news.scescape.net>
In article <35D1965C.FE0F0C99@gide.isdnet.net> on Wed, 12 Aug
1998 15:19:24 +0200, Laurent MARTIN (a) decided to beg to clpm.
>
> I'm working with Perl for a few days and I've got a trouble with dates :
> localtime(time) doesn't return any century indication. How can I get
> dates on 4 digits instead of 2 digits ?
How did you find out about localtime without seeing something
similar to the following: (from perldoc -f localtime)
...Also, $year is the number of years since 1900,
that is, $year is 123 in year 2023....
--Matthew
------------------------------
Date: Wed, 12 Aug 1998 14:45:06 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Help with script (If/Elsif/else)
Message-Id: <35d5aa51.27001624@news.tornado.be>
cka@jawa.org wrote:
>When I run with perl, I receive an error that states:
>syntax error at test.cgi line 6 near "}"
>Execution of test.cgi aborted due to compilation errors.
Perl is case-sensitive. So: ELSIF is a different word from elsif.
HTH,
Bart.
------------------------------
Date: 12 Aug 1998 13:25:20 GMT
From: gt2863a@acmey.gatech.edu (Mark Conlin)
Subject: Line continue character
Message-Id: <6qs540$g73@catapult.gatech.edu>
is there a line continue character in perl, so that I can have multiple
lines that the interpreter will see as one.
blah blah (magic character here)
blah blah blah ;
Thanks!
--
mec --gt2863a
------------------------------
Date: 12 Aug 1998 10:23:17 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Line continue character
Message-Id: <6qs8gl$66h$1@monet.op.net>
In article <6qs540$g73@catapult.gatech.edu>,
Mark Conlin <gt2863a@acmey.gatech.edu> wrote:
>is there a line continue character in perl, so that I can have multiple
>lines that the interpreter will see as one.
Yeah. It's the semicolon. (;)
The difference is, whereas in most languages you have to put the line
continuation character in to get it to continue the line, in Perl you
have to *leave it out*.
For example:
$x = 3 +
2;
Note: Line continuation character omitted at end of first line
===> line continues on second line.
------------------------------
Date: 12 Aug 1998 14:52:25 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Line continue character
Message-Id: <6qsa79$lp5$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
mjd@op.net (Mark-Jason Dominus) writes:
:The difference is, whereas in most languages you have to put the line
:continuation character in to get it to continue the line, in Perl you
:have to *leave it out*.
``Most languages''? Perl, awk, C, C++, java, Pascal, Modula, ...
--tom
--
With a PC, I always felt limited by the software available. On Unix, I am
limited by my knowledge. --Peter J. Schoenster <pschon@baste.magibox.net>
------------------------------
Date: 11 Aug 1998 14:46:40 -0700
From: Brad Murray <murrayb@vansel.alcatel.com>
Subject: Re: line of text.
Message-Id: <u3eb342f3.fsf@vansel.alcatel.com>
Peter Richmond <peter@richmd.demon.co.uk> writes:
> $line = a line out of a text file.
>
> Does $line include the \n or not?
Probably. It depends on how you got it. chomp() it anyways. Read
your FAQ and manuals.
--
Brad Murray "It may be that your sole purpose in life is
Software Analyst simply to serve as a warning to others."
Alcatel Canada --Anonymous
------------------------------
Date: Wed, 12 Aug 1998 10:20:54 -0400
From: Burt Adsit <burt@netonecom.net>
Subject: Re: Mailing List scrip . Help needed
Message-Id: <35D1A4C6.3BF9EB7A@netonecom.net>
Hi,
What you are talking about is a moderated, *digested* mailing list. It's
a function of the list, not perl.
Burt
frederic wrote:
>
> Hi,
>
> Could you recommend me a good mailing list script for :
> - a moderated list
> - that makes possible for the administrator to group sevral messages
> posted in only one message that will be dispatched to the members of the
> list.
>
> Thanks for help
>
> Frederic
> mailto:fjouanneau@tenderonline.com
>
> ------------------------------------------------------------------------
>
> Fridiric Jouanneau <fredjoua@club-internet.fr>
>
> Fridiric Jouanneau
> <fredjoua@club-internet.fr>
> Netscape Conference Address
> Netscape Conference DLS Server
> Additional Information:
> Last Name Jouanneau
> First Name Fridiric
> Version 2.1
------------------------------
Date: 12 Aug 1998 08:16:20 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: matching problem with (xx)?
Message-Id: <obr9yms5ln.fsf@alder.dev.tivoli.com>
oc1658@my-dejanews.com writes:
> Suppose i need to match a substring which *could* be preceded by 'is'.
> I'm trying:
> m/(.+)(is)?(.*)
>
> Now i always obtain 'The cats are over the table' in $1.
>
> I can't understand why (is)? doesn't match according to the 'greedy' perl
> regexp default. I suspect it's something related to the first item (.+) but i
> didn't find any solution out there.
The (.+) is greedy and get's the entire line because (is)? matches
both when is is there and when is isn't there, so it's using the "it's
not there case" and returns the entire line.
you could do the following, note the \bis\b to avoid:
The cat missed the table
The cat m
if ( /(.+)\bis\b/ ) {
print $1;
}
else {
print $_;
}
--
Jim Woodgate
Tivoli Systems
E-Mail: jdw@dev.tivoli.com
------------------------------
Date: 12 Aug 1998 13:33:21 GMT
From: schutzmd@SPAMFREEjmu.edu (Mike)
Subject: Re: method=GET without CGI.pm ??
Message-Id: <6qs5j1$ln8$2@lark.jmu.edu>
brian d foy (comdog@computerdog.com) wrote:
> if you have a recent version of Perl, you have CGI.pm. the server
> does not need to be configured to allow you to use it.
I don't know why I didn't look earlier, but it is an earlier release of
Perl on the server. Uploading my own copy of CGI.pm to my cgi directory
solved the problem.
- mike -
------------------------------
Date: Wed, 12 Aug 1998 09:46:17 -0700
From: "RickR" <richardr@airmail.net>
Subject: Need registry extraction
Message-Id: <35d1aa3e.0@news1.ibm.net>
I need to run a NT resource kit utility which queries the registry, then
somehow apply that value to an environment variable.
The NT resource kit utility is reg.exe, and is used with a "query" argument.
Thus I need:
reg query System\CurrentControlSet\Services\Adapters
which returns:
Local Network Adapters [Elnk31]
I need to then set "Elnk31" as an environment variable.
Can I use the system command to run reg query? What should I use to filter
out the returned value?
Thanks.
------------------------------
Date: Wed, 12 Aug 1998 13:00:10 GMT
From: sgr@logsoft.com
Subject: Re: Need to Lock files (NFS)
Message-Id: <6qs3kr$fr2$1@nnrp1.dejanews.com>
Cripes! Won't this thread ever die?
NFS *does* support the normal Unix file creation semantics (at least, the
versions of NFS that I've used.) So, if you open a file like:
use POSIX qw/open/;
$lockfd = POSIX::open('foo.lock', &POSIX::O_CREAT | &POSIX::O_EXCL);
if ($lockfd) {
# critical region...
} else {
print "Couldn't grab lock...";
}
close($fd);
unlink('foo.lock');
you'll be guaranteed to have an exclusive lock.
You still have the problem of the lock hanging around if your process exits,
but I've used this idea in the past. By wrapping the lock in an object
with a destructor that removes the lock file, and adding a lock timeout
based on the ctime of the lock file, this approach works well.
There may be an extra flag to the open, but you can look that up, I don't
have my manuals handy at the moment.
And for the definitive discussion of this, check out W. Richard Steven's
"Unix Network Programming" (although the examples here are in C, the principle
is the same.)
In article <6qr9ng$hnf$3@news.campus.mci.net>,
kherron@campus.mci.net (Kenneth Herron) wrote:
> In article <35D04830.FAE00EC1@betalasermike.com>,
> Michael A. Jones <jonesma@betalasermike.com> wrote:
> |My
> |program watches for the creation of such files, waits until it's closed
> |and then does stuff to it. I would like to prevent anyone from opening
> |it during my (short) processing just in case. I think that means locking
> |it.
>
> That said, as others have mentioned, reliable locking over NFS is a
> problem. You have a couple of more fundamental problems though.
>
> a) Unix (I assume you're using unix?) doesn't give arbitrary
> processes a way to tell if a file is open or not. There
> are ways to work around this, and maybe you've developed a
> method, but it's not clear from your post so I thought
> I'd mention it.
>
> b) More importantly, unix file locks are advisory only. Other
> process can check for a lock and voluntarily refrain from
> accessing the file if it's coded to do so, but you can't
> force the issue via file locks. This is true of all the
> file systems commonly used on unix.
>
> Let me suggest you see if the people in comp.unix.programmer can't
> be more help. This isn't really a perl question anyway.
>>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Wed, 12 Aug 1998 14:41:13 GMT
From: huntersean@hotmail.com
Subject: Re: Newbie pattern match question
Message-Id: <6qs9i9$4oq$1@nnrp1.dejanews.com>
In article <ianExJJF6.H8t@netcom.com>,
ian@netcom.com wrote:
> Gentle-people,
>
> I'm having a problem understanding a simple RE in the following
> script. I can workaround, but I'd really like to know what
> I'm missing. If anyone has a few minutes to aid my perl
> skills, my gratitude shall overfloweth.
>
> What I'm trying to do is grab the facility being logged
> from syslog and summarize. 1st attempt:
>
> while ($line=<SYSLOG>) {
> # Split the line into chunks based on spaces
> ($a,$b,$c,$d,$_)=split " ",$line;
> # Grab the facility
> /(.*)\[?.*\]?:/;
> $list{$1}.=$line;
> $count{$1}+=1;
> }
>
> Aug 9 23:59:00 embarcadero syslogd: restart
> $1=syslogd
> Aug 9 23:59:00 embarcadero sendmail[52795]: AA52795: message-id ...
> $1=sendmail[52795]
>
> the (.*) is too greedy - I want to discard the [52795] part.
> however, changing the RE to /(.*)?\[?.*\]?:/ makes no diff and
> /(.*?)\[?.*\]?:/ gives
>
> Aug 9 23:59:00 embarcadero syslogd: restart
> $1=
> Aug 9 23:59:00 embarcadero sendmail[52795]: AA52795: message-id= ...
> $1=
>
> I have the feeling that whatever I'm missing is something basic...
>
> any clues, pointers to faq's (already consulted perlre, but
> obviously don't understand it :-( ) very welcome.
>
> thanks,
> ian
>
> ---
> (The following is ugly, but has the benefit of working...
[..snippage..]
Your problem is that you need non-greedy matching. I think that's what you
thought you were doing, but you've got your "?" in the wrong place. You need
/(.*?)(?:\[.*\])?:/
Notice I made a small change to the second half too. This half (starting
with "(?:" just means "match one or none of the whole "[...]" bit, and chuck
away the results". My whole regexp means something like "Match as much as
you can, and keep it, followed by one or none of these things that look like
a load of stuff in square brackets, followed by a colon. I'm not interested
in what's in them, only that if they're there, don't mix them in with the
stuff I want to keep." Yours means "match zero or more chars which may occur
zero or one times (keep these), followed by one or zero square brackets
followed by zero or more chars, followed by zero or more chars, followed by
zero or one square brakets followed by a colon". Because you put the "?"
outside the brackets it doesn't mean a non-greedy match, but means "match
zero or one of these", so perl just grabs the whole string up to the colon.
It can do this, because the square brackets bit is optional.
I hope this makes things a bit clearer.
Keep on regexping!
Sean H
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 11 Aug 1998 23:25:29 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: Newbie Question About 'for'
Message-Id: <obr9ymaksm.fsf@alder.dev.tivoli.com>
Martin Gregory <mgregory@asc.sps.mot.com> writes:
> I read this and thought "Bah hah - that's funny, but now I get it!"
>
> Then I did this:
>
> perl -e 'for ($a=1, $a < 7, $a++){print;}'
>
> Then I was confused again.
>
> Can you predict what this prints?
I didn't...
> If you didn't predict it correctly, can you now explain why it does
> what it does?
>
> If you can, I'd love to know!
I can't explain it, but am guessing that the fact that an assignment
returns an lvalue, and the other two list items return values is the
key piece...
$a = 1 assignment returns an lvalue, so we get the lvalue $a
$a < 7 less than operator, returns true/1
$a++ auto-incrementer, returns the _value_ before incrementing
you can get the behaviour you thought you'd get by making the first
assignment $b = $a = 1, which returns a different lvalue and you get
111 as the output.
--
Jim Woodgate
Tivoli Systems
E-Mail: jdw@dev.tivoli.com
------------------------------
Date: 12 Aug 1998 07:30:38 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: Newbie Question About 'for'
Message-Id: <obu33is7pt.fsf@alder.dev.tivoli.com>
root@am.westblaak.spirit.nl (root) writes:
> $_ is 2 from the last init statement in the first run, and later on 1
> from the print statements in the run before...
> Why the loop rans for 3 times was already explained in this thread I think..
I don't believe that the 2 is caused by the last init statement, as
the following will print 111:
perl -e 'for ( $b=$a=1, $a < 7, $a++){print}'
--
Jim Woodgate
Tivoli Systems
E-Mail: jdw@dev.tivoli.com
------------------------------
Date: 12 Aug 1998 15:46:21 +0200
From: Oliver Laumann <net@informatik.uni-bremen.de>
Subject: Perl 5.005.1 core dumps under Irix 6.2
Message-Id: <wr4svi1ff6.fsf@ruin.informatik.uni-bremen.de>
Has anybody managed to successfully compile Perl 5.005.1 under Irix
6.2 using cc -n32 (on an IP-22 machine)?
When I build Perl using all the defaults suggested by Configure, it
dumps core (illegal instruction) when running the lib/posix test from
the test suite. In particular, it crashes when executing the lines
# Pick up whether we're really able to dynamically load everything.
print &POSIX::acos(1.0) == 0.0 ? "ok 17\n" : "not ok 17\n";
------------------------------
Date: Wed, 12 Aug 1998 09:28:35 -0400
From: jackass@freewwweb.com (Joshua Weinberg)
Subject: problem loading html page via perl location command
Message-Id: <jackass-ya02408000R1208980928350001@news.supernews.com>
I have a mysterious problem that's just cropped up. I have a CGI
script that checks for membership status on a password protected
page. Once everything checks out then viola;
print "Location: /$file/index.html", "\n\n";
exit( 0 );
the &file is passed by html and is the subdirectory name where
the user wants to go. All this has been working like gangbusters
except for all of the sudden now instead of loading the pages.
index.html (which is a frame document) loads, but the subsequent
html that should load into the frame cannot be found because the
browser is looking for them in the cgi-bin directory.
I've tried including:
chdir("../../htdocs/$file") || die "Cannot chdir to /$file: $!" ;
print "Location: /$file/index.html", "\n\n";
exit( 0 );
before the print location but it still doesn't get out of the
CGI-BIN. What's happening? Why all of the sudden does the
simple print location statement not work? Is there something
about the statement syntax that is incorrect?
Any help would be appreciated and please email your comments
to;
jackass@freewwweb.com
As I don't follow newsgroup threads effectively.
Thanks.
------------------------------
Date: 12 Aug 1998 14:42:02 GMT
From: am@am.westblaak.spirit.nl (Andre Merzky)
Subject: Q: open2 : whats wrong?
Message-Id: <6qs9jq$q9s$1@newnews.nl.uu.net>
Hello,
I try to use open2 on a RedHat 5.1 Linux, with perl version 5.005_01.
Hah! - there are examples to open2, hurray! :-) A bit cut&paste,
and I have following code:
-----------------
#!/usr/bin/perl -w
use strict;
use IPC::Open2;
my $pid = open2 ( \*READ, \*WRITE, "/bin/cat -u -n" );
print WRITE "<stuff\n>";
my $result = <READ>;
print "Got: '$result'\n";
----------------
And a test run shows this:
----------------
am am ~ : cd Devel/
am am ~/Devel : unsetenv *
am ~/Devel : unset *
./getkeypair.pl
Got: ' 1 <stuff
'
----------------
Question: where comes the ' 1 ' part from???
It gets more interesting if I wrap the snippet with
for (1..10) {
...
}
-----------------
Got: ' 1 <stuff
'
Got: ' 2 ><stuff
'
Got: ' 3 ><stuff
'
Got: ' 4 ><stuff
'
Got: ' 5 ><stuff
'
Got: ' 6 ><stuff
'
Got: ' 7 ><stuff
'
Got: ' 8 ><stuff
'
Got: ' 9 ><stuff
'
Got: ' 10 ><stuff
'
------------------
Hmm, nice builtin counter...
And: No, it's not $_! At least as far as I can see... I tries to
set $_ do some string beofore write and read, resp. Doesn't change a bit.
As you can see I also undefed all environments and settings.
Same result for tcsh and bash. on xterm and vt100.
Any ideas??? :-)
Cheers, Andre.
------------------------------
Date: 12 Aug 1998 13:05:13 GMT
From: kranz@paris.ifh.de (Matthias Kranz)
Subject: Q: Problems with <system> command
Message-Id: <6qs3u9$aet$1@pandora.ifh.de>
Hi!
I have the following problem. I want to use the system command
to invoke a pgp command on the system.
$rc = system("env PGPPATH=$PGPPATH pgp -fe $USER 2>/dev/null << $file");
The problem is that I get the result of system in rc, but I want also
catch the output of the pgp command.
In Tcl I can write something like this:
set rc [catch {exec env PGPPATH=$PGPPATH pgp -fe $USER 2>/dev/null \
<< $file} mess]
After the execution I have the result of the pgp command caught by the
catch command in mess and the result of the system command in rc.
Any ideas?
Any help appreciated.
Regards
Matthias
--
Matthias Kranz kranz@ifh.de
DESY Zeuthen
------------------------------
Date: Wed, 12 Aug 1998 09:13:46 -0400
From: Ryan Andrews <andrews.76@osu.edu>
Subject: Question, Net::Ping for Win32
Message-Id: <35D1950A.3E71@osu.edu>
I'm creating a script for work that is to run in the background, ping
all possible IP's on the network, and create a log file listing all
reachable IP addresses. I am having trouble using Net::Ping, and was
wondering if there was another module, for Win32's (I would need to do
this on a 95 and NT4.0 machine), or if the module just needs modified,
or exactly how I would be able to ping from a Win32 client.
I'd appreciate any suggestions...
Thanks,
Ryan Andrews
andrews.76@osu.edu
(yes, this is my first script for network usage)
------------------------------
Date: Wed, 12 Aug 1998 21:34:30 +0800
From: "Doug Paice" <dougp@global.net.au>
Subject: Referancing and dereferancing
Message-Id: <902928963.744495@pluto.global.net.au>
I've got a problem with a script, I store a referance to a hash in a regular
variable but when I try to use the keys function on that variable I get
errors. The keys function requires a hash not a referance, as far as I can
tell. Here is a snippet of what I'm trying to do:
$var = \%hash1;
...
foreach $key, keys($var) {...} # fails
%hash2 = $var; foreach $key, keys(%hash2) {...} # fails hash2 is empty
any ideas?
Thanks
Dougal
------------------------------
Date: 12 Aug 1998 14:15:45 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Referancing and dereferancing
Message-Id: <6qs82h$3r4@news-central.tiac.net>
In article <902928963.744495@pluto.global.net.au>,
Doug Paice <dougp@global.net.au> wrote:
>I've got a problem with a script, I store a referance to a hash in a regular
>variable but when I try to use the keys function on that variable I get
>errors. The keys function requires a hash not a referance, as far as I can
>tell. Here is a snippet of what I'm trying to do:
>
>$var = \%hash1;
>...
>foreach $key, keys($var) {...} # fails
Perl doesn't automatically dereference for you, so you need something like
foreach $key (keys %$var) {
...
}
to do what I think you're trying to do.
>%hash2 = $var; foreach $key, keys(%hash2) {...} # fails hash2 is empty
%hash2 = %$var;
Recent perls would issue a warning like:
Reference found where even-sized list expected at ...
for the %hash2 = $var assignment if the -w flag is used.
You should check out the perlref documentation for more gory details about
perl references.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Wed, 12 Aug 1998 14:15:13 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: system() problem
Message-Id: <ExKy9D.JAB@world.std.com>
Andy Ng <aacwn100@york.ac.uk> writes:
>I want to execute a program so I
>used system() and the command line in backticks aswell. the program
>works
>manually from unix, but doesn't work when I execute it from the webpage.
It is very likely that the web server does not provide the same
environment to the program as your login shell has. For example, your
login shell may have "accel" in your PATH environment variable, but a
program spawned from your webserver does not. (Or the permissions of
the program could be set up so that you are allowed to use it, but the
web server does not.)
These are some of the pitfalls that are covered in the document
<URL:http://www.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html>
--
Andrew Langmead
------------------------------
Date: Tue, 11 Aug 1998 15:04:13 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: The Perl Institute's Daily News
Message-Id: <pudge-1108981504140001@192.168.0.3>
There is now a daily Perl News page at The Perl Institute:
http://www.perl.org/news.html
We'll be posting all the Perl news that's fit to print: new perl and
module releases, conferences, books, contests, drive-by shootings, charges
of obstruction of justice, celebrity birthdays, and horoscopes.
Bookmark it, read it daily, and send any potential news items to news@perl.org.
You'll be glad you did. :-)
Thanks,
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Wed, 12 Aug 1998 13:02:53 GMT
From: "Alvin J. Alexander" <aja@DevDaily.com>
Subject: Re: Where can I find the binary for perl at least 5.002 (better 5.005) for Windows NT4.0 ?
Message-Id: <35D1927C.9717D393@DevDaily.com>
I'm told by several folks that with my "old man's memory" I've neglected
to mention the obvious source - CPAN! Actually, I didn't mention CPAN
for two reasons:
1. The original message stated that the user already tried www.perl.com.
2. The last time I looked at CPAN for a Windows binary (maybe a year
ago), I was directed elsewhere. Back then I read a message stating that
CPAN did not carry the Windows binary. I guess that has changed.
People tell me that the binary you seek might be found at this location:
http://www.perl.com/CPAN/
Personally, I normally work with Solaris and SCO Unix systems, and I
find the pre-compiled binaries at their sites (such as SCO's
"Skunkware"), or at other links from their site, such as the various
SunSITE locations.
Al
------------------------------
Date: 11 Aug 1998 19:37:32 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: X-file (?=...), case postponed.
Message-Id: <6qq6hs$hdl$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Patrick Timmins
<ptimmins@netserv.unmc.edu>],
who wrote in article <6qprfb$hoj$1@nnrp1.dejanews.com>:
> > Because split(//) never matches before the first character in the
> > string. It only matches *between* actual characters. Because the 'J'
> > is *before* the match position, it can't be matched by (?=(.*)).
>
> So the split// ( albeit, in the guise of split/(?=(.*))/ ) takes
> precedence over the '(.*)'.
????? What do you mean by this?
> Perl sees the (?= .. ) and nothing else
> between the '/../' in split and says "OK, I'm splitting on null".
No, it is just that /(?=(.*))/ matches exactly at the same places
where // would.
> Again, just one final question. Is all this documented some place, or
> at least implied by the existing documentation, or is it just a
> phenomenon that you all have come to understand intuitively? I believe
> I see it now, but it was in no way, shape, or form an intuitive matter
> for me. :(
It is amply documented (except maybe the fact that split does not try
to match patterns-matching-null at the start and the end of string - I
would like to check the source for this, and document it better - if
it is true).
Hmm, running
perl -Mre=debugcolor -e "$_='abc'; split /(?:x|)/"
shows that apparently split is asking the RE to not match at \G, and
throughs away the final zero-length match. Now how would one document
it?
Ilya
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 3426
**************************************