[22540] in Perl-Users-Digest
Perl-Users Digest, Issue: 4761 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 25 18:06:03 2003
Date: Tue, 25 Mar 2003 15:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 25 Mar 2003 Volume: 10 Number: 4761
Today's topics:
Re: Algorithm for Text Subsets <delautenschl@[nospam]wisc.edu>
Re: Algorithm for Text Subsets <delautenschl@[nospam]wisc.edu>
Re: Algorithm for Text Subsets (Anno Siegel)
Building Perl 5.6.1 on AIX 5.1 (Gena Storhotz)
CGI.pm or roll-your-own? <usrsa@racquettech.com>
Re: CGI.pm or roll-your-own? <tony_curtis32@yahoo.com>
Re: CGI.pm or roll-your-own? <please@no.spam>
Re: CGI.pm or roll-your-own? <usrsa@racquettech.com>
Re: CGI.pm or roll-your-own? <emschwar@yahoo.com>
Re: CGI.pm or roll-your-own? <flavell@mail.cern.ch>
Re: CGI.pm or roll-your-own? <me@privacy.net>
Re: Editor with Perl as macro language? <nwzmattXX@XXnetscape.net>
File integrity while using "tie" <ethan@draupnir.gso.saic.com>
Re: File integrity while using "tie" <noreply@gunnar.cc>
Re: File integrity while using "tie" <ethan@draupnir.gso.saic.com>
Re: General goodness (strict, warnings and diagnostics? <noemail@nowhere.net>
How to get images etc to client via CGI. (Ian Pellew)
Re: How to get images etc to client via CGI. <please@no.spam>
Re: How to use Net::FTP - FTP Client class through a Fi (Helgi Briem)
Re: How to use Net::FTP - FTP Client class through a Fi (Sam Holden)
Re: it's true but can I say so ? <ericosman@rcn.com>
Re: it's true but can I say so ? <mbudash@sonic.net>
Re: it's true but can I say so ? <bigj@kamelfreund.de>
Re: Learning Perl <sbour@niaid.nih.gov>
Re: lwp protocol help <anonymous@anon.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 25 Mar 2003 11:14:15 -0600
From: pooba53 <delautenschl@[nospam]wisc.edu>
Subject: Re: Algorithm for Text Subsets
Message-Id: <b5q2p6$bgm$1@news.doit.wisc.edu>
Unfortunately, the code below does not work properly. I've got the
sorting of the keys in descending length to work, but neither Anno's or
your algorithm for removing a string pattern that is found in another
string works.
I'll keep at it...
-Dan
Benjamin Goldberg wrote:
>
> pooba53 wrote:
> >
> > I have a portion of a large Perl program where I have a hash with
> > multiple values associated with each key. Lets say I have the
> > following values associated with a key called "Gene":
> >
> > 1. actgattgaacca
> > 2. gattg
> > 3. actggtaaccggttaacctt
> >
> > The number of values varies from key to key, by the way.
> >
> > What I am trying to do with the above group is to eliminate any line
> > of text whose pattern is contained in another. In the above example
> > line number 2 would be removed because its pattern is found in the
> > middle of line 1.
> >
> > The problem I'm having is figuring our how you compare each line to
> > every other line, move to the next line, compare with all the rest,
> > etc., etc...
>
> If you don't mind the order being rearranged, then code like the
> following should work:
>
> while( my ($key, $value) = each %bighash ) {
> my $keep = "";
> foreach my $val (sort { length $b <=> length $a } @$values) {
> ($keep .= $val) .= " " if index($keep, $val) == -1;
> }
> @$value = split ' ', $keep;
> }
>
> If you need the kept items to be in the same order as they originally
> were in (other than not having the now eliminated items), then try
> something like this:
>
> while( my ($key, $value) = each %bighash ) {
> my $keep = "";
> my @keep;
> foreach my $index (
> sort { length $$values[$b] <=> length $$values[$a] }
> 0 .. $#$values ) {
> if( index( $keep, $$values[$index] ) == -1 ) {
> ($keep .= $$values[$index]) .= " ";
> push @keep, $index;
> }
> }
> @$value = @{$value}[ sort { $a <=> $b } @keep ];
> }
>
> [both untested]
>
> --
> $a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
> );{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
> ]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: Tue, 25 Mar 2003 11:23:57 -0600
From: pooba53 <delautenschl@[nospam]wisc.edu>
Subject: Re: Algorithm for Text Subsets
Message-Id: <b5q3bc$brh$1@news.doit.wisc.edu>
A thousand pardons, Benjamin. There was simply a typographical error in
your code.
It works quite fine right now!
-Dan
pooba53 wrote:
>
> Unfortunately, the code below does not work properly. I've got the
> sorting of the keys in descending length to work, but neither Anno's or
> your algorithm for removing a string pattern that is found in another
> string works.
>
> I'll keep at it...
> -Dan
>
> Benjamin Goldberg wrote:
> >
> > pooba53 wrote:
> > >
> > > I have a portion of a large Perl program where I have a hash with
> > > multiple values associated with each key. Lets say I have the
> > > following values associated with a key called "Gene":
> > >
> > > 1. actgattgaacca
> > > 2. gattg
> > > 3. actggtaaccggttaacctt
> > >
> > > The number of values varies from key to key, by the way.
> > >
> > > What I am trying to do with the above group is to eliminate any line
> > > of text whose pattern is contained in another. In the above example
> > > line number 2 would be removed because its pattern is found in the
> > > middle of line 1.
> > >
> > > The problem I'm having is figuring our how you compare each line to
> > > every other line, move to the next line, compare with all the rest,
> > > etc., etc...
> >
> > If you don't mind the order being rearranged, then code like the
> > following should work:
> >
> > while( my ($key, $value) = each %bighash ) {
> > my $keep = "";
> > foreach my $val (sort { length $b <=> length $a } @$values) {
> > ($keep .= $val) .= " " if index($keep, $val) == -1;
> > }
> > @$value = split ' ', $keep;
> > }
> >
> > If you need the kept items to be in the same order as they originally
> > were in (other than not having the now eliminated items), then try
> > something like this:
> >
> > while( my ($key, $value) = each %bighash ) {
> > my $keep = "";
> > my @keep;
> > foreach my $index (
> > sort { length $$values[$b] <=> length $$values[$a] }
> > 0 .. $#$values ) {
> > if( index( $keep, $$values[$index] ) == -1 ) {
> > ($keep .= $$values[$index]) .= " ";
> > push @keep, $index;
> > }
> > }
> > @$value = @{$value}[ sort { $a <=> $b } @keep ];
> > }
> >
> > [both untested]
> >
> > --
> > $a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
> > );{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
> > ]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: 25 Mar 2003 19:21:11 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Algorithm for Text Subsets
Message-Id: <b5qa77$nn9$1@mamenchi.zrz.TU-Berlin.DE>
pooba53 <delautenschl@[nospam]wisc.edu> wrote in comp.lang.perl.misc:
> I'm wondering if this code works if two strings are the same length, yet
> contain different characters...
What code? If you have a question, please put it in context.
> -Dan
>
> Anno Siegel wrote:
[TOFU snipped]
Anno
------------------------------
Date: 25 Mar 2003 13:19:27 -0800
From: gena_st@rocketmail.com (Gena Storhotz)
Subject: Building Perl 5.6.1 on AIX 5.1
Message-Id: <2ccfc5af.0303251319.a9909a@posting.google.com>
I posted a lengthy message on this subject in the comp.unix.aix
section, but, as I've posted questions about this on several other
forums without luck, I thought I should include a post here for
completeness.
I am trying to run Perl 5.6.1 on AIX 5.1. The binaries I've
downloaded were built with cc, so I can't install modules that require
a compiler. I've tried building Perl 5.6.1 with GCC 2.9 and 3.1 and
have multiple problems during Configure, and "make" fails.
I'm looking for someone who has experience with doing this to give me
advice on how to proceed, or maybe a link to an on-line guide for
this. Any information would be greatly appreciated. Thanks!
------------------------------
Date: 25 Mar 2003 16:28:39 GMT
From: Greg Raven <usrsa@racquettech.com>
Subject: CGI.pm or roll-your-own?
Message-Id: <usrsa-959736.08283825032003@tribune.sj.sys.us.xo.net>
I've been working unsuccessfully at write a short subroutine that will
detect whether the CGI input is GET or POST, process the data
accordingly, and then allow the calling script to use the values. This
subroutine could then be called by the various CGI scripts we use on our
site.
My inability to make such a simple subroutine work has lead me to wonder
if I should invest the time in attempting to learn how to use CGI.pm.
If the group would be so kind, are the benefits of CGI.pm worth the
overhead?
Thanks.
--
Greg Raven (greg at racquettech dot com)
U.S. Racquet Stringers Association
Solana Beach, CA
------------------------------
Date: Tue, 25 Mar 2003 10:42:28 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: CGI.pm or roll-your-own?
Message-Id: <8765q75rez.fsf@limey.hpcc.uh.edu>
>> On 25 Mar 2003 16:28:39 GMT,
>> Greg Raven <usrsa@racquettech.com> said:
> I've been working unsuccessfully at write a short
> subroutine that will detect whether the CGI input is GET
> or POST, process the data accordingly, and then allow
> the calling script to use the values. This subroutine
> could then be called by the various CGI scripts we use
> on our site.
perldoc CGI
...
request_method()
Returns the method used to access your script, usually
one of 'POST', 'GET' or 'HEAD'.
> If the group would be so kind, are the benefits of
> CGI.pm worth the overhead?
Yes. Oh yes. And the overhead isn't that much. Methinks
the usual yardstick here is: if you need to ask, you
shouldn't try to roll your own.
hth
t
------------------------------
Date: Tue, 25 Mar 2003 17:44:26 +0000
From: Chris Lowth <please@no.spam>
Subject: Re: CGI.pm or roll-your-own?
Message-Id: <_A0ga.1383$wi1.628@newsfep4-winn.server.ntli.net>
Greg Raven wrote:
> I've been working unsuccessfully at write a short subroutine that will
> detect whether the CGI input is GET or POST, process the data
> accordingly, and then allow the calling script to use the values. This
> subroutine could then be called by the various CGI scripts we use on our
> site.
>
> My inability to make such a simple subroutine work has lead me to wonder
> if I should invest the time in attempting to learn how to use CGI.pm.
>
> If the group would be so kind, are the benefits of CGI.pm worth the
> overhead?
>
> Thanks.
>
The general rule of life here that wheels exist and have exists for a number
of years. Dont invent your own unless you very specifically want a square
one.
Do a timing test before you commit though. My experience with under-powered
servers (which may be a clue - I guess) is that CGI.pm is quite expensive
on CPU. But I am talking old low-end pentiums here.
Go for it.
Chris
--
My real address is: chris at lowth dot sea oh em
-> OpenSource e-mail virus protection : http://protector.sourceforge.net
-> iptables configuration wizards : http://www.lowth.com/LinWiz
------------------------------
Date: 25 Mar 2003 18:36:47 GMT
From: Greg Raven <usrsa@racquettech.com>
Subject: Re: CGI.pm or roll-your-own?
Message-Id: <usrsa-DB4A4D.10364625032003@spectator.sj.sys.us.xo.net>
In article <8765q75rez.fsf@limey.hpcc.uh.edu>,
Tony Curtis <tony_curtis32@yahoo.com> wrote:
> Yes. Oh yes. And the overhead isn't that much. Methinks
> the usual yardstick here is: if you need to ask, you
> shouldn't try to roll your own.
>
> hth
> t
Good point. I have been moderately successful up until now hammering out
ugly but function perl scripts. Adding CGI.pm to the mix seems likely to
set me back at least temporarily, and the authors of Mac OS X Unleashed
advise against getting involved in it if possible.
--
Greg Raven (greg at racquettech dot com)
U.S. Racquet Stringers Association
Solana Beach, CA
------------------------------
Date: 25 Mar 2003 11:46:26 -0700
From: Eric Schwartz <emschwar@yahoo.com>
Subject: Re: CGI.pm or roll-your-own?
Message-Id: <etovfy7mghp.fsf@wormtongue.emschwar>
Greg Raven <usrsa@racquettech.com> writes:
> Good point. I have been moderately successful up until now hammering out
> ugly but function perl scripts. Adding CGI.pm to the mix seems likely to
> set me back at least temporarily, and the authors of Mac OS X Unleashed
> advise against getting involved in it if possible.
I'd be very skeptical of that book if it indeed advocates against
CGI.pm; using CGI.pm will save you large amounts of time in the both
the short run and the long run for writing CGI programs. You win in
the short run because it's amazingly well-debugged, and it covers all
the corner cases you'll forget to do when you try to write your own
parsing code. You'll win in the long run, because it's simpler and
faster to write code with CGI.pm than to be constantly tweaking your
own code.
It does give you a slight hit on the run, but if that matters, you
shouldn't be using CGI; you should be using mod_perl or some similar
environment.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: Tue, 25 Mar 2003 21:10:51 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: CGI.pm or roll-your-own?
Message-Id: <Pine.LNX.4.53.0303252059410.17278@lxplus008.cern.ch>
On Tue, Mar 25, Eric Schwartz inscribed on the eternal scroll:
> I'd be very skeptical of that book if it indeed advocates against
> CGI.pm;
me too...
> using CGI.pm will save you large amounts of time in the both
> the short run and the long run for writing CGI programs. You win in
> the short run because it's amazingly well-debugged, and it covers all
> the corner cases you'll forget to do when you try to write your own
> parsing code. You'll win in the long run, because it's simpler and
> faster to write code with CGI.pm than to be constantly tweaking your
> own code.
More than that. Some examples:
- if you wrote custom code for GET, and then later found you needed
for some reason to support POST, CGI.pm already supports it, but you'd
have to code it
- if you never thought at the start that you'd need a file upload
function, but later it turns out you want to add it, it needs almost
no change in a CGI.pm-based script, whereas it would need a complete
rewrite if you only coded the form-url-encoded support before
- in the event that a bug becomes apparent, or some other exploitable
loophole, the fix in CGI.pm can be quickly propagated to all the
scripts which use it. If you find a bug or exploitable loophole in
your custom code (you don't have to be called Matt to learn that such
a thing is par for the course), then you'd need to go around auditing
all your other custom scripts to see whether they have the same
loophole.
> It does give you a slight hit on the run, but if that matters, you
> shouldn't be using CGI; you should be using mod_perl or some similar
> environment.
Spot on.
Sometimes, just occasionally, CGI.pm _might_ be a suboptimal choice.
But I reckon you'd have to be a real expert to recognise those
occasions. I'll take my chances with the rest, I think.
If you're _learning_, then by all means play around with custom code.
Don't put such learning code into production!
all the best
------------------------------
Date: Wed, 26 Mar 2003 08:39:36 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: CGI.pm or roll-your-own?
Message-Id: <b5qiap$2c7au1$1@ID-172104.news.dfncis.de>
"Greg Raven" <usrsa@racquettech.com> wrote in message
news:usrsa-959736.08283825032003@tribune.sj.sys.us.xo.net...
> I've been working unsuccessfully at write a short subroutine that will
> detect whether the CGI input is GET or POST, process the data
> accordingly, and then allow the calling script to use the values. This
> subroutine could then be called by the various CGI scripts we use on our
> site.
>
> My inability to make such a simple subroutine work has lead me to wonder
> if I should invest the time in attempting to learn how to use CGI.pm.
>
> If the group would be so kind, are the benefits of CGI.pm worth the
> overhead?
Well, post your parsing code and we'll tell you where it is broken and
insecure.
------------------------------
Date: Tue, 25 Mar 2003 20:53:14 GMT
From: Matt <nwzmattXX@XXnetscape.net>
Subject: Re: Editor with Perl as macro language?
Message-Id: <u4r5rnp6s.fsf@XXnetscape.net>
Norbert Schmidt <Norbert_Schmidt@DU3.MAUS.DE> writes:
> Hello Malcolm,
>
> thanks for your suggestions. But it's not quite, what I was looking
> for. ;-)
>
<snip>
> I already execute perl scripts via the shell command of my old DOS
> editor. Works fine for some complex tasks. I just don't like the time
> it takes to start the interpreter each time a script is executed.
>
> I was dreaming of an editor that I can customize by simply writing
> packages that inherit from basic editor classes. And I would just have
> to override some methods or write new ones and assign them to keys.
> And bind such a substitute class to buffers or file types. Or
> something like that. I.e. I'ld really like something vaguely like
> emacs, but based on perl. :-)
>
> But I'ld settle for an editor where I can assign perl functions to
> keys and maybe replace built in functions by own versions.
This probably isn't exactly what you are looking for, but I hope it's
helpful.
In emacs you can run perl commands on a region easily with:
C-u M-| <RET> perl -p -e "s/this/that/g;"
If you want to assign this to a key simply add this to your .emacs:
(defun perl-command ()
(interactive)
(shell-command-on-region
(point-min)
(point-max)
"perl -p -e s/this/that/g;"
nil t nil)
)
(global-set-key "\M-p" 'perl-command)
This assigns perl-command to M-p (Alt + p). This will perform the
command on the whole buffer and replace it with the command's output.
Hope this helps.
Matt
--
Remove the X's to reply directly.
------------------------------
Date: 25 Mar 2003 09:27:19 -0800
From: Ethan Brown <ethan@draupnir.gso.saic.com>
Subject: File integrity while using "tie"
Message-Id: <vru1drjr0o.fsf@draupnir.gso.saic.com>
I have a web application in which I'm using flat files for data
storage. I'm currently using open/flock to access the files and
maintain their integrity.
I'm considering changing my implementation to use "tie", however I'm
concerned about file integrity if multiple users access a
datafile simultaneously. Is this an issue with "tie"?
Thanks,
--Ethan
------------------------------
Date: Tue, 25 Mar 2003 21:44:09 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: File integrity while using "tie"
Message-Id: <b5qf3s$2c209g$1@ID-184292.news.dfncis.de>
Ethan Brown wrote:
> I'm concerned about file integrity if multiple users access a
> datafile simultaneously. Is this an issue with "tie"?
If you use Tie::File, it's not. Tie::File supports flock:
(tie @array, 'Tie::File', $file)->flock or die "Can't tie... $!";
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 25 Mar 2003 13:46:37 -0800
From: Ethan Brown <ethan@draupnir.gso.saic.com>
Subject: Re: File integrity while using "tie"
Message-Id: <vrptofjf0i.fsf@draupnir.gso.saic.com>
>>>>> "Gunnar" == Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
Gunnar> Ethan Brown wrote:
>> I'm concerned about file integrity if multiple users access a
>> datafile simultaneously. Is this an issue with "tie"?
Gunnar> If you use Tie::File, it's not. Tie::File supports flock:
Gunnar> (tie @array, 'Tie::File', $file)->flock or die "Can't tie... $!";
Gunnar> / Gunnar
Gunnar> --
Gunnar> Gunnar Hjalmarsson
Gunnar> Email: http://www.gunnar.cc/cgi-bin/contact.pl
Thanks Gunnar. Whilst RTFMing Tie::File I see there is another
module, DB_File that might also be appropriate.
--Ethan
------------------------------
Date: 25 Mar 2003 21:00:43 GMT
From: nobody <noemail@nowhere.net>
Subject: Re: General goodness (strict, warnings and diagnostics?)
Message-Id: <Xns9349A39445302abccbaabc@129.250.170.82>
> 2/ Send the error to a file, then run "splain" on that file.
Or run splain and copy/paste the error message to stdin.
Good for quick occasional use.
Now that I think of it, you could pipe stderr of the perl program
into splain.
------------------------------
Date: 25 Mar 2003 09:16:49 -0800
From: ipellew@pipemedia.co.uk (Ian Pellew)
Subject: How to get images etc to client via CGI.
Message-Id: <30875970.0303250916.358ed91f@posting.google.com>
Hi;
Can someone tell me how to get images down into a client when I am
writing the page via CGI.
EG:-
#!/usr/local/bin/python
import os as o
print "Content-Type: text/html"
print """
<html><body>
"""
d = 'DOCUMENT_ROOT'
print d + " = '" + o.environ[d] + "'"
print """
<p>
<code>An attempt to get cgi to see an image file:-</code>
<p>
<img src="r.gif">
</body></html>
"""
Simply shows the image place holder for the image r.gif.
Here I have placed r.gif in all the directories I can think of, but I
guess I am missing something.
The environ DOCUMENT_ROOT = '/var/apache/htdocs', for what that's
worth.
Regards
Ian
------------------------------
Date: Tue, 25 Mar 2003 17:46:26 +0000
From: Chris Lowth <please@no.spam>
Subject: Re: How to get images etc to client via CGI.
Message-Id: <TC0ga.1384$wi1.1137@newsfep4-winn.server.ntli.net>
Ian Pellew wrote:
> EG:-
> #!/usr/local/bin/python
^^^^^^
Erm? Isnt this a perl group?
--
My real address is: chris at lowth dot sea oh em
-> OpenSource e-mail virus protection : http://protector.sourceforge.net
-> iptables configuration wizards : http://www.lowth.com/LinWiz
------------------------------
Date: Tue, 25 Mar 2003 16:13:29 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: How to use Net::FTP - FTP Client class through a Firewall
Message-Id: <3e807f74.3990306547@news.cis.dfn.de>
On 25 Mar 2003 07:32:24 -0800, joey19020@aol.com (Joe
Kamenar) wrote:
>I have read the documentation and still can't figure out how to get
>the parameters in (firewall name, user id and password). Can someone
>paste the section of the documentation that applies?
#!perl
use warnings;
use strict;
use Net::FTP;
# for anonymous FTP password should
# be your email address, username should
# 'Amonymous@remote_ftp_site' and
# host should be your firewall. But all of this
# can vary for different firewall setups.
my $host = 'proxy.yourdomain';
my $password = 'password';
my $username = 'username';
my $path = '/path/to/file';
my $file = 'filename';
my $localpath = '/some/path';
my $localfile = "$localpath/$file";
my $ftp = Net::FTP->new($host, Timeout=>10,Debug=>1)
or die "could not connect to $host : $!";
$ftp->login($username, $password);
$ftp->cwd($path);
$ftp->binary;
$ftp->get($file,$localfile);
$ftp->quit;
--
Regards, Helgi Briem
helgi DOT briem AT decode DOT is
------------------------------
Date: 25 Mar 2003 19:05:38 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: How to use Net::FTP - FTP Client class through a Firewall
Message-Id: <slrnb81a42.eah.sholden@flexal.cs.usyd.edu.au>
On 25 Mar 2003 07:32:24 -0800, Joe Kamenar <joey19020@aol.com> wrote:
> I have read the documentation and still can't figure out how to get
> the parameters in (firewall name, user id and password). Can someone
> paste the section of the documentation that applies?
It all depends on the type of firewall, the most common case is simply:
(error checking is skipped, and I haven't tested at all)
$ftp = Net::FTP->new('ftp.some.where', Firewall => 'firewall.somewhere.else');
$ftp->login($user, $pass);
however you may need something like:
$ftp = Net::FTP->new(ftp.some.where', Firewall => 'firewall.somewhere.else',
FirewallType => <number from Net::Config docs>);
$ftp->authorize($firewall_user, $firewall_pass);
$ftp->login($user, $pass);
This is all described in:
perldoc Net::FTP
perldoc Net::Config
--
Sam Holden
------------------------------
Date: Tue, 25 Mar 2003 15:29:11 -0500
From: Eric Osman <ericosman@rcn.com>
Subject: Re: it's true but can I say so ?
Message-Id: <3E80BC17.8060902@rcn.com>
Well, the short answer to my original question seems to be
that neither true or false are provided by Perl, and the
programmer must define them if they want to use them
as symbols.
I find it more self-documenting to be able to say
$foundMatch = false;
. . .
if (condition)
$foundMatch = true;
than to say
$foundMatch = 0;
. . .
if (condition)
$foundMatch = 1;
This second form bothers me a bit, since I'm not really wanting
to set "foundmatch" to any particular number. I'm trying to set
it to truthhood or falsehood !
So to this end, it seems like having symbols true and false defined
by the language is useful.
By the way, I'm perfectly willing and in the habit of saying
if ($foundMatch)
and I don't have any desire to try to say
if (true == $foundIt)
My reason is that I try to name my boolean variables in a meaningful
enough way.
Thanks for all the discussion. And Abigail, please apologize for
calling me a bonehead.
/Eric
------------------------------
Date: Tue, 25 Mar 2003 21:13:04 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: it's true but can I say so ?
Message-Id: <mbudash-A5F3B2.13130325032003@typhoon.sonic.net>
In article <3E80BC17.8060902@rcn.com>, Eric Osman <ericosman@rcn.com>
wrote:
> Well, the short answer to my original question seems to be
> that neither true or false are provided by Perl, and the
> programmer must define them if they want to use them
> as symbols.
>
> I find it more self-documenting to be able to say
>
> $foundMatch = false;
> . . .
> if (condition)
> $foundMatch = true;
>
> than to say
>
> $foundMatch = 0;
> . . .
> if (condition)
> $foundMatch = 1;
>
> This second form bothers me a bit, since I'm not really wanting
> to set "foundmatch" to any particular number. I'm trying to set
> it to truthhood or falsehood !
>
> So to this end, it seems like having symbols true and false defined
> by the language is useful.
>
> By the way, I'm perfectly willing and in the habit of saying
>
> if ($foundMatch)
>
> and I don't have any desire to try to say
>
> if (true == $foundIt)
>
> My reason is that I try to name my boolean variables in a meaningful
> enough way.
>
> Thanks for all the discussion. And Abigail, please apologize for
> calling me a bonehead.
>
> /Eric
>
how about:
use constant {
true => 1,
false => 0,
};
or, better style:
use constant {
TRUE => 1,
FALSE => 0,
};
hth-
--
Michael Budash
------------------------------
Date: Tue, 25 Mar 2003 23:52:00 +0100
From: "Janek Schleicher" <bigj@kamelfreund.de>
Subject: Re: it's true but can I say so ?
Message-Id: <pan.2003.03.25.22.50.44.971993@kamelfreund.de>
Eric Osman wrote at Tue, 25 Mar 2003 15:29:11 -0500:
> I find it more self-documenting to be able to say
>
> $foundMatch = false;
> . . .
> if (condition)
> $foundMatch = true;
>
> than to say
>
> $foundMatch = 0;
> . . .
> if (condition)
> $foundMatch = 1;
I would prefer the third form (TMTWTDI):
my $foundMatch = condition;
# or explicitly:
my $foundMatch = condition ? 1 : 0;
Cheerio,
Janek
------------------------------
Date: Tue, 25 Mar 2003 13:33:39 -0500
From: Stephan Bour <sbour@niaid.nih.gov>
Subject: Re: Learning Perl
Message-Id: <BAA60B33.6800%sbour@niaid.nih.gov>
Being a Perl beginner myself I'd like to comment on books recommendations.
Learning Perl (recommended below) is very good but for someone with no
programming experience I found "Perl, A Beginner's Guide" (R. Allen Wyke,
Osborne) a better choice. Oh, and get a copy of the "Perl 5 Pocket
Reference" unless you enjoy looking up syntax by going through the 500 pages
of your Perl instruction manual.
Stephan.
in article slrnb80j0q.6pb.tadmc@magna.augustmail.com, Tad McClellan at
tadmc@augustmail.com wrote on 3/25/03 07:31:
> Barkingroo <jdavis@mail2me.com.au> wrote:
>
>> Hi all
>
>
> Hi one. :-)
>
>
>> I would like to start learning Perl...
>
>
> Yea!
>
>
>> but some questions.
>
>
> That's what we're here for.
>
>
>> 1. Where is a good starting point to learn Perl.
>
>
> There are some tutorial books about Perl if you have a little
> money to spend.
>
> You have not told us whether you already know _programming_ or not.
>
> If you do:
>
> "Learning Perl" Randal Schwartz and Tom Phoenix
>
> If you don't:
>
> "Elements of Programming with Perl" Andrew Johnson
>
>
>> I am OK with HTML.
>
>
> The fact that you thought that that was relevant indicates that you
> have a few misconceptions at a rather fundamental level. Let's
> clear those up before they lead you to further confusion.
> (and I now recommend the 2nd book listed above :-)
>
> In programming it is vitally important to be able to recognize the
> distinction between what is "code" (program) and what is "data".
>
> Perl is code. HTML is data. Perl is a programming language.
> HTML is a _markup_ language.
>
> They are wildly different things.
>
>
> Perl is not CGI, CGI is not Perl, so HTML has no relevance or
> "connection" to Perl.
>
> Perl is a general purpose programming language, it can be used for
> many things, CGI is merely one such thing. In fact, Perl was used
> for many years before the WWW was even invented.
>
> I, for instance, have programmed in Perl pretty much daily for about
> eight years and have never written a CGI program (other than as a
> hobbyist).
>
>
>> 2. What is a good book/books
>
>
> See above.
>
>
>> and what is the most effective way to
>> teach myself Perl.
>
>
> After getting some exposure to the language via the docs that come
> with Perl, books and perhaps websites, the most effective way to
> learn how to apply it is to read some of the postings to this
> newsgroup.
>
> Phase 1)
> Find a question that you think you might be able to answer,
> and write up an answer for the question (but don't post it).
> Observe that thread for a few days, and take note of how
> others answered the question. Compare their answers with yours.
>
> Phase 2)
> After your answers seem to track well with the answers from
> others, start posting your answers.
>
>
>> 3. Why Perl and not C++
>
>
> You should choose the tool most appropriate to the job that
> you need to accomplish. Your question is similar to asking
> a handyman:
>
> Why a wrench and not a hammer?
>
> If the handyman has a good tool box, he'll use the hammer to drive
> a nail. If he has only a wrench, he might try and make do with using
> the back of the wrench to drive the nail.
>
> So I'll rephrase your question into one whose answer may be more helpful:
>
> Q: If I only have time to learn one programming language, which
> should I learn, Perl or C++?
>
> A: Perl will be the most appropriate tool for many common programming tasks.
>
> A2: Most jobs can be done with much less time and code using Perl than
> using C++.
>
>
>> 4. Any other guided help...
>
>
> Please check out the Posting Guidelines that are posted here frequently.
> They offer many tips that will help you get answers to Perl questions.
>
>
>> 5. Is this the right group for someone like me to be in....!!
>
>
> Yes.
>
> If you spend 10 minutes trying to find the answer to your question
> and still haven't found the answer, then post away.
>
> There is also a mailing list specifically for beginners:
>
> http://lists.perl.org/showlist.cgi?name=beginners
>
------------------------------
Date: Tue, 25 Mar 2003 11:44:19 -0800
From: "anonymous" <anonymous@anon.com>
Subject: Re: lwp protocol help
Message-Id: <v81c2et49a7f4b@corp.supernews.com>
"Brian McCauley" <nobull@mail.com> wrote in message
news:u9ptof1ul0.fsf@wcl-l.bham.ac.uk...
> helgi@decode.is (Helgi Briem) writes:
>
> > <MESSAGES REARRANGED INTO CHRONOLOGICAL ORDER>
> >
> > >> In article <v7v8nc2liujvf0@corp.supernews.com>, shane mos wrote:
> >
> > >> > I have a multi-homed system and I want to specify an IP when using
LWP
> > >> > useragent to fetch web pages. How do I do that? Thanks.
> >
> > >"Keith Keller" <kkeller-spammmm@wombat.san-francisco.ca.us> wrote in
message
> > >news:pgao5b.rv6.ln@goaway.wombat.san-francisco.ca.us...
> > >> The same way you specify a domain name.
> >
> > >shane mos wrote
> > >I am sorry maybe you misunderstood. I want to specify what IP to use as
a
> > >client not what the ip of the page i want to fetch....
> >
> > What do you mean, client? LWP does not have clients.
>
> Er, no LWP _is_ a client.
>
>
> Use the source, Keith.
>
> Having glanced at the source I'd guess:
>
> @LWP::Protocol::http::EXTRA_SOCK_OPTS = ( LocalAddr => $my_ip );
>
> Note: AFAIK this is not part of the documented LWP API so may not
> work in future versions.
>
> Perhaps you should submit a patch to allow per-instance
> extra socket options in LWP.
When I use @LWP::Protocol::http::EXTRA_SOCK_OPTS = ( LocalAddr => $my_ip );
I cannot seem to enter an IP. The only thing that works is the computers
name. I am using a W2K system. Anybody have any ideas?
------------------------------
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 4761
***************************************