[10811] in Perl-Users-Digest
Perl-Users Digest, Issue: 4412 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Dec 13 03:07:29 1998
Date: Sun, 13 Dec 98 00:00:30 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 13 Dec 1998 Volume: 8 Number: 4412
Today's topics:
"Require" and OOP <sadesai@princeton.edu>
($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/) (Emmett McLean)
Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/) (Matthew Bafford)
Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/) (Emmett McLean)
Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/) <rick.delaney@home.com>
Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/) <chobbs@silvervalley.k12.ca.us>
Re: Beginner Book? (terry hinds)
Re: CGI Varaible: REMOTE_USER <bg@jojo.in-berlin.de>
Re: Date <Allan@Due.net>
Re: Diagnostic Scrolls by (terry hinds)
Re: ls -l in perl? (Emmett McLean)
New to perl - pattern matching question <jsavarino@jps.net>
Re: New to perl - pattern matching question (Matthew Bafford)
Re: New to perl - pattern matching question <rick.delaney@home.com>
Newbie Question <absent@DIE_SPAMMERamug.org>
Perl & File Locking <support@counter.w-dt.com>
Re: Perl & File Locking (Mark-Jason Dominus)
send e-mail by port 25 in Perl !!! HELPME !!!!! BondMac@hotmail.com
Re: send e-mail by port 25 in Perl !!! HELPME !!!!! (Ethan H. Poole)
Silly newbie question about net::ftp... DrDreff@my-dejanews.com
Re: Silly newbie question about net::ftp... (Jeffrey Drumm)
Re: Silly newbie question about net::ftp... <mdavis@jps.net>
Re: Stripping of the _ ()
Time for comp.lang.perl.win32? <pasha@actcom.co.il>
Re: Time for comp.lang.perl.win32? (Ethan H. Poole)
Re: unlinking files from Perl CGI under Apache (Emmett McLean)
What is next book to read after Learning PERL ? sofianb@my-dejanews.com
Re: Why Is Perl not a Language? <dgris@moiraine.dimensional.com>
Re: Why Is Perl not a Language? (Bbirthisel)
Re: Writing Perl with Notepad <spamsux-tex@habit.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 10 Dec 1998 22:34:36 -0500
From: Sameet Desai <sadesai@princeton.edu>
Subject: "Require" and OOP
Message-Id: <367092CC.151FBC19@princeton.edu>
This may be a simple oversight on my part, but I seem to be having a
hard time calling a custom library function(which I imported with
require "library_file.pl") from within a class. I tried using
"Main::&function_name" and "&Main::function_name" but neither seems to
work...
Thanks a lot!
--JZ
------------------------------
Date: 12 Dec 1998 18:54:15 -0800
From: emclean@slip.net (Emmett McLean)
Subject: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/)
Message-Id: <74va8n$i5e@slip.net>
Hi,
The code below :
($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/)
is supposed to check that an $email is
of the form aaa@somedomain.xxx but
returns true even if
$e_mail="ok.com" .
I didn't write code.
So I have two questions :
1. What does the minus sign in the brackets do ?
and
2. Does anyone have a suggested modification?
Thanks,
Emmett
------------------------------
Date: Sat, 12 Dec 1998 22:09:23 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/)
Message-Id: <MPG.10dcf9f054a5d24998975c@news.scescape.net>
In article <74va8n$i5e@slip.net>, emclean@slip.net says...
=> Hi,
Hi,
You might want to check the documentation that comes with Perl. Try
doing:
perldoc perl
perldoc perltoc
perldoc perlfaq
perldoc perlre
=> The code below :
=>
=> ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/)
=>
=> is supposed to check that an $email is
=> of the form aaa@somedomain.xxx but
=> returns true even if
Actually, it checks that $e_mail doesn't contain:
1 or more word characters
followed by 0 or more -'s or word characters
followed by a @
followed by 1 or more word characters
followed by 0 or more -'s or word characters
followed by a .
followed by 1 or more word characters
To check for a ``valid'' [1] email address, change it to:
$e_mail =~ /^\w+[-\w]*\@\w+[-\w]*\.\w+$/
=> $e_mail="ok.com" .
=>
=> I didn't write code.
Why aren't you asking the person who _did_ write it?
=> So I have two questions :
=>
=> 1. What does the minus sign in the brackets do ?
Matches a '-'.
=> and
=>
=> 2. Does anyone have a suggested modification?
Yeah.
=> Thanks,
HTH!
=> Emmett
--Matthew
[1] Where valid is your definition of valid. For more info, search
DejaNews.
------------------------------
Date: 12 Dec 1998 22:10:03 -0800
From: emclean@slip.net (Emmett McLean)
Subject: Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/)
Message-Id: <74vlnr$r14@slip.net>
Thanks very much for the tip Matthew.
Matthew Bafford <dragons@scescape.net> wrote:
>
>You might want to check the documentation that comes with Perl.
To be fair, I spent a half hour going through Larry Wall's
"Programming Perl" before posting. Reading the Perl doc would not
have helped because I thought the minus sign had a special meaning
like a plus sign.
>
>1 or more word characters
>followed by 0 or more -'s or word characters
>followed by a @
>followed by 1 or more word characters
>followed by 0 or more -'s or word characters
>followed by a .
>followed by 1 or more word characters
>
>To check for a ``valid'' [1] email address, change it to:
>
>$e_mail =~ /^\w+[-\w]*\@\w+[-\w]*\.\w+$/
>
Thanks for the helpful analysis.
So you added a ^ to the beginning and a $ to the end.
So I'm not clear on how what Matt posted is any better than
what was there before. Aside from adding the expicit begin
and end, is it?
This doesn't fix the problem I mentioned in my post
that ok.com appears to be a valid mail address while
ok@ok.com does not. At least don't I think so.
When I step through the code with the perl debuger with $email="ok.com"
I get :
DB<5> p ($e_mail !~ /^\w+[-\w]*\@\w+[-\w]*\.\w+$/)
1
DB<6> p $e_mail
ok.com
So ok.com, returning a 1, appears to be a valid E-mail address
(which is not what is desired ).
while with ok@ok.com I get :
DB<7> p ($e_mail !~ /^\w+[-\w]*\@\w+[-\w]*\.\w+$/)
DB<8> p $e_mail
So ok@ok.com, returning a null, appears to be an invalid E-mail
address (which is not what is desired).
So it is nice there are different answers but it would seem to me
that the first case should return null while the second should return 1.
In other words, why do I have to negate the result to get the desired
answer?
>
>Why aren't you asking the person who _did_ write it?
Because I don't know for certain who it was. It is one of
serveral people, a few of which prefer not to be bothered.
Isn't this a forum for asking questions about Perl?
Thanks!
Emmett
------------------------------
Date: Sun, 13 Dec 1998 06:54:37 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/)
Message-Id: <3673665B.5D97F64E@home.com>
[posted & mailed]
Emmett McLean wrote:
>
> Thanks very much for the tip Matthew.
>
> Matthew Bafford <dragons@scescape.net> wrote:
> >
> >You might want to check the documentation that comes with Perl.
>
> To be fair, I spent a half hour going through Larry Wall's
> "Programming Perl" before posting.
An entire half hour? You would have waited a lot longer for an answer
had Matthew not been so quick.
> Reading the Perl doc would not have helped because I thought the minus
> sign had a special meaning like a plus sign.
If you had read the docs you would have found that to be untrue (except
for specifying ranges in character classes).
When you have questions about regexes, you should *always* consult
perlre, although I think the Camel lists the special characters and
should have been sufficient to answer your question.
> >
> >$e_mail =~ /^\w+[-\w]*\@\w+[-\w]*\.\w+$/
^^
> >
>
> Thanks for the helpful analysis.
>
> So you added a ^ to the beginning and a $ to the end.
He also changed the binding operator.
> DB<5> p ($e_mail !~ /^\w+[-\w]*\@\w+[-\w]*\.\w+$/)
^^
> 1
> DB<6> p $e_mail
> ok.com
>
> So ok.com, returning a 1, appears to be a valid E-mail address
> (which is not what is desired ).
>
> while with ok@ok.com I get :
>
> DB<7> p ($e_mail !~ /^\w+[-\w]*\@\w+[-\w]*\.\w+$/)
^^
>
> DB<8> p $e_mail
>
> So ok@ok.com, returning a null, appears to be an invalid E-mail
> address (which is not what is desired).
[...]
> In other words, why do I have to negate the result to get the desired
> answer?
Because you negated it in the first place.
perldoc perlop
> Isn't this a forum for asking questions about Perl?
It is indeed, but you will still almost always be pointed towards the
docs because once you start using them effectively you will find your
answers there faster than on Usenet.
The pointers are meant to be helpful despite the cold, impersonal tone
that comes through from plain text.
Have some smileys on me.
:-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-)
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Sat, 12 Dec 1998 22:46:59 -0800
From: Chris Hobbs <chobbs@silvervalley.k12.ca.us>
Subject: Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/)
Message-Id: <367362E3.51DE57A7@silvervalley.k12.ca.us>
Emmett McLean wrote:
> So I'm not clear on how what Matt posted is any better than
> what was there before. Aside from adding the expicit begin
> and end, is it?
You missed the most important change he made then...
Matthew Bafford wrote:
Actually, it checks that $e_mail doesn't contain
^^^^^^^
Emmett's code:
$e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/
Matthew's code:
$e_mail =~ /^\w+[-\w]*\@\w+[-\w]*\.\w+$/
^^
||
HTH,
Chris
------------------------------
Date: Sun, 13 Dec 1998 13:05:50 +0900
From: terry577@aol.com (terry hinds)
Subject: Re: Beginner Book?
Message-Id: <terry577-1312981305500001@cs11k30.ppp.infoweb.ne.jp>
I think the underlying concept is that in most of the books The Llama, The
Camel and of course the PODs you do need a C manual if you don't come from
a SED/AWK/C background, to be able to get explainations of the parts, that
instead of actually attempting to define anything say
"Just like the C function" or "just like in C" or "not like in C",
Of course the stock reply whenever somebody mentions this is:
"You're perfectly welcome to submit addtions to the docs"
and of course nobody does. Ah, habits - they make us feel safe in the
chaos that is reality.
In article <74ptge$hnr$1@srv38s4u.cas.org>, lvirden@cas.org wrote:
> On the other hand, telling someone that before they can do what they want
> (write programs in perl) they need to learn C, awk, and Bourne shell,
> as well as learn how to program, seems a bit much, does it not?
>
> It just seems a shame that perl keeps being pushed into a category of
> 'only really useful for someone with extension unix programming background'.
------------------------------
Date: Sat, 12 Dec 1998 22:47:24 +0100
From: Bernhard Graf <bg@jojo.in-berlin.de>
Subject: Re: CGI Varaible: REMOTE_USER
Message-Id: <3672E46C.D4467AF@jojo.in-berlin.de>
John Wang wrote:
> I did a very simple web site with Apache on a HP/UX 10.20. I
> require user entering a password, using basic authentication, htpasswd.
> What I want to do is to let the user change their own password. The
> first thing I need to do is to figure out who just logged onto the web.
> From the two books I have Apache Server Bible and CGI Programming on the
> WWW, there is a CGI variable, REMOTE_USER. It seems that that is what I
> want. It says if you have basic authentication, the variable will be
> set. Well, it did not get set. I wrote a little script to display
> everything in %ENV, REMOTE_USER is not there, it has REMOTE_ADDR. Now,
> I am stuck. If I cannot even figure out who is on, how am I going to
> change the password.
see Apache Docs - FAQ question 47
Ciao
--
Bernhard Graf <bg@jojo.in-berlin.de>
------------------------------
Date: 13 Dec 1998 02:08:10 GMT
From: "Allan M. Due" <Allan@Due.net>
Subject: Re: Date
Message-Id: <74v7ia$g49$0@206.165.167.231>
Federico Roisman wrote in message <36730074.13969BEF@statics.com.ar>...
|I'm executing a script for obtaining a Date , but I obtain month 11 in
|place of 12 (This month)
|
|The script is this:
|
| ($seconds, $minutes, $hour, $day, $month) = localtime;
| print "$month/$day\n";
|
|I thank if anyone can help me.
perldoc -f localtime. It behaves as documented, ranging from 0 to 11.
Please do search in Dejanews, there must be 100 references to this by now.
Is this a FAQ yet?
AmD
------------------------------
Date: Sun, 13 Dec 1998 12:46:27 +0900
From: terry577@aol.com (terry hinds)
Subject: Re: Diagnostic Scrolls by
Message-Id: <terry577-1312981246270001@cs11k30.ppp.infoweb.ne.jp>
Nothing to do with perl but I couldn't resist this:
> gemhound@gemhound.com wrote:
> Before that, JavaScript was defined as "whatever Netscape did", and their
> implementation often didn't work the way it was documented
> IE's JScript often worked along with the documentation, and scripts that
> worked in it would break in Netscape.
It's for precisely that reason JavaScript isn't seriously worth
considering as anything but a novelty, and certainly not a viable option
for web programming in an environment where you come into contact with so
many different browser types, unlike perl (back on topic) which will work
as long as you avoid using non standard HTML or other
> For web purposes, Java 1.1 broke Java far worse than anything Microsoft
> ever did by not allowing 1.1 programs to run in 1.0 virtual machines
Wasn't it the same Microsoft that recently lost a court case to Sun where
the ruling was that Microsoft had to remove all non standard API's from
it's java orientated/based software? But then I guess the *other* court
case got more publicity.
AS far as I'm concerned the whole way Java was dealt with is the very
reason I'm learning Perl now. Unlike Java some of the fundamentals are a
lot more friendly
- people don't try to copyright every comma they write and portabilty is
the prime consideration.
- source code is easily available as is reliable information rather than a
plethora of "Java Doods Way Cool Java In 3.5 Seconds Info Pill" attempts
by self appointed gurus trying to cash in on their full 3 months
experience.
all in all whatever the technical merits and detractions of (nominally)
JavaScript/Java Vs Perl (which I think have been well discussed in
previous postings, though not necessarily all in the same thread) - I
think as far as cutting through the bull and getting down to solutions
that work, perl does it for me.
------------------------------
Date: 12 Dec 1998 22:35:34 -0800
From: emclean@slip.net (Emmett McLean)
Subject: Re: ls -l in perl?
Message-Id: <74vn7m$rtb@slip.net>
How about :
@ls = qx/ls -l/;
Emmett
------------------------------
Date: Sat, 12 Dec 1998 19:09:41 -0800
From: Jim Savarino <jsavarino@jps.net>
Subject: New to perl - pattern matching question
Message-Id: <36732FF5.57F2F6CB@jps.net>
Hi folks,
I am following along in the book "Perl5 for Windows NT in 21 days"
(correcting the books errors along the way)
an integer checking routine was given using
if ($number =~ /^[-?\d]+$/) (to check for integers and)
if ($number =~ /^-?0[xX][\da-fA-F]+$/) (to check for hex integers)
I wanted to split out octal integers from the first condition so I
added [^0] to the integer pattern:
if ($number =~ /^[-?[^0][\d]+$/)
can someone please tell me what's wrong with the above? I thought the
[^0] would ensure that no zero could follow the optional minus sign.
Thanks.
--
Jim Savarino
http://songs.com/jims
------------------------------
Date: Sat, 12 Dec 1998 22:33:21 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: New to perl - pattern matching question
Message-Id: <MPG.10dcff8d7746685498975d@news.scescape.net>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <36732FF5.57F2F6CB@jps.net>, jsavarino@jps.net says...
=> Hi folks,
=>
=> I am following along in the book "Perl5 for Windows NT in 21 days"
Ugh.
=> (correcting the books errors along the way)
Hmm, that's always a comforting statement... :-)
=> an integer checking routine was given using
=>
=> if ($number =~ /^[-?\d]+$/) (to check for integers and)
Real meaning:
Check to see if $number is one or more of the following characters:
-?0987654321
Maybe the book really says (or meant to say):
if ( $number =~ /^-?\d+$/ )
Which means:
Check to see if $number is only digits (ie: 1234567890), possibly
prefixed with a -.
A better version would be:
if ( $number =~ /^[-+]?\d+$/ )
Which allows for a + or a - at the beginning.
=> if ($number =~ /^-?0[xX][\da-fA-F]+$/) (to check for hex integers)
Now that looks right.
=> I wanted to split out octal integers from the first condition so I
=> added [^0] to the integer pattern:
=>
=> if ($number =~ /^[-?[^0][\d]+$/)
Close, but not quite there. This has two problems. One very obvious
one, and one much more subtle one.
The obvious problem is the extra [ at the beginning of the regex.
As for the more subtle one:
If you know $number only contains [+-0987654321], then you can use:
if ( $number =~ /^[-+]?[^0]\d+$/ )
But, since we are using this regex, it's obvious we don't know what
$number contains... :)
The problem in that case is that [^0]. If you read it literally (the
only way to read regexs), you see:
Match ANY character, as long as it isn't a 0.
Not quite what we want, since it makes -D43 perfectly valid.
So, to match a number that doesn't start with 0 (but can start with a
plus or a minus), we can do:
if ( $number =~ /^[-+]?[123456789]\d+$/ )
Or, if you don't mind a little bit of confusion, use a double negation.
Since \D means:
Any character except for 0987654321
or
[^\d]
we can do this:
if ( $number =~ /^[-+]?[^\D0]\d+$/ )
where the [^\D0] translates to:
Match any character that isn't a non digit or a 0.
Or, to put it a little more clearly:
Match any digit that isn't a 0
which is, I think, exactly what you wanted.
That usage can be a bit hard to understand at first, though.
=> can someone please tell me what's wrong with the above? I thought the
=> [^0] would ensure that no zero could follow the optional minus sign.
=>
=> Thanks.
You might be interested in:
http://language.perl.com/all_about/index.html
specifically:
http://language.perl.com/CPAN/doc/FMTEYEWTK/is_numeric.html
Hope This Help(s|ed)!
=> Jim Savarino
--Matthew
------------------------------
Date: Sun, 13 Dec 1998 04:20:37 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: New to perl - pattern matching question
Message-Id: <36734252.80162348@home.com>
[posted & mailed]
Matthew Bafford wrote:
>
> we can do this:
>
> if ( $number =~ /^[-+]?[^\D0]\d+$/ )
>
This won't match single digit numbers. Changing \d+ to \d* will help,
but will still not match 0. OWTDI:
$number =~ /^[-+]?(?!0\d)\d+$/;
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Sat, 12 Dec 1998 21:02:52 -0700
From: E Brown <absent@DIE_SPAMMERamug.org>
Subject: Newbie Question
Message-Id: <36733C6C.B5A001F@DIE_SPAMMERamug.org>
I'm trying to type examples out of a book and i can't
figure out what the syntax of these type of routines are:
#!/usr/bin/perl
use 'Getopt::Std';
now, around Getopt::Std, are those ticks? single quotes?
i think i've tried every combination possible
`Getopt::Std' (<tick>Getopt::Std<single-quote>)
'Getopt::Std' (<single-quote>Getopt::Std<single-quote>)
,etc....
what's the deal?
by the way, i don't know if this matters, but i'm using a 'Window95'
style keyboard with Linux on a intel machine, and i've seen funny things
happen between my machine and keyboard in the past.
Please help.
*Responses by email are appreciated absent@DELETE_MEamug.org
Thanks in advance
------------------------------
Date: Sat, 12 Dec 1998 20:08:56 -0600
From: Mike <support@counter.w-dt.com>
Subject: Perl & File Locking
Message-Id: <367321B7.7CE44FC1@counter.w-dt.com>
When someone loads a perl program and pushes stop in there browser does
the perl program continue to run till it is done or does it die. I was
wondering because if it dies what about the file locking routines? Like
Below.
sub lock {
$LOCKFILE = ("$temp_dir/$lockad");
if (-e $LOCKFILE) {
while (-e $LOCKFILE) {
select(undef,undef,undef,0.1); #wait for .1 second
}
}
open (LOCK,">$LOCKFILE") || &erroropen;
print (LOCK "busy");
close (LOCK);
}
sub unlock {
$LOCKFILE = ("$temp_dir/$lockad");
if (-e $LOCKFILE) {
unlink ($LOCKFILE);
}
}
------------------------------
Date: 13 Dec 1998 01:52:51 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Perl & File Locking
Message-Id: <74vo83$lf0$1@monet.op.net>
In article <367321B7.7CE44FC1@counter.w-dt.com>,
Mike <support@counter.w-dt.com> wrote:
>When someone loads a perl program and pushes stop in there browser does
>the perl program continue to run till it is done or does it die.
Hard to know; it depends on details of the browser and the server.
>I was wondering because if it dies what about the file locking
>routines? Like Below.
Those don't work anyway, so I doubt that the stop button is going to
intoduce any additional problems.
You should use the perl built-in `flock' function. If you do, then
your program will release the lock automatically when it is destroyed.
------------------------------
Date: Sun, 13 Dec 1998 05:11:43 GMT
From: BondMac@hotmail.com
Subject: send e-mail by port 25 in Perl !!! HELPME !!!!!
Message-Id: <74viaf$2tc$1@nnrp1.dejanews.com>
HI, help me please whith one script in perl what send one mail by port 25 by
the server SMTP is other machine (Sun1), where run the script is other Sun2
!!! Iam have perl 5.001m !! please helpme ... Urls ????????
one Student of Chile
Jaime!!!
my SO is Solaris 2.5.1 (Sun)
Thanks
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sun, 13 Dec 1998 07:28:58 GMT
From: ehpoole@ingress.com (Ethan H. Poole)
Subject: Re: send e-mail by port 25 in Perl !!! HELPME !!!!!
Message-Id: <_0Kc2.110$Qg1.554@news12.ispnews.com>
[Posted and Emailed] In article <74viaf$2tc$1@nnrp1.dejanews.com>,
BondMac@hotmail.com says...
>
>HI, help me please whith one script in perl what send one mail by port 25 by
>the server SMTP is other machine (Sun1), where run the script is other Sun2
>!!! Iam have perl 5.001m !! please helpme ... Urls ????????
Step One: Upgrade Perl (5.001? Come on now, how many years old is that?)
The remainder is just a matter of using sockets (use Socket) for
bidirectional communication on port 25.
--
Ethan H. Poole | Website Design and Hosting,
| CGI Programming (Perl & C)..
========Personal=========== | ============================
* ehpoole @ ingress . com * | --Interact2Day--
| http://www.interact2day.com/
------------------------------
Date: Sun, 13 Dec 1998 02:03:21 GMT
From: DrDreff@my-dejanews.com
Subject: Silly newbie question about net::ftp...
Message-Id: <74v79a$qes$1@nnrp1.dejanews.com>
I have this semi stupid problem.
I need to check the modification times of files on an ftp server.
I can get the files with out any problems...
the $ftp->mdtm($source); in the following code always returns null.
what am I donig wrong?
@files = $ftp->("*.html");
foreach (@files)
{
if (/^\./)
{
print("Ignoring $_\n");
}
else
{
$source = $_;
s/\;.*$//;
$status = $ftp->get($source, $_);
if ($status)
{
$ftp_time=$ftp->mdtm($source);
print "$ftp_time";
$ftp->delete($source) || print("Could not delete $source\n");
}
else
{
print("Directory ignored\n");
}
}
}
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sun, 13 Dec 1998 02:59:53 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: Silly newbie question about net::ftp...
Message-Id: <36732867.1568734@news.mmc.org>
[posted and mailed]
On Sun, 13 Dec 1998 02:03:21 GMT, DrDreff@my-dejanews.com wrote:
>I have this semi stupid problem.
>
>I need to check the modification times of files on an ftp server.
>
>I can get the files with out any problems...
>the $ftp->mdtm($source); in the following code always returns null.
>
>what am I donig wrong?
>
>@files = $ftp->("*.html");
@files = $ftp->ls("*.html");
>foreach (@files)
>{
> if (/^\./)
> {
> print("Ignoring $_\n");
> }
> else
> {
> $source = $_;
> s/\;.*$//;
Not sure why you're doing the above, unless you're expecting something
other than files and directories from the ls() method; maybe you're using
dir()?
> $status = $ftp->get($source, $_);
> if ($status)
> {
> $ftp_time=$ftp->mdtm($source);
> print "$ftp_time";
The crux of the matter is that since Net::FTP includes the mdtm() method,
everyone automatically assumes that all FTP servers support it. In
actuality, I'd say the majority of FTP servers in existence today *don't*
support the MDTM function. Your only alternative is to attempt to parse the
output from dir() into something you can recognize as a date.
Oh, and when you've found a server that _has_ implemented this, the usual
return value from the mdtm() method is the number of seconds since the Unix
epoch, and not anything you would immediately recognize as a time/date
string. The localtime() and gmtime() functions can help you out there,
though.
(snip)
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center Information Services
420 Cumberland Ave, Portland, ME 04101
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me
------------------------------
Date: Sat, 12 Dec 1998 20:22:42 -0800
From: "Mark Davis" <mdavis@jps.net>
Subject: Re: Silly newbie question about net::ftp...
Message-Id: <3673410a.0@blushng.jps.net>
Jeffrey Drumm wrote in message <36732867.1568734@news.mmc.org>...
>@files = $ftp->ls("*.html");
>
uhh... yeah, that's what I meant... :)
>The crux of the matter is that since Net::FTP includes the mdtm() method,
>everyone automatically assumes that all FTP servers support it. In
>actuality, I'd say the majority of FTP servers in existence today *don't*
>support the MDTM function. Your only alternative is to attempt to parse the
>output from dir() into something you can recognize as a date.
Ok... back to that then. Is there an easy test I can use to see if the
server supports MDTM?
>
>Oh, and when you've found a server that _has_ implemented this, the usual
>return value from the mdtm() method is the number of seconds since the Unix
>epoch, and not anything you would immediately recognize as a time/date
>string. The localtime() and gmtime() functions can help you out there,
>though.
That is one of the many things I tried earlier. If the server is not
supporting it...
------------------------------
Date: 13 Dec 1998 07:07:18 GMT
From: hdiwan@diwanh.stu.rpi.edu ()
Subject: Re: Stripping of the _
Message-Id: <slrn776ppv.5fr.hdiwan@diwanh.stu.rpi.edu>
In article <74ukvn$73v@sjx-ixn6.ix.netcom.com>, E-swap wrote:
>I need to know if there is a simple line of code which will allow me to
>strip out a _ and replace with a space when I am displaying something. Also
>to put it back in if I need to elsewhere.
$str=s/_/\s/; # for replacement
print $str;
--
Hasan Diwan
------------------------------
Date: Sun, 13 Dec 1998 08:31:20 +0200
From: Pasha Zusmanovich <pasha@actcom.co.il>
Subject: Time for comp.lang.perl.win32?
Message-Id: <36735F38.AF12CDED@actcom.co.il>
More and more win32 people these days satisfy their computing needs with
perl. And this is good.
The volume of win32-specific discussion in all perl groups seems to be
sufficiently large. IMHO this should be done in a separate group. I
think that people using just a standrad perl (or its unix incarnation),
are not interested in discussions about Win32::OLE package or subtle
differences between various win32 perl ports.
Just a suggestion.
--
Pasha Zusmanovich -------o x x "What i tell you three times is true."
pasha@actcom.co.il o o x L.Carroll, "The Hunting of the Snark"
www.actcom.co.il/~pasha x x o---------------------------------------
------------------------------
Date: Sun, 13 Dec 1998 07:43:13 GMT
From: ehpoole@ingress.com (Ethan H. Poole)
Subject: Re: Time for comp.lang.perl.win32?
Message-Id: <leKc2.111$Qg1.554@news12.ispnews.com>
In article <36735F38.AF12CDED@actcom.co.il>, pasha@actcom.co.il says...
>
>More and more win32 people these days satisfy their computing needs with
>perl. And this is good.
>
>The volume of win32-specific discussion in all perl groups seems to be
>sufficiently large. IMHO this should be done in a separate group. I
>think that people using just a standrad perl (or its unix incarnation),
>are not interested in discussions about Win32::OLE package or subtle
>differences between various win32 perl ports.
As a Win32 user, I would disagree.
While many users indicate they are using a Win32 port of Perl, *most* of
their questions are not platform specific and, as such, do not justify a
seperate newsgroup.
As for questions about the Win32::* series of modules (there are really only
a few commonly used Win32 modules), comp.lang.perl.modules isn't exactly over
taxed at the moment.
Users who come across the occassional Win32::* module thread which is of no
interest to them are no more or less inconvenienced than those coming across
a DBI module thread which may or may not be of interest to the them as well.
For most applications, there is sufficiently little difference between Perl
on a Win32 platform and Perl on a UNIX platform. The only likely result of
splitting clpm into clpw32 would be constant crossposting between the Win32
group and the misc group. I don't see how that would be of any benefit to
either set of participants.
PS-FWIW, I visit this group daily and there are numerous days with *no* Win32
specific threads, so I'm a little puzzled as to where this "sufficiently
large volume" statement is coming from. Creating a group for the sake of
creating a group and nothing more does little to benefit the community at
large.
--
Ethan H. Poole | Website Design and Hosting,
| CGI Programming (Perl & C)..
========Personal=========== | ============================
* ehpoole @ ingress . com * | --Interact2Day--
| http://www.interact2day.com/
------------------------------
Date: 12 Dec 1998 18:56:44 -0800
From: emclean@slip.net (Emmett McLean)
Subject: Re: unlinking files from Perl CGI under Apache
Message-Id: <74vadc$ihk@slip.net>
The source of the problem was permissions
which had been set on directories higher
up in the directory tree.
I learned from both posts.
Thanks for the help everyone.
Emmett
------------------------------
Date: Sun, 13 Dec 1998 03:56:44 GMT
From: sofianb@my-dejanews.com
Subject: What is next book to read after Learning PERL ?
Message-Id: <74vdts$vh5$1@nnrp1.dejanews.com>
Hello! My name is Budi Sofian. I've just finished reading "Learning PERL". I
need recommendations for the next book to read. I have searched through the
web and found "Programming PERL" and "CGI/PERL Cookbook" interesting, but I
could not decide which one I should get. Or probably there are other books
which are better than these two.
By the way, my purpose of learning PERL is for CGI programming and I have
programming experience previously (FORTRAN 77).
Please send me your recommendation. Your help is highly appreciated.
Regards,
Budi Sofian
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 12 Dec 1998 19:16:37 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Why Is Perl not a Language?
Message-Id: <m3hfv0pz0a.fsf@moiraine.dimensional.com>
bart.lateur@skynet.be (Bart Lateur) writes:
> *My* Perl "programs" usually don't have a user interface. Just a command
> line.
A command line isn't an interface?
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: 13 Dec 1998 03:17:54 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: Why Is Perl not a Language?
Message-Id: <19981212221754.01478.00001403@ng-fq1.aol.com>
Hi Thomas:
>ps. Why is the perl mascot a camel? (Versatility?)
>From Programming Perl, 1st edition, p. xxi:
"But blame Larry for wanting a camel"
And from Larry's example on p. 73, attributed to C.S. Lewis:
"All things (e.g. a camel's journey through
A needle's eye) are possible, it's true.
But picture how the camel feels, squeezed out
In one long bloody thread, from tail to snout."
-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)
------------------------------
Date: Sat, 12 Dec 1998 18:05:52 +0000
From: Austin Schutz <spamsux-tex@habit.com>
Subject: Re: Writing Perl with Notepad
Message-Id: <3672B080.127C@habit.com>
> => for script writing? I have a class of high school students and using
> => vi is like pulling teeth.
>
You could use pico, which comes with pine. It's very simple
and doesn't have any arbitrary 64k limit like notepad. You also won't
have to futz around with line breaks.
Austin
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4412
**************************************