[19270] in Perl-Users-Digest
Perl-Users Digest, Issue: 1465 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 8 14:05:42 2001
Date: Wed, 8 Aug 2001 11:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <997293913-v10-i1465@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 8 Aug 2001 Volume: 10 Number: 1465
Today's topics:
Re: $ENV{'HTTP_REFERER'} <dwilga-MUNGE@mtholyoke.edu>
Re: Another string manipulation question (Anno Siegel)
Re: Another string manipulation question (Tad McClellan)
Re: Another string manipulation question <ren@tivoli.com>
Re: Another string manipulation question <jasper@guideguide.com>
Re: Another string manipulation question <jasper@guideguide.com>
Re: Another string manipulation question <jasper@guideguide.com>
Re: cgi->upload <richard@sunsetandlabrea.com>
Re: cgi->upload (Helgi Briem)
Re: cgi->upload <cpryce@pryce.net>
Re: Command line parameters under mod_perl <stefan.tillich@siemens.at>
Re: Command line parameters under mod_perl <ubl@schaffhausen.de>
Re: Command line parameters under mod_perl <bill.kemp@wire2.com>
Re: converting strings <ow22@nospam-cornell.edu>
Re: Easy array question ? (Tad McClellan)
file existence w/ wild cards <hpan@stanford.edu>
Re: For loop aliasing?? <uri@sysarch.com>
Re: FTP commands <jeroen.erkens@ing-barings.com>
Re: get rid of these leading zeros in Perl <Dave.Stafford@globis.net>
Re: getting the name of a sub from a sub ref (Tad McClellan)
Re: Hash, List, Ref Problem (Tad McClellan)
Re: How do I launch a web page <bobkolker@mediaone.net>
Re: How do I launch a web page <bobkolker@mediaone.net>
Re: How to get Mac and IP address of computers over a n (Fred)
LD_RUN_PATH <bing-du@tamu.edu>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 08 Aug 2001 15:45:45 GMT
From: Dan Wilga <dwilga-MUNGE@mtholyoke.edu>
Subject: Re: $ENV{'HTTP_REFERER'}
Message-Id: <dwilga-MUNGE-006337.11454408082001@nap.mtholyoke.edu>
In article <3b70e8a6.48647218@news.freeserve.co.uk>, slash@dot.c.o.m.org
wrote:
> If web site authors are
> not using
> stylesheets to define the style of HTML pages these days they really should
> should
> consider changing careers.
If web site authors are not relying on style sheets, it may be because they
want to ensure the widest audience possible. By using both FONT tags (for what
they can control) and style sheets (for anything else) you're doing just that.
When I design web pages, I try to make them viewable on everything from Lynx,
to Netscape 2 or 3, right up to the latest browser versions. Relying too
heavily on CSS makes the experience of users with older browsers less than
ideal.
--
Dan Wilga dwilga-MUNGE@mtholyoke.edu
** Remove the -MUNGE in my address to reply **
------------------------------
Date: 8 Aug 2001 15:14:58 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Another string manipulation question
Message-Id: <9krl1i$i1b$1@mamenchi.zrz.TU-Berlin.DE>
According to Doug Robbins <sleddog@operamail.com>:
> I have a string like this (for example) whic a perl script is getting
> from a generated text file:
>
> 03:00 PM EST
>
> Problem is, the hour is off by one hour (slow). Hour can I increment
> the hour by one? In other words, when the original string contains
> 03:00 I want 04:00, when its 06:00 I want 07:00, etc. Get's trickier
> when we get to 12:00...
>
> Of course I could simply replace 'EST' with 'CST' but that would be too
> easy :)
You can do that locally, without upsetting the time zone for anyone
else:
sub otherlocaltime {
local $ENV{ TZ} = shift if @_;
localtime();
}
Of course, $ENV{ TZ} could also be local to a whole script.
I'd only do that if the clock skew is accurately described by a time
zone transition. If you have a fixed offset of an hour, rather use
"localtime( 60*60 + time())".
All this, of course, assumes you are getting the time in your program
yourself, as opposed to reading time strings from an external source.
Anno
------------------------------
Date: Wed, 8 Aug 2001 10:20:04 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Another string manipulation question
Message-Id: <slrn9n2ikk.mbp.tadmc@tadmc26.august.net>
Doug Robbins <sleddog@operamail.com> wrote:
>I have a string like this (for example)
>
>03:00 PM EST
>
>Problem is, the hour is off by one hour (slow). Hour can I increment
>the hour by one? In other words, when the original string contains
>03:00 I want 04:00, when its 06:00 I want 07:00, etc.
Assuming the time is in $_ :
s/^(\d+)/ sprintf "%02d", $1 % 12 + 1 /e;
>Get's trickier
>when we get to 12:00...
Only because of the need to switch between AM/PM (and that
is when the time is 11:00, not 12:00):
s/([AP]M)/ $1 eq 'AM' ? 'PM' : 'AM' /e if /^11/;
s/^(\d+)/ sprintf "%02d", $1 % 12 + 1 /e;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 08 Aug 2001 10:50:01 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Another string manipulation question
Message-Id: <m3pua6eel2.fsf@dhcp9-161.support.tivoli.com>
On Wed, 8 Aug 2001, john.imrie@pa.press.net wrote:
> Paul Fortescue wrote:
>
>> This is without a doubt the longets answer you will get. I await with
>> interest the 'right' way to do this, from the experts.
>> But this is how C programmers (old ones at that) would do something like
>> this ...
>> $t="11:00 PM EST";
>> $ampm=substr($t, 6, 2);
>> $newt=substr($t, 0, 2)+1 ;
>> if ($newt==13) {
>> $newt=1;
>> $ampm="PM";
>> }
>> if ($newt==12&&($ampm eq "PM")) {
>> $newt=0;
>> $ampm="AM";
>> }
>> $u=sprintf ("%02d%03s%s%s\r\n",$newt,substr($t,2,4),$ampm,substr($t,8));
>> print "$u\r\n";
>>
>>
>
> A shorter way to do this $t='11:00 PM EST'; substr($t,0,2)++;
> substr($t,6,1) = substr($t,6,1) eq 'A' ? 'P' : 'A' if substr($t,0,2)
> >=12; substr($t,0,2) = '01' if substr($t,0,2) eq '13';
>
> print "$t\n";
Both of these mistakenly assume noon is 12AM. It isn't.
Actually, the second one, at least, is worse:
11:00 AM -> 12:00 PM -> 01:00 AM
11:00 PM -> 12:00 AM -> 01:00 PM
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 08 Aug 2001 18:21:08 +0100
From: Jasper McCrea <jasper@guideguide.com>
Subject: Re: Another string manipulation question
Message-Id: <3B717504.25CDADA6@guideguide.com>
Tad McClellan wrote:
>
> Doug Robbins <sleddog@operamail.com> wrote:
>
>
> >Get's trickier
> >when we get to 12:00...
>
> Only because of the need to switch between AM/PM (and that
> is when the time is 11:00, not 12:00):
>
> s/([AP]M)/ $1 eq 'AM' ? 'PM' : 'AM' /e if /^11/;
> s/^(\d+)/ sprintf "%02d", $1 % 12 + 1 /e;
Bizzare, Tad. You are saying that the AM/PM change occurs from 10-11.
Maybe this is different in Texas?
Jasper
--
split//,'019617511192'.
'17011111610114101114'.
'21011141011840799901'.
'17101174';
foreach(0..
$#_){$_[$_
++]^=$_[$_
--]^=$_[$_
]^=$_[++ $_]if!($_%
2)}$g.=$_ ,chr($g)=~
/(\w)/&&($o.=$1and
$g='')foreach@_;
print"$o\n"
------------------------------
Date: Wed, 08 Aug 2001 18:23:46 +0100
From: Jasper McCrea <jasper@guideguide.com>
Subject: Re: Another string manipulation question
Message-Id: <3B7175A2.CA44A093@guideguide.com>
Jasper McCrea wrote:
>
> Tad McClellan wrote:
> >
> > Doug Robbins <sleddog@operamail.com> wrote:
> >
> >
> > >Get's trickier
> > >when we get to 12:00...
> >
> > Only because of the need to switch between AM/PM (and that
> > is when the time is 11:00, not 12:00):
> >
> > s/([AP]M)/ $1 eq 'AM' ? 'PM' : 'AM' /e if /^11/;
> > s/^(\d+)/ sprintf "%02d", $1 % 12 + 1 /e;
>
> Bizzare, Tad. You are saying that the AM/PM change occurs from 10-11.
> Maybe this is different in Texas?
>
> Jasper
Argh! A Gazillion apologies. Didn't even read your second line of code,
and assumed you'd incremented the hour before doing the AM/PM thing.
Jasper
--
split//,'019617511192'.
'17011111610114101114'.
'21011141011840799901'.
'17101174';
foreach(0..
$#_){$_[$_
++]^=$_[$_
--]^=$_[$_
]^=$_[++ $_]if!($_%
2)}$g.=$_ ,chr($g)=~
/(\w)/&&($o.=$1and
$g='')foreach@_;
print"$o\n"
------------------------------
Date: Wed, 08 Aug 2001 18:31:00 +0100
From: Jasper McCrea <jasper@guideguide.com>
Subject: Re: Another string manipulation question
Message-Id: <3B717754.D02AFA10@guideguide.com>
Jasper McCrea wrote:
>
> Jasper McCrea wrote:
> >
> > Tad McClellan wrote:
> > >
> > > Doug Robbins <sleddog@operamail.com> wrote:
> > >
> > >
> > > >Get's trickier
> > > >when we get to 12:00...
> > >
> > > Only because of the need to switch between AM/PM (and that
> > > is when the time is 11:00, not 12:00):
> > >
> > > s/([AP]M)/ $1 eq 'AM' ? 'PM' : 'AM' /e if /^11/;
> > > s/^(\d+)/ sprintf "%02d", $1 % 12 + 1 /e;
> >
> > Bizzare, Tad. You are saying that the AM/PM change occurs from 10-11.
> > Maybe this is different in Texas?
> >
> > Jasper
>
> Argh! A Gazillion apologies. Didn't even read your second line of code,
> and assumed you'd incremented the hour before doing the AM/PM thing.
>
> Jasper
Maybe not a gazillion apologies. Let's try just one. While your code is
correct 'n' all (I especially like the $1 % 12 +1 bit), your comments
suck :).
Saying the AM/PM change occurs at 11:00 is very misleading.
I'd swap the two lines around, and make it
s/^(\d+)/ sprintf "%02d", $1 % 12 + 1 /e;
s/([AP]M)/ $1 eq 'AM' ? 'PM' : 'AM' /e if /^12/;
?
Jasper
--
split//,'019617511192'.
'17011111610114101114'.
'21011141011840799901'.
'17101174';
foreach(0..
$#_){$_[$_
++]^=$_[$_
--]^=$_[$_
]^=$_[++ $_]if!($_%
2)}$g.=$_ ,chr($g)=~
/(\w)/&&($o.=$1and
$g='')foreach@_;
print"$o\n"
------------------------------
Date: Wed, 8 Aug 2001 16:10:59 +0000
From: Richard Chamberlain <richard@sunsetandlabrea.com>
Subject: Re: cgi->upload
Message-Id: <Lucc7.3659$e%3.329074@news2-win.server.ntlworld.com>
cp wrote:
>
> "Richard Chamberlain" <richard@sunsetandlabrea.com> wrote in message
> news:bRbc7.1135$tq.177308@news6-win.server.ntlworld.com...
>> Hi,
>>
>> I'm a perl newbie and I'm having tremendous difficulties getting ->upload
>> to work using CGI.pm.
>>
>> from what I can tell i just need to do:
>>
>> $file=q->param('file');
>> $fh=q->upload($file);
>>
>> the last statement returns false, i.e. if I do:
>>
>> if ($fh=q->upload($file)) {
>> # do something or other
>> }
>
> 1) remember to use start_multipart_form instead of start_form.
>
> 2) the $q->upload function is new as of CGI.pm 2.47. If you have an older
> version of the module, that function is not available. Using warnings will
> alert you to that.
>
> 3) the correct syntax, if 'file' is the name of your file upload field,
> according to the Docs is:
>
> $fh = $q->upload('file')
> while (<$fh>) {
> # do something or other
> }
>
> http://stein.cshl.org/WWW/software/CGI/cgi_docs.html#forms
> for more info
>
> cp
>
>
>
Many thanks - I got my code from CGI programming with perl, I guess it's
time to look at the errata.
Thanks again,
Richard
------------------------------
Date: Wed, 08 Aug 2001 15:48:32 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: cgi->upload
Message-Id: <3b715cf0.1408129032@news.isholf.is>
On Wed, 8 Aug 2001 15:26:41 +0000, Richard Chamberlain
<richard@sunsetandlabrea.com> wrote:
>Hi,
>
>I'm a perl newbie and I'm having tremendous difficulties getting ->upload
>to work using CGI.pm.
>
>from what I can tell i just need to do:
I don't know where you're getting that ->upload stuff
from, but below is a very simple one upload script:
Regards,
Helgi Briem
--------------------------
#!/usr/bin/perl -wT
use strict;
use CGI;
my $form = new CGI;
my $query = new CGI;
print $form->header;
my $file = $query->param('FILE');
my ($bytesread,$buffer,$filecontents);
while ($bytesread = read($file,$buffer,1024))
{
$filecontents .= $buffer;
}
print "<br>Contents of $file:<br><pre>$filecontents</pre>";
----------------------------
------------------------------
Date: Wed, 8 Aug 2001 10:58:35 -0500
From: "cp" <cpryce@pryce.net>
Subject: Re: cgi->upload
Message-Id: <Bidc7.3834$x84.984375@ruti.visi.com>
"Helgi Briem" <helgi@NOSPAMdecode.is> wrote in message
news:3b715cf0.1408129032@news.isholf.is...
> On Wed, 8 Aug 2001 15:26:41 +0000, Richard Chamberlain
> <richard@sunsetandlabrea.com> wrote:
>from what I can tell i just need to do:
>
> I don't know where you're getting that ->upload stuff
> from, but below is a very simple one upload script:
>
From the author's Web site:
http://stein.cshl.org/WWW/software/CGI/cgi_docs.html#upload
"...
There are problems with the dual nature of the upload fields. If you use
strict, then Perl will complain when you try to use a string as a
filehandle. You can get around this by placing the file reading code in a
block containing the no strict pragma. More seriously, it is possible for
the remote user to type garbage into the upload field, in which case what
you get from param() is not a filehandle at all, but a string.
To be safe, use the upload() function (new in version 2.47). When called
with the name of an upload field, upload() returns a filehandle, or undef if
the parameter is not a valid filehandle.
$fh = $query->upload('uploaded_file');
while (<$fh>) {
print;
}
In an array context, upload() will return an array of filehandles. This
makes it possible to create forms that use the same name for multiple upload
fields.
This is the recommended idiom.
.."
------------------------------
Date: Wed, 08 Aug 2001 17:05:25 +0200
From: Stefan Tillich <stefan.tillich@siemens.at>
Subject: Re: Command line parameters under mod_perl
Message-Id: <3B715535.7E26E88C@siemens.at>
Tom Melly schrieb:
> "Stefan Tillich" <stefan.tillich@siemens.at> wrote in message
> news:3B713A1B.4F2AE221@siemens.at...
> > I'm trying to read in the parameters passes to a perl-script using
> > @ARVG. The parameters are passes in the URL: e.g.
> > http://www.someplace.com/cgi-bin/script.perl-cgi?param1+param2+param3
> >
> > The script is run under mod_perl on the apache webserver and the
> > parameters are not passes to @ARGV.
> >
> > Is there some other way to access them?
> >
>
> Well, assuming your problem isn't that you're REALLY trying to read from
> @ARVG...
Actually I am trying to read the Parameters this way, because my parameters dont
come from a webform but are arbitrary parameters without a definite name.
Steve
>
>
> It looks as though you are trying to read params as you would running the perl
> script from the command line.
>
> For cgi, the format is:
> http://cgi.barfoo.co.uk/cgi-bin/demo.cgi?foo=bar
>
> i.e. the cgi param foo has a value bar.
>
> You then need to read these values into conventional perl vars - e.g.
>
> use CGI qw(:standard);
> $foo = param("foo"); # $foo now equals "bar"
------------------------------
Date: Wed, 08 Aug 2001 16:59:58 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Command line parameters under mod_perl
Message-Id: <3B7161FE.9166CA50@schaffhausen.de>
Stefan Tillich schrieb:
> The script is run under mod_perl on the apache webserver and the
> parameters are not passes to @ARGV.
Maybe if your are having such basic problems with the understanding
of the topic you shouldnt be using mod_perl, as one usually doesnt
during development phase, because it's features make programming
with trial & error really hard. You should consider to use CGI
instead until you code reaches production quality.
Bye,
->malte
------------------------------
Date: Wed, 8 Aug 2001 16:30:59 +0100
From: "W K" <bill.kemp@wire2.com>
Subject: Re: Command line parameters under mod_perl
Message-Id: <IZcc7.250$t97.2332@news.uk.colt.net>
>> > I'm trying to read in the parameters passes to a perl-script using
>> > @ARVG. The parameters are passes in the URL: e.g.
>> > http://www.someplace.com/cgi-bin/script.perl-cgi?param1+param2+param3
>> >
>> > The script is run under mod_perl on the apache webserver and the
>> > parameters are not passes to @ARGV.
>> >
>> > Is there some other way to access them?
>> >
>>
>> Well, assuming your problem isn't that you're REALLY trying to read from
>> @ARVG...
>
>Actually I am trying to read the Parameters this way, because my parameters
dont
>come from a webform but are arbitrary parameters without a definite name.
Well if you insist you know what you are doing.
$argstring=$r->args;
I don't know why you are calling it a command line or talking about @ARGV.
They are words that don't really go with mod_perl.
------------------------------
Date: Wed, 8 Aug 2001 10:08:48 -0700
From: "Oliver" <ow22@nospam-cornell.edu>
Subject: Re: converting strings
Message-Id: <9krrng$lag$1@news01.cit.cornell.edu>
"Oliver" <ow22@nospam-cornell.edu> wrote in message
news:9krqpl$jv7$1@news01.cit.cornell.edu...
> how do i convert a string to an int? thanks
>
>
oh duh nevermind that.
------------------------------
Date: Wed, 8 Aug 2001 10:24:35 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Easy array question ?
Message-Id: <slrn9n2it3.mbp.tadmc@tadmc26.august.net>
Philippe PERRIN <philippe.perrin@sxb.bsf.alcatel.fr> wrote:
>
>This is certainly easy for some of you,
It would be easy for you too if you read the documentation
for the functions that you use...
>but I can't figure out how to
>remove the FIRST element of an array (in the same way as pop() removes
>the LAST)...
perldoc -f pop
Take notice of the other Perl function that it mentions, then:
perldoc -f shift
You already had the answer. It appears you did not look for it.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 8 Aug 2001 09:50:03 -0700
From: Hubert Pan <hpan@stanford.edu>
Subject: file existence w/ wild cards
Message-Id: <Pine.GSO.4.31.0108080947050.8812-100000@myth10.Stanford.EDU>
hey,
so i figured out you can do a simple -e to find out if a file exists or
not, but how could one use pattern matching for the query? like, if you
wanted to know if any file has a name that starts with a specified
string?
thanks!
hubert
------------------------------
Date: Wed, 08 Aug 2001 16:34:42 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: For loop aliasing??
Message-Id: <x7hevia4ta.fsf@home.sysarch.com>
>>>>> "A" == Aether <aether@centurytel.net> writes:
A> Sam Holden <sholden@pgrad.cs.usyd.edu.au> wrote in message
A> news:slrn9n1l3k.jt8.sholden@pgrad.cs.usyd.edu.au...
>> On Wed, 8 Aug 2001 00:44:17 -0500, Aether <aether@centurytel.net> wrote:
>> >One difference between this version and yours is that the "loop" does not
>> >alter the value of $string. It assigns it to $_ and modifies that. Of
>> >course, this code does nothing with $_ so the loop does nothing.
>>
>> It in fact does modify $string, since $_ is made an alias for $string.
>> Perhaps you should try things out before declaring them as facts...
>>
A> I did try it and it did nothing.
first off learn how to quote properly. jeopardy style is highly
deprecated here.
secondly, you claim this (which is flat out wrong) and don't show
your example code. do you think that anyone would just listen to you
with no substantiation? or that aliasing to $_ is documented and in use
by many programs?
please think a little more before spouting off like that. and show your
code.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 08 Aug 2001 16:16:00 +0100
From: Jeroen <jeroen.erkens@ing-barings.com>
Subject: Re: FTP commands
Message-Id: <3B7157B0.9AC6F78A@ing-barings.com>
--------------A4793987836D16EF50860689
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I have read the documentation. I've also asked colleagues and searched
the web. No luck. The documentation says stuff all:
$ftp->quot(cmd[,arg])
Sends s literal FTP protocol command to the server and waits for a
response. Returns the most significant digit of the response code.
What is the response code and what does each value indicate? Do I use
$ftp->quot( "authenticate", "blargh"), or $ftp->quot( "quote
authenticate", "blargh") or $ftp->quot( "authenticate blargh") or ...
I use the newsgroup as a last resort for help, not as a first step in
getting an answer.
Cheers,
Jeroen
Tony Curtis wrote:
> >> On Wed, 08 Aug 2001 13:08:26 +0100,
> >> Jeroen <jeroen.erkens@ing-barings.com> said:
>
> > Hi, We have a unix script which FTPs, which uses the
> > following FTP commands:
>
> > quote authenticate blargh quote response blargh
>
> > How can I do this in PERL? If it's using ftp->quot(cmd[,
> > args]), how do I determine whether the command has been
> > successful?
>
> What does the documentation say? You'll find the answer,
> as usual, in the relevant perldoc, viz. Net::FTP.
>
> --
> Beep beep! Out of my way, I'm a motorist!
--------------A4793987836D16EF50860689
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I have read the documentation. I've also asked colleagues and searched
the web. No luck. The documentation says stuff all:
<p><i>$ftp</i><b>->quot</b><i>(cmd[,arg])</i>
<br>Sends s literal FTP protocol command to the server and waits for a
response. Returns the most significant digit of the response code.
<br>
<p>What is the response code and what does each value indicate? Do I use
$ftp->quot( "authenticate", "blargh"), or $ftp->quot( "quote authenticate",
"blargh") or $ftp->quot( "authenticate blargh") or ...
<p>I use the newsgroup as a last resort for help, not as a first step in
getting an answer.
<p>Cheers,
<br>Jeroen
<br>
<p>Tony Curtis wrote:
<blockquote TYPE=CITE>>> On Wed, 08 Aug 2001 13:08:26 +0100,
<br>>> Jeroen <jeroen.erkens@ing-barings.com> said:
<p>> Hi, We have a unix script which FTPs, which uses the
<br>> following FTP commands:
<p>> quote authenticate blargh quote response blargh
<p>> How can I do this in PERL? If it's using ftp->quot(cmd[,
<br>> args]), how do I determine whether the command has been
<br>> successful?
<p>What does the documentation say? You'll find the answer,
<br>as usual, in the relevant perldoc, viz. Net::FTP.
<p>--
<br>Beep beep! Out of my way, I'm a motorist!</blockquote>
</html>
--------------A4793987836D16EF50860689--
------------------------------
Date: Wed, 08 Aug 2001 15:23:49 GMT
From: "Dave Stafford" <Dave.Stafford@globis.net>
Subject: Re: get rid of these leading zeros in Perl
Message-Id: <9Qcc7.374242$XL1.6228543@nlnews00.chello.com>
I'm lazy:
$id1+=0;
Dave
"Jim Monty" <monty@primenet.com> wrote in message
news:9kq3im$sv8$1@nnrp2.phx.gblx.net...
> Abigail <abigail@foad.org> wrote:
> > Jim Monty <monty@primenet.com> wrote:
> > >
> > > my $id1 = ...;
> > > $id1 =~ s/^0+//; # Safest general solution
> >
> > my $id1 = "0000000";
>
> Ok.
>
> $id1 =~ s/^0+(?=\d)//; # Safest general solution?
>
> --
> Jim Monty
> monty@primenet.com
> Tempe, Arizona USA
------------------------------
Date: Wed, 8 Aug 2001 10:33:16 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: getting the name of a sub from a sub ref
Message-Id: <slrn9n2jdc.mbp.tadmc@tadmc26.august.net>
John Imrie <john.imrie@pa.press.net> wrote:
>is it possible to extract the name of the subrouteen pointed to by a sub ref
What should it extract for the below?
my $sub = sub { print @_ };
my $subname = extract_sub_name($sub);
Some subroutines do not _have_ a name...
-----
I expect we have an "XY problem" [1] working here.
Why do you think you need to do this?
There is likely a better way if we knew what your final objective is.
A "dispatch table" may be involved in the solution...
-----
[1] MJD coined the phrase:
I suggested yesterday that you have a case of the XY disease. This is
when you are trying to accomplish some task X, and you decide that
doing Y will help you accomplish X, so you come and ask about Y. But
actually, Y is totally wrong, and nobody can help you because you
never mentioned X, which is what you really want.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 8 Aug 2001 10:41:19 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Hash, List, Ref Problem
Message-Id: <slrn9n2jsf.mbp.tadmc@tadmc26.august.net>
Philippe PERRIN <philippe.perrin@sxb.bsf.alcatel.fr> wrote:
>So why does the following NOT work ?
perl would have given you a big clue if you had asked for it.
I suggest you ask for all the help you can get:
use strict;
>@list = (1, 2);
>%h = (10 => \@list);
>($a, $b) = @$h{10};
^^
Global symbol "$h" requires explicit package name at ./temp line 6.
You are trying to deref a variable named $h, you want to be
dereffing a variable named $h{10} instead:
my ($a, $b) = @{ $h{10} };
>print "[$a] [$b]\n"; # I get [] [] ==> :-(
>Thnx
Please enable warnings and strictures *before* asking thousands
of other people about it. Thank you.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 08 Aug 2001 17:28:55 GMT
From: "Robert J. Kolker" <bobkolker@mediaone.net>
Subject: Re: How do I launch a web page
Message-Id: <3B71775E.6DB672B8@mediaone.net>
"Alan J. Flavell" wrote:
> On Jul 31, Robert J. Kolker pijnigte haar/zijn toetsenbord:
>
> > How do I launch a web page,
>
> with a steep ramp and a bottle of champagne?
>
> > given its URL
> > from inside a PERL progragm.
>
> You might be looking for the LWP bundle, but your question is too
> vague. Which is the server, which is the client, where are you in
> relation to them, where is the script running?
To be more specific, I want to find a Perl idiom that
produces the same effect as clicking on a hypertext
point inside a web brouwser or an imbedded hyptext
pointer in (say) an e-mail I receive.
Bob Kolker
------------------------------
Date: Wed, 08 Aug 2001 17:30:14 GMT
From: "Robert J. Kolker" <bobkolker@mediaone.net>
Subject: Re: How do I launch a web page
Message-Id: <3B7177AD.D1506F79@mediaone.net>
Bart Lateur wrote:
> Robert J. Kolker wrote:
>
> >How do I launch a web page, given its URL
> >from inside a PERL progragm.
>
> On Win95 and related:
>
> system "start", "http://search.cpan.org";
>
> --
> Bart.
Bingo! Muchos gracias!
Bob Kolker
------------------------------
Date: 8 Aug 2001 10:38:48 -0700
From: flichtenfels@hotmail.com (Fred)
Subject: Re: How to get Mac and IP address of computers over a network?
Message-Id: <88a56672.0108080938.4601a92d@posting.google.com>
Thanks for your response Paul. I forgot to mention in my original
post that I am using Windows NT, not sure if this makes a difference.
What is this nmap and where and how do you use it?(Is it a perl
command or something you run from the command line?)
I typed arp at my command prompt and it displayed my ip address and
the gateway's ip and mac address, but not my mac address.
I am a novice and I think your explanation was over my head a little.
If you could elaborate a little it would be much appreciated.
Either way thanks a lot for your help and time.
Fred
------------------------------
Date: Wed, 08 Aug 2001 12:21:08 -0500
From: Bing Du <bing-du@tamu.edu>
Subject: LD_RUN_PATH
Message-Id: <3B717504.E24DA0A0@tamu.edu>
Hi,
This is perl, version 5.005_03 built for irix-64.
The following script is just for testing if installed DBI/DBD::mysql
work fine.
=================
#!/usr/freeware/bin/perl64
use DBI;
use DBD::mysql;
=================
I got the following error when I run it:
==============
Can't load
'/usr/freeware/lib/perl5/site_perl/5.005/irix-64/auto/DBD/mysql/mysql
.so' for module DBD::mysql: 27636767:/usr/freeware/bin/perl64: rld:
Fatal Error:
Cannot Successfully map soname 'libmysqlclient.so.7' under any of the
filenames
/usr/freeware/lib/perl5/5.00503/irix-64/CORE/libmysqlclient.so.7:/usr/lib64/lib
mysqlclient.so.7:/usr/lib64/internal/libmysqlclient.so.7:/lib64/libmysqlclient.s
o.7:/opt/lib64/libmysqlclient.so.7:/usr/freeware/lib/perl5/5.00503/irix-64/CORE/
libmysqlclient.so.7.7:/usr/lib64/libmysqlclient.so.7.7:/usr/lib64/internal/libmy
sqlclient.so.7.7:/lib64/libmysqlclient.so.7.7:/opt/lib64/libmysqlclient.so.7.7:
at /usr/freeware/lib/perl5/5.00503/irix-64/DynaLoader.pm line 169.
at /tmp/mysql-test.pl line 5
BEGIN failed--compilation aborted at /tmp/mysql-test.pl line 5.
===============
Our system admin suggested me set up LD_RUN_PATH to /usr/local/lib/mysql
in my script. I did so as shown below. And I can see LD_RUN_PATH in
the printout of %ENV. However I still got the above long error message.
===========
#!/usr/freeware/bin/perl64
$ENV{'LD_RUN_PATH'} = "/usr/local/lib/mysql";
foreach $key (keys %ENV)
{
print "$key: $ENV{$key}\n";
}
use DBI;
use DBD::mysql;
=============
Any idea how I should get it fixed?
Thanks much for any help.
Bing
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1465
***************************************