[13291] in Perl-Users-Digest
Perl-Users Digest, Issue: 701 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 2 07:07:19 1999
Date: Thu, 2 Sep 1999 04:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 2 Sep 1999 Volume: 9 Number: 701
Today's topics:
Re: Appending and Writing (Michael Budash)
Re: Date / time problem (resolution) <gellyfish@gellyfish.com>
DBM ---> TXT file.. <roco3d@softhome.net>
Discussion groups app <kevin.porter@fast.no>
Re: Doing a reverse lookup with ping? (hoz)
Re: editors?? <gellyfish@gellyfish.com>
Getting table structure (Paulius)
Re: How do I pass a variable to the "use" statement? <ahands@sprynet.com>
IPC::open2 duplicates output <honerla@euenet.uni-duisburg.de>
Re: Perl5 sendmail <gellyfish@gellyfish.com>
Re: Please help a newbe <hove@ido.phys.ntnu.no>
Re: Redirecting STDERR to STDOUT (on NT) (hoz)
Re: Running a cgi from ssi <steff.watkins@gordian.co.uk>
Re: SEARCH and REPLACE <hove@ido.phys.ntnu.no>
Re: Simulating Carriage Returns (Ilya Zakharevich)
Size in Pixels with PERL <roco3d@softhome.net>
Re: socket timeout <ajansen@glasshouse.nl>
sticky undef $/ (Eric Smith)
Re: sticky undef $/ (Eric Smith)
Re: sticky undef $/ <admin@futuristic.net>
That Cargo Date Code ( was Re: Y2K) <gellyfish@gellyfish.com>
Re: Tracking progress of a Net::FTP download <ecliptica.ww@nospam.virgin.net>
Re: Using split on a variable <cain@datasync.com>
Re: write to a file in a loop (Lars Gregersen)
Re: Y2K <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 02 Sep 1999 00:38:49 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Appending and Writing
Message-Id: <mbudash-0209990038490001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>
In article <MPG.1237b6fd4f77ba89989f0b@nntp.hpl.hp.com>, lr@hpl.hp.com
(Larry Rosler) wrote:
>In article <7qkga0$4kk@dfw-ixnews7.ix.netcom.com> on 2 Sep 1999 00:27:44
>GMT, Eric Bohlman <ebohlman@netcom.com> says...
>> RICHARDS AMANDA DAWN (richara@ecf.toronto.edu) wrote:
>> : I was wondering if there would be any way besides copying the contents of
>> : a file, changing them and then writing a totally new file to change some
>> : (well...one) bit of information in a file (ie get rid of the old bit in
>> : the file and replace it with a new bit) and also append at the same time.
>>
>> It's possible only if the new "bit" is *exactly* the same size as the old
>> "bit." In that case, open the file for read/write, seek() to the spot
>> where you want to make the change, print() the change, and then seek() to
>> the end of the file.
>
>Is that last seek really necessary? I don't think closing the file will
>truncate it to the current file position, on any OS.
it is since the original post stated "...also append at the same time."
--
| Michael Budash Consulting | 707-252-7670 voice |
| Perl, Javascript, PHP, MySQL | 603-250-8679 fax |
| Official Extropia Developer | mbudash@sonic.net |
------------------------------
Date: 2 Sep 1999 09:25:23 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Date / time problem (resolution)
Message-Id: <37ce3473_1@newsread3.dircon.co.uk>
[alt.perl removed from groups]
In comp.lang.perl.misc news <news@news.news> wrote:
>
>
> Larry Rosler wrote:
>
>> In article <37CC22A9.DF7F800C@news.news> on Tue, 31 Aug 1999 19:44:57
>> +0100, news <news@news.news> says...
>> > Dear all,
>> > I posted this a few days ago:
>> >
>> > # This prints seconds from epoch ok
>> > $date = time;
>> > # This returns nothing
>> > $date = localtime;
>> > # This too
>> > $date =gmtime;
>>
>> What nonsense. You were told earlier that you have a problem with your
>> perl installaion. But you have chosen to work around it, rather than
>> fix it. So why should we care (except that you are spewing
>> misinformation which might mislead the unwary.
>>
>
> I checked the version and it was 5. Everything else works ok, so I tried
> this and this works. How is this misinformation if it works? How am I
> supposed to know that this is a workaround and not the proper method if I am
> new to perl?
>
If you had read the perlfunc entry for localtime as you should have done
in the first place :
...
In a scalar context, returns the ctime(3) value:
$now_string = localtime; # e.g., "Thu Oct 13 04:54:34 1994"
...
If you are not seeing this behaviour then you are *not* using Perl 5 - You
should check that the Perl you are using is the one that you think you are.
/J\
--
"I can't believe Elton John recorded that song again. Exactly how do you
live your life like a spurgis in the wind?" - Ronnie, Veronica's Closet
------------------------------
Date: Thu, 2 Sep 1999 05:23:23 -0400
From: "Rodrigo Cortes" <roco3d@softhome.net>
Subject: DBM ---> TXT file..
Message-Id: <7nrz3.33$dZ.1006@maule>
How i can convert a dbm file into a txt file???
--
Rodrigo Cortés
ROCO3D
ICQ: 35921840
http://roco3d.cjb.net
------------------------------
Date: Thu, 02 Sep 1999 11:31:27 +0100
From: kev <kevin.porter@fast.no>
Subject: Discussion groups app
Message-Id: <37CE51FF.EADFCD96@fast.no>
Hi,
I need to add a discussion group/notice board app to a web site. Is
there a freely available app that I can use or must I write one from
scratch?
We don't have a relational DB at our disposal, so the solution must use
just flat files.
TIA,
- Kev
------------------------------
Date: Thu, 02 Sep 1999 15:31:48 GMT
From: hoz@rocketmail.com (hoz)
Subject: Re: Doing a reverse lookup with ping?
Message-Id: <37ce9845.2760956@news.netvision.net.il>
On Wed, 1 Sep 1999 05:13:01 -0400, "Tim" <orange_nurf@hotmail.com>
wrote:
>I would like to use something to do a reverse lookup on an ip.
try using nslookup
-hoz
------------------------------
Date: 2 Sep 1999 09:29:01 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: editors??
Message-Id: <37ce354d_1@newsread3.dircon.co.uk>
Caper <stevencNOSPAM@nbnet.nb.ca> wrote:
> Any good Perl debuggers or editors to suggest?
>
Its a bit late to avoid the usual boring thread but I would suggest
that you look at
<http://www.perl.com/reference/query.cgi?editors>
and make your own mind up.
/J\
--
"I was the chief make-up artist on the Titanic" - Tina Earnshaw, Chief
Make-Up Artist, Titanic
------------------------------
Date: 2 Sep 1999 09:51:42 GMT
From: kaktusaz@takas.lt (Paulius)
Subject: Getting table structure
Message-Id: <8E356E596kaktusasusanet@news.omnitel.net>
Hello,
is it possible to get a table structure using DBI/DBD/ODBC like in
JDBC with DatabaseMetaData? [getColumns()]
if yes, then how?
DB: VFP (dbf)
OS: NT
TIA
Paulius
------------------------------
Date: Wed, 01 Sep 1999 23:18:33 -0400
From: Adrian Hands <ahands@sprynet.com>
To: samingins@my-deja.com
Subject: Re: How do I pass a variable to the "use" statement?
Message-Id: <37CDEC89.B73AB847@sprynet.com>
my $module = 'my_module.pm';
require $module;
note that with "require" you need to specify ".pm".
Do look at the docs because there are other differences between "use"
and "require" that you should keep in mind.
samingins@my-deja.com wrote:
>
> I wish to achieve something like the following:
>
> $module = 'my_module';
>
> use $module;
>
> As the above does not work, how can this be done? Can this be done?
>
> Thank you in advance
>
> Shane.
------------------------------
Date: Thu, 02 Sep 1999 09:15:09 +0200
From: Joerg Honerla <honerla@euenet.uni-duisburg.de>
Subject: IPC::open2 duplicates output
Message-Id: <37CE23FD.F6B70E86@euenet.uni-duisburg.de>
I've tested a simple example from the perlipc man page
use FileHandle;
use IPC::Open2;
some print statements included ....
$pid = open2( \*Reader, \*Writer, "cat -u -n" );
Writer->autoflush(); # default here, actually
print Writer "stuff\n";
$got = <Reader>;
It run's fine in the normal shell but if I start it as a cgi script,
every output written before the open2 statement including the line
"Content-type: text/html" was duplicated.
Any solution?
Joerg
--
Dr.-Ing. Joerg Honerla Bismarckst. 81
Gerhard-Mercator-University D-47048 Duisburg, Germany
Institute of Power Transmission
http://www.fb9eue.uni-duisburg.de/~hon
------------------------------
Date: 2 Sep 1999 09:53:44 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl5 sendmail
Message-Id: <37ce3b18_1@newsread3.dircon.co.uk>
Yutung Liu <ytliu@cgi-factory.com> wrote:
> Go to my source codes here
> http://www.cgi-factory.com/rankingsystem/signup.pl.txt
> then scroll down to the part starts with
> open(MAIL,"|$mail_prog -t") or &error("Unable to open the mail program.");
>
> It should give you some ideas.
>
But where is $mail_prog defined ? The use of the -t switch would imply
'sendmail' - in what way does this resolve the original posters problem?
Hmm having had a quick look at the rest of the site most of those ideas
are probably bad - I follow the "Y2K compliance" link
<http://www.cgi-factory.com/y2k.shtml>:
Y2K Compliance
The Y2K problem (Year 2000 bug or millenium bug) came about the issue of
the use of 6 digits date vs. 8 digits date in programming. In 6 digits
format, the date is stored as dd/mm/yy. In 8 digits format, the date is
stored as dd/mm/yyyy. However, our products don't store the date as the
6 digits format. Also, we have done tests on our products. We should
have close to prevent all possibles Y2K bugs.
However, if any Y2K bug is discovered on the first day of year 2000. We
guarantee that you will not need to pay any extra money for downloading
the bug fix.
Nice. However in <http://www.cgi-factory.com/messageboard/message.pl.txt>:
$ctime=time;
@months = ('January','February','March','April','May','June','July','August','September','October','November','December');
@days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime($ctime))[0,1,2,3,4,5,6];
if ($sec < 10) { $sec = "0$sec"; }
if ($min < 10) { $min = "0$min"; }
if ($hour < 10) { $hour = "0$hour"; }
if ($mday < 10) { $mday = "0$mday"; }
if ($year < 100) { $year = "19$year"; }
else {
$year=$year-100;
if ($year <10) {
$year = "200$year";
}
Its that code again. Wahay. Please dont do that. If you dont understand
the documentation for localtime please ask someone who does ...
If "CGI-Factory.com is one of the leading CGI programs providers on the web"
I hate to think what the worst are like ;-{
/J\
--
"Like Anne Robinson in a Korean restaurant, it'll be dog eat dog" -
Graham Norton
------------------------------
Date: 02 Sep 1999 11:06:29 +0200
From: Joakim Hove <hove@ido.phys.ntnu.no>
Subject: Re: Please help a newbe
Message-Id: <k0nd7w1el7u.fsf@ido.phys.ntnu.no>
jp_48504@my-deja.com writes:
> [....] I need my program to write to a
> file by creating it for a specific user after they have filled out a
> form. I need to be able to append to the end of the file and print out
> the last 20 entries made by that user. Can anyone recommend anything or
> a good source to help me find the info I need?
perldoc -f open : Will tell how to open files for various actions.
I don't know the most elegant way to implement "tail -20" in Perl, but
maybe the special variable $. which holds the current line number of
the last filehandle that was read.
HTH - Joakim
--
=== Joakim Hove www.phys.ntnu.no/~hove/ ======================
# Institutt for fysikk (735) 93637 / 352 GF | Skøyensgate 10D #
# N - 7034 Trondheim hove@phys.ntnu.no | N - 7030 Trondheim #
=====================================================================
------------------------------
Date: Thu, 02 Sep 1999 15:39:15 GMT
From: hoz@rocketmail.com (hoz)
Subject: Re: Redirecting STDERR to STDOUT (on NT)
Message-Id: <37ce997d.3072678@news.netvision.net.il>
On Wed, 1 Sep 1999 05:42:45 -0700, lr@hpl.hp.com (Larry Rosler) wrote:
>In article <37cd4a05.164028843@news.netvision.net.il> on Wed, 01 Sep
>1999 15:45:45 GMT, hoz <hoz@rocketmail.com> says...
>> >how can I redirect STDERR to STDOUT so die "string" would work
>> >correctly?
>>
>> try using eval
>
>Ah, that's the ticket! 'eval'. Hmmm, nothing happened.
>
>What on earth are you talking about?
>
I am talking about using an eval on the EXPR then catching the error
(if any) in $@. Then he could use a print. Make sense?
------------------------------
Date: Thu, 02 Sep 1999 09:36:05 +0100
From: Steff Watkins <steff.watkins@gordian.co.uk>
Subject: Re: Running a cgi from ssi
Message-Id: <37CE36F5.C8A8A6A6@gordian.co.uk>
"Stéphane Gauthier" wrote:
> I want to run a Perl CGI from a SSI (Server Side Includes) statement.
> First, the SSI statement:
> In my .SHTML page I wrote
> <!--#exec cgi="test.pl">
> I don't know if this statement is OK or if I must include the path in it
> like cgi="cgi-bin/test.pl"
Hi,
I was going to post about all the things you have to make sure are setup to
get SSis to work, but then I noticed your embedded tag. Your tag should look
like this:
<!--#exec cgi="test.pl" -->
(You missed out the hypens'--' at on the right hand side of the enclosure.)
If the script is in the webserver's cgi-bin directory, then you only need to
give the scriptname (as above) to get the script executed.
> Second, the CGI:
> Can I just use the print command to write something in my webpage or I must
> use piping?
The output of a standard print() statement will be shown on your webpage.
Hope that helps,
Steff
--------------
Steff Watkins, Systems Administrator, Gordian Knot
Steff.Watkins@gordian.co.uk http://www.SteffWatkins.co.uk/
"The near impossible I can do today. The impossible takes a little longer."
------------------------------
Date: 02 Sep 1999 11:09:04 +0200
From: Joakim Hove <hove@ido.phys.ntnu.no>
Subject: Re: SEARCH and REPLACE
Message-Id: <k0nbtblel3j.fsf@ido.phys.ntnu.no>
tvn007@my-deja.com writes:
> Would someone help me with this:
> I would like to change the following line from:
>
> sys "a-b" "c*a" "(xyz+b)"
> test "xyxx*2" "abc+2" "fcy*2"
>
> to
>
>
> $sys = '$a-$b'; '$c*$a'; '($xyz+$b)';
> $test = '$xyxx*2'; '$abc+2' ;'$fcy*2';
This seems like a mission for your editor.
--
=== Joakim Hove www.phys.ntnu.no/~hove/ ======================
# Institutt for fysikk (735) 93637 / 352 GF | Skøyensgate 10D #
# N - 7034 Trondheim hove@phys.ntnu.no | N - 7030 Trondheim #
=====================================================================
------------------------------
Date: 2 Sep 1999 08:26:09 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Simulating Carriage Returns
Message-Id: <7qlcb1$9u4$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.1237b39a1232e8e6989f0a@nntp.hpl.hp.com>:
> If the number is fewer than four digits, the year will be 999 CE, which
> is rather a bit before the Unix Epoch. localtime() cannot produce a
> year before 1901 (1900 + $f[2]).
a) What makes you think so?
b) I think this is plain wrong with contemporary Perls on
not-that-buggy OSes.
Ilya
------------------------------
Date: Thu, 2 Sep 1999 05:22:16 -0400
From: "Rodrigo Cortes" <roco3d@softhome.net>
Subject: Size in Pixels with PERL
Message-Id: <6mrz3.32$dZ.1013@maule>
How i can get the size in pixels of a image (jpg or gif)????
--
Rodrigo Cortés
ROCO3D
ICQ: 35921840
http://roco3d.cjb.net
------------------------------
Date: Thu, 2 Sep 1999 12:39:12 +0200
From: "Arjen Jansen" <ajansen@glasshouse.nl>
Subject: Re: socket timeout
Message-Id: <936268852.30877@cyperus.glasshouse.net>
Ah....
Does this mean that my problems with a timeout on connecting a socket isn't
my fault?
I have the ne ActivePerl 5.19 installed and this is what I am trying to do
(how simple can it be):
$SOCKET = IO::Socket::INET->new(
Proto => $Proto,
PeerAddr => $HostName,
PeerPort => $Port,
Timeout => 3 ) or return 0;
When trying this with a HostName/Port that simply doesn't exists it takes a
timeout of about 45 seconds. And definately not 3 seconds. Tho as far as I
can tell the socket.pm module does have code to deal with timeouts. It just
doesn't timeout.
Does anybody have any idea how to make timeouts work properly?
Arjen Jansen
fart123@my-deja.com wrote in message <7qhso2$i6j$1@nnrp1.deja.com>...
>I am having the same timeout problem with the
>latest version of IO::Socket::INET
>
>And it says this in the perldoc page:
>"Although it is not illegal, the use of MultiHomed
>on a socket which is in non-blocking mode is of
>little use. This is because the first connect will
>never fail with a timeout as the connaect call
>will not block."
>
>I suspect my problem is related to that statement,
>although I am doing a very simple single homed
>http get.
>
>I also noticed that all the code relating to
>timeouts is COMMENTED OUT OF INET.pm.
>
>I think we are S.O.L on this. I noticed that
>Net::Telnet's timeout works fine though, so I
>don't think its a lower level issue.
>
>Tim
>
>
>
>In article <37C4FC1C.3F6ED044@worldonline.nl>,
> accprob@worldonline.nl wrote:
>> GiN wrote:
>> >
>> > Hi I am having problems with my portscanner
>in PERL.
>> >
>> >
>> > while ($beginport < $maxport) {
>> > print "Scanning: $beginport\n";
>> >
>> > if ($child = fork) {
>> > sleep 4;
>> > kill 9, $child if
>$child; #
>> > this should kill the child if it takes to long
>to connect
>> > }
>> > else {
>> >
>> > if (scan($beginport))
>> > {
>> > #the socket opener
>> > print "SERVER: $target PORT:
>$beginport STATUS:
>> > open.\n";
>> > }
>> > }
>> > $beginport++;
>> > }
>> >
>> >
>> > my problem is: the loop is weird and the
>timeout/kill is not functioning wel..
>> >
>> > if you know the answer, please e-mail to :
>no-gin@dds.nl (without "no-")
>> >
>> > thanks advanced!!!
>> >
>> > --
>> > #phreak.nl http://www.casema.net/~gin
>> >
>> >
>> Install the latest IO-module from CPAN, you
>shouldnt have to use the
>> forking then, because the time-out on
>IO::Socket::INET will work.
>> --
>>
>> Daniel Kupfer -=> featuring accprob <=-
>>
>
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
------------------------------
Date: 2 Sep 1999 10:20:01 GMT
From: eric@fruitcom.com (Eric Smith)
Subject: sticky undef $/
Message-Id: <slrn7ssjqg.k25.eric@plum.fruitcom.com>
Hi
I have a for loop that nest two file reads thus:
#!/usr/bin/perl -w
for $var(1..3){
open ONE, "/home/eric/fill";
while (<ONE>) {
undef $/;
print "This is a line $_";
}
close ONE;
open TWO, "/etc/passwd";
while (<TWO>) {
$/="\n";
print "This is a line $_";
}
close TWO;
}
Now the undef for the first while read infects the second and makes the
file TWO also read in paragraph mode. A desperate attempt to redifine the
input record seperator by $/="\n" fails.
gulp ...
--
Eric Smith
eric@fruitcom.com
www.fruitcom.com
------------------------------
Date: 2 Sep 1999 10:35:57 GMT
From: eric@fruitcom.com (Eric Smith)
Subject: Re: sticky undef $/
Message-Id: <slrn7sskod.k25.eric@plum.fruitcom.com>
Oh I just saw that putitng the $/="\n"; _above the second open statement
works.
So there is the fix but I thought the $/ was set per file read, clearly
not.
please excuse the soliloquy (it was unintended).
eric@fruitcom.com (Eric Smith) posted in comp.lang.perl.misc
>
> Hi
>
> I have a for loop that nest two file reads thus:
>
> #!/usr/bin/perl -w
> for $var(1..3){
>
> open ONE, "/home/eric/fill";
> while (<ONE>) {
> undef $/;
> print "This is a line $_";
> }
> close ONE;
>
> open TWO, "/etc/passwd";
> while (<TWO>) {
> print "This is a line $_";
> }
> close TWO;
>
> }
>
> Now the undef for the first while read infects the second and makes the
> file TWO also read in paragraph mode. A desperate attempt to redifine the
> input record seperator by $/="\n" fails.
>
> gulp ...
>
> --
> Eric Smith
> eric@fruitcom.com
> www.fruitcom.com
>
--
Eric Smith
eric@fruitcom.com
www.fruitcom.com
Speak softly and carry a cellular phone.
------------------------------
Date: Thu, 2 Sep 1999 06:46:10 -0400
From: "James A Culp III" <admin@futuristic.net>
Subject: Re: sticky undef $/
Message-Id: <7qlk90$68j$1@ffx2nh3.news.uu.net>
Eric Smith <eric@fruitcom.com> wrote in message
news:slrn7ssjqg.k25.eric@plum.fruitcom.com...
:
: Hi
:
: I have a for loop that nest two file reads thus:
:
: #!/usr/bin/perl -w
use strict; ## should probably be here I came up with a few errors
which i will try to correct in my comments for you but i might miss one
or 2.
: for $var(1..3){
^
my
:
: open ONE, "/home/eric/fill";
: while (<ONE>) {
: undef $/;
local $/ = undef; ### this will only undef $/; within this
block I think that's what you want.
: print "This is a line $_";
: }
: close ONE;
:
: open TWO, "/etc/passwd";
: while (<TWO>) {
: $/="\n";
### get rid of this once you use the local $/ = undef;
: print "This is a line $_";
: }
: close TWO;
:
: }
:
: Now the undef for the first while read infects the second and makes
the
: file TWO also read in paragraph mode. A desperate attempt to redifine
the
: input record seperator by $/="\n" fails.
:
: gulp ...
:
: --
: Eric Smith
: eric@fruitcom.com
: www.fruitcom.com
:
There is an excellent article in "The Perl Journal" if you are a
subscriber it is called ... Seven Useful Uses of local. written by
Mark-Jason Dominus. If you are not a subscriber I recommend it.
http://www.tpj.com/
Hope this helps,
--
James A Culp III
Famous last words... "NT is just as stable as Linux"
------------------------------
Date: 2 Sep 1999 10:14:46 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: That Cargo Date Code ( was Re: Y2K)
Message-Id: <37ce4006_1@newsread3.dircon.co.uk>
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> Yutung Liu <ytliu@cgi-factory.com> wrote:
>>
>> if ($sec < 10) { $sec = "0$sec"; }
>
<etc>
> Oh my word !
>
> I dont know where you caut and paste that code from but I can tell you it
> was a big mistake:
>
Where *does* it come from ? A quick search on altavista threw up:
http://www.blur-online.com/programming/cgi/sendmail.htm
http://forward.com.au/freebees/passperl.htm
http://www.pangea.ca/~kolar/ftp/pstree
http://www.erehwon.org/erehwon/anonftpstat.html
(I particularly liked the cunning $year =~ s/^19// variation there )
http://ssv1.union.utah.edu/~spencer/perlscripts/mrurl.pl.txt
And that was just the first page - and still no closer to its source.
/J\
--
"Long before anyone else had decriminalized homosexuality, Ireland had
a thriving gay community. Or the clergy as they prefer to be known" -
Kevin Hayes
------------------------------
Date: Thu, 02 Sep 1999 08:04:13 +0100
From: cb <ecliptica.ww@nospam.virgin.net>
Subject: Re: Tracking progress of a Net::FTP download
Message-Id: <37CE216D.245877FB@nospam.virgin.net>
> cb <ecliptica.ww@nospam.virgin.net> wrote:
> >The Net::FTP $ftp->get() method can also take a local filename as the second,
> >so what I may try is constructing a subroutine to do the same sort of thing as
> >is being done in the lwp cookbook with $ua->request() but passing it into
> >$ftp->get(). I can't (perhaps in naivety) see any reason why that shouldn't
> >work. It's certainly worth a try, and looks a lot easier than messing about
> >with all that signal handling stuff!!
>
> As previously mentioned, this won't work simply because Net::FTP wasn't
> programmed to work this way.
>
Well thanks at least to you folks for sparing me an hour or more of fruitless
effort :-)
> I wrote a nifty little tied filehandle class that prints status messages as
> it's written to, but unfortunately Net::FTP inexplicably insists that the
> second argument to get() must be either a filename or a filehandle with an
> honest-to-God open file descriptor at the other end. So this:
>
> tie *FTPDEST, 'TrackFTP', 'local_file';
> $ftp->get("remote_file", \*FTPDEST);
>
> ...won't work.
>
> I'm of the opinion that Net::FTP ought to meekly accept any glob ref I pass
> it as a second parameter, and simply write to it without doing any further
> checking of its own. Is anyone who's reading this in a position to do
> anything about it, and do they agree or disagree? Or should I take this to
> c.l.p.modules?
I'll have a mess about with it today, although I'm not sure I want to get involved
in twiddling about with the guts of Net::FTP .... and certainly it does everything
I want in terms of negotiating access with the remote host etc ... but most of what
I'm trying to download consists of files of several megabytes, and some kind of
progress checking is essential as the link is far from rock-solid.
For some reason the remote server doesn't seem to understand the third parameter
(offset from start of file) which $ftp->get() takes to enable restoration of broken
downloads. Does anyone have previous experince of that, or am I making some
elementary coding goof:
$ftp->get($remote_file, $local_file, 1234567) or die "blah blah blah\n";
to start downloading at offset 1234567
Thanks for any help or suggestions ....
Cheers ... CB ...
------------------------------
Date: Thu, 02 Sep 1999 03:14:14 -0500
From: George Taylor <cain@datasync.com>
Subject: Re: Using split on a variable
Message-Id: <37CE31D6.C2695308@datasync.com>
Ordering the books now. Thanks
Sam Holden wrote:
> On Thu, 02 Sep 1999 00:50:19 -0500, George Taylor <cain@datasync.com> wrote:
> >Is is possible to "split" a variable in perl?
>
> Yes.
>
> >This is my attempt thus
> >far.
> >
> >@varione = split {/./, {$ENV'REMOTE_HOST'}};
>
> Wrong in a number of ways... post code that actually compiles instead of just
> giving error messages and someone might help you with your misunderstanding
> of split and '.' and how to call a function in perl...
>
> I suggest reading the documentation that comes with perl. There are some
> examples that use split (in the documentation about split strangely enough),
> they are different then how you use split. Who do you think is likely to be
> right? You, or the documentation? Learn how to read and then read
> the documentation and then ask if you still can't get it to work...
>
> --
> Sam
>
> compiling kernels is what I do most, so they do tend to stick to the
> cache ;) --Linus Torvalds
------------------------------
Date: Thu, 02 Sep 1999 07:36:16 GMT
From: lg@kt.dtu.dk (Lars Gregersen)
Subject: Re: write to a file in a loop
Message-Id: <37ce2827.859916140@news.dtu.dk>
On Mon, 30 Aug 1999 12:44:10 -0400, Lakmal Jinadasa <lakmal@ml.com>
wrote:
>Hi,
>
>I have the following problem.
>
>I open a file within a foreach loop
>then try to write some data to the file.
Move the "open..." statement outside of the innerloop
>foreach $key1(@list1)
open the file here, remember to use different file names.
> foreach $key2 (@list2) {
# do do this> open DAT ">File_Name";
> @arr = output_of _a function;
> print DAT @arr;
> }
>close (DAT);
>}
>
>Seperate file is created for each key1.key2
Lars
------------------------------
Lars Gregersen (lg@kt.dtu.dk)
http://www.gbar.dtu.dk/~matlg
------------------------------
Date: 2 Sep 1999 09:36:35 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Y2K
Message-Id: <37ce3713_1@newsread3.dircon.co.uk>
Yutung Liu <ytliu@cgi-factory.com> wrote:
>
> $timenow=time();
> @months =
> ('January','February','March','April','May','June','July','August','Septembe
> r','October','November','December');
> @days =
> ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
> ($sec,$min,$hour,$mday,$mon,$year,$wday) =
> (localtime($timenow))[0,1,2,3,4,5,6];
> if ($sec < 10) { $sec = "0$sec"; }
> if ($min < 10) { $min = "0$min"; }
> if ($hour < 10) { $hour = "0$hour"; }
> if ($mday < 10) { $mday = "0$mday"; }
> if ($year < 100) { $year = "19$year"; }
> else
>
> $year=$year-100;
> if ($year <10) {
> $year = "200$year";
> }
> }
> $date = "$days[$wday], $months[$mon] $mday, $year";
> $time = "$hour:$min:$sec";
>
Oh my word !
I dont know where you caut and paste that code from but I can tell you it
was a big mistake:
$year += 1900;
In all cases. Please read the perlfunc entry for localtime.
Also what you are doing with the leading zeroes is pointless - you should
look at the sprintf documentation:
$sec = sprintf("%.02d",$sec);
/J\
--
"Malcolm, what have I told you about putting chocolate near your
crotch?" - Mrs Merton
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 701
*************************************