[9117] in Perl-Users-Digest
Perl-Users Digest, Issue: 2735 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 27 11:12:29 1998
Date: Wed, 27 May 98 08:01:39 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 27 May 1998 Volume: 8 Number: 2735
Today's topics:
Re: Net::FTP and passwords (Michael Fuhr)
Re: Net::FTP and passwords <GGapinski@riser.eds.com>
Perl for WindowsNT? <T.J.Arnesen@collector.org>
Re: Perl for WindowsNT? <bjs@iti-oh.com>
Re: Perl for WindowsNT? (Jim Weisgram)
Perl Memory profiling? (Brian Wheeler)
Re: Q: How much data will closure handle? <rootbeer@teleport.com>
Re: Rand on NT perl <Jonathan_Epstein@nih.gov>
Re: regexp to delete trailing spaces? (Gabor)
Re: regexp to delete trailing spaces? <khaines@oshconsulting.com>
Re: regexp: normalizing csv data? <jdf@pobox.com>
Re: regexp: normalizing csv data? (Jonathan Stowe)
REQ: DBperl and Informix Resources defaultuser@domain.com
Re: text to RTF file converting using Perl scott@softbase.com
Re: text to RTF file converting using Perl (David A Thomas)
Re: Xor computation <tchrist@mox.perl.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 27 May 1998 13:36:56 GMT
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Net::FTP and passwords
Message-Id: <6kh4tk$p6p@flatland.dimensional.com>
"Aloud.com" <alex@aloud.com> writes:
> I've been using NET::ftp for a while but I'm slightly concerned about
> the logging in section.
> You obviously have to give the name and password of the system you are
> FTPing to. Is there anyway to encrypt this line or use to hide the
> passwords?
>
> $ftp->login('user','password');
Whatever you do to your program, your password will go over the wire in
the clear where it could easily be sniffed[1]. If you really want to
do this, check out the question in the Perl FAQ entitled "How can I
hide the source for my Perl program?" The question points out that
"there are a number of (mostly unsatisfactory) solutions with varying
levels of 'security'".
[1] You might be able to use ssh to encrypt the FTP command channel.
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: Wed, 27 May 1998 09:35:09 -0400
From: Gary Gapinski <GGapinski@riser.eds.com>
To: "Aloud.com" <alex@aloud.com>
Subject: Re: Net::FTP and passwords
Message-Id: <356C168D.4BE8C32E@riser.eds.com>
Hello, Alex:
The username and password can be relegated to a .netrc file.
However, they will still be sent over the network in the clear.
Regards,
Gary
------------------------------
Date: Wed, 27 May 1998 14:13:08 +0200
From: "T.J. Arnesen" <T.J.Arnesen@collector.org>
Subject: Perl for WindowsNT?
Message-Id: <6kh3lf$2sd$1@o.online.no>
Hi.
I have heard that there is a Perl Version for WindowsNT. Does that mean if
you have NT installed on your computer, you do not need to be online in
order to test your Perl scripts.
Thanks
T.J.
------------------------------
Date: Wed, 27 May 1998 10:19:33 -0400
From: "Brian J. Sayatovic" <bjs@iti-oh.com>
Subject: Re: Perl for WindowsNT?
Message-Id: <6kh7ld$81c$1@malgudi.oar.net>
Basically. Perl for NT is about 99% compatible with Perl for UNIX. Some of
the crazy IPC, etc. stuff doesn't work but there are workarounds for even
that. Furthermore, you have to wrroy about stuff like \'s on NT and /'s on
UNIX in pathnames. Witha bit of concentration, you make a script that will
work on both platforms. If you're writing perl scripts for CGI on web
servers, its worth a shot grap Perl for Win32, and IIS 4.0 and develop 'em
locally.
Brian,
T.J. Arnesen wrote in message <6kh3lf$2sd$1@o.online.no>...
>Hi.
>I have heard that there is a Perl Version for WindowsNT. Does that mean if
>you have NT installed on your computer, you do not need to be online in
>order to test your Perl scripts.
>
>Thanks
>T.J.
>
>
------------------------------
Date: Wed, 27 May 1998 14:29:37 GMT
From: jweisgram@hotmail.com (Jim Weisgram)
Subject: Re: Perl for WindowsNT?
Message-Id: <356c2269.261457599@news.teleport.com>
"T.J. Arnesen" <T.J.Arnesen@collector.org> wrote:
>Hi.
>I have heard that there is a Perl Version for WindowsNT. Does that mean if
>you have NT installed on your computer, you do not need to be online in
>order to test your Perl scripts.
>
>Thanks
>T.J.
>
It depends. You can certainly run Perl scripts on NT without being online.
However, the question itself seems to assume something not stated. That being,
why would you ever need to be online? The most common answer might be that you
are wanting to run a CGI script written in Perl. In which case you should
probably be posting in a CGI newsgroup and not a Perl newsgroup.
That being said, if you have web server software running on your NT desktop, it
is not too difficult to set it up to also use Perl to run CGI's, all without
being online. There are FAQ's that provide information on how to set this up.
--
All opinions expressed are mine and not my employers (but they ought to be)
Jim Weisgram
Oregon Department of Transportation
------------------------------
Date: 27 May 1998 14:40:21 GMT
From: bdwheele@indiana.edu (Brian Wheeler)
Subject: Perl Memory profiling?
Message-Id: <6kh8kl$dnm$1@jetsam.uits.indiana.edu>
Is there any way I can get memory usage info from a running perl process?
The process jumps up to 12M and stays there and I'm not sure where the ram
is going. Are there any modules or anything I can use to take
array/hash/scalar size snapshots?
If not, any ideas on how to implement one?
Thanks
Brian Wheeler
bdwheele@indiana.edu
------------------------------
Date: Wed, 27 May 1998 14:05:37 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Q: How much data will closure handle?
Message-Id: <Pine.GSO.3.96.980527070242.13639H-100000@user2.teleport.com>
On 27 May 1998, Lanny Ripple wrote:
> I'm assuming there is some limit to how large an array involved
> in closure can be.
Perl doesn't impose a specific limit. If your program isn't working with
large arrays, that may be due to a bug in Perl or in your code. Can you
cut it down to a simple test case which doesn't do what you think it
should? Try to make it fewer than a dozen lines or so. Thanks!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 27 May 1998 10:00:26 -0400
From: Jonathan Epstein <Jonathan_Epstein@nih.gov>
To: gbm@my-dejanews.com
Subject: Re: Rand on NT perl
Message-Id: <356C1C7A.F238C648@nih.gov>
You must call srand(); see:
http://hegel.ittc.ukans.edu/topics/linux/man-pages/man1/perlfunc.1.html
- Jonathan
gbm@my-dejanews.com wrote:
>
> Hi,
> I have problems running the rand function on NT perl.
> When I run the function $number = int(rand 5) I allways get the same number
> in $number.
> I tryed it with the command line and on the NT server and I get the same
> result.
> Is there a bug with the function or do I need to use another one?
>
> Cheers,
>
> Guillaume.
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 27 May 1998 12:06:43 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: regexp to delete trailing spaces?
Message-Id: <slrn6mo0rl.h4r.gabor@vnode.vmunix.com>
In comp.lang.perl.misc, Kirk D. Haines <khaines@oshconsulting.com> wrote :
# Ross Yahnke wrote:
# >
# > Hi all - A newbie question here, what's a useful regexp to delete all the
# > trailing spaces in a string?
# >
# > I.e., I want to change:
# > "All that glitters "
# >
# > ...to...
# > "All that glitters"
# >
# > Thanks in advance!
#
# $a = "All that glitters ";
# print "|$a|\n";
# $a =~ s/\s*$//;
# print "|$a|\n";
Just curious, but why the star(*). If there are zero whitespaces, why
the need to substitute it with nothing. Wouldn't the plus(+) make
more sense?
------------------------------
Date: Wed, 27 May 1998 08:45:31 -0600
From: "Kirk D. Haines" <khaines@oshconsulting.com>
To: Gabor <gabor@vmunix.com>
Subject: Re: regexp to delete trailing spaces?
Message-Id: <6kh8am$hik$1@gte1.gte.net>
Gabor wrote:
>
> In comp.lang.perl.misc, Kirk D. Haines <khaines@oshconsulting.com> wrote :
> # Ross Yahnke wrote:
> # >
> # > Hi all - A newbie question here, what's a useful regexp to delete all the
> # > trailing spaces in a string?
> # >
> # > I.e., I want to change:
> # > "All that glitters "
> # >
> # > ...to...
> # > "All that glitters"
> # >
> # > Thanks in advance!
> #
> # $a = "All that glitters ";
> # print "|$a|\n";
> # $a =~ s/\s*$//;
> # print "|$a|\n";
>
> Just curious, but why the star(*). If there are zero whitespaces, why
> the need to substitute it with nothing. Wouldn't the plus(+) make
> more sense?
It would.
Kirk Haines
------------------------------
Date: 27 May 1998 08:05:49 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: <rdschramm@earthlink.net>
Subject: Re: regexp: normalizing csv data?
Message-Id: <wwb7q2xe.fsf@mailhost.panix.com>
<rdschramm@earthlink.net> writes:
> f1,f2,f3,f4,f5
> f1,"f2a,f2b",f3,f4,f5
#!//c/perl/bin/perl -w
while (<DATA>) {
chomp;
my @flds = ();
push @flds, $1 || $2 while /"([^"]+)",?|([^,]+),?/g;
print join('|', @flds), "\n";
}
__DATA__
f1,f2,f3,f4,f5
f1,"f2a,f2b",f3,f4,f5
The regex above assumes that there are no escaped quotes within the
quoted fields. Here's the important line:
push @flds, $1 || $2 while /"([^"]+)",?|([^,]+),?/g;
The regex, in slo-mo:
/ #match
" # a quote char
([^"]+) # a bunch of non-quote chars, which we capture to $1
" # a closing quote
,? # an optional comma (optional because might be end)
| #or
([^,]+) # a bunch of non-commas, captured to $2
,? # an optional comma
/gx
I might actually have written it /(?:"([^"]+)"|([^,]+))(?:,|$)/g to
avoid the redundant ,? but it's a matter of taste. After the match,
exactly one of $1 or $2 will be defined, so we put the defined one
into the list of fields. As to whether this is faster than your
method, you might want to benchmark it and find out. I hope this
inspires you to study these documents: perlre, perlsyn, perlop, and
_Mastering Regular Expressions_.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: Wed, 27 May 1998 12:38:17 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: regexp: normalizing csv data?
Message-Id: <356c02fb.3640758@news.btinternet.com>
On Wed, 27 May 1998 06:20:24 -0400, <rdschramm@earthlink.net> wrote :
<snip>
>
>The problem is that the mail package exported the data as comma delimited
>fields, except when the field data contained a comma whereby they qualify
>that data with a quotes. What I get is a data set like the following:
>
>f1,f2,f3,f4,f5
>f1,"f2a,f2b",f3,f4,f5
>
<snip>
You want to slide over to perlfaq4 and check out the example therein.
It might look kind of gruesome to some but it does job nicely and
warrants some closer study.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Wed, 27 May 1998 09:22:19 -0500
From: defaultuser@domain.com
Subject: REQ: DBperl and Informix Resources
Message-Id: <356C219B.BDE879AB@domain.com>
Hello,
I am starting on a webified DB project and DBperl appears to be the best
way to go about this. I have looked at perl.com and read what they have
on this as well as downloading the modules. I am still looking for some
references and possibly a tutorial to interface with the Informix DB on
a Sun box.
Thanks,
Brad Bradley
------------------------------
Date: 27 May 1998 11:15:44 GMT
From: scott@softbase.com
Subject: Re: text to RTF file converting using Perl
Message-Id: <6kgsl0$vlj$2@mainsrv.main.nc.us>
Leon Shaigorodsky (LeonS@amdocs.com) wrote:
> How can i convert predefined text file to RTF format.
One byte at a time!
> Or how can i make RTF file (what is the specification of it)
> May be some package already exist ?
RTF's definition is on the Microsoft Developers Network CD.
The easiest way to do this is load the file into Word using Automation,
format it however you like, and do a Save As in RTF format. If you
don't have Word, you'll probably be very, very willing to plunk down
$90 after you read the RTF specifications -- think PostScript, only
worse.
Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more.
------------------------------
Date: 27 May 1998 13:10:34 GMT
From: nobody@mudshark.micro.ti.com (David A Thomas)
Subject: Re: text to RTF file converting using Perl
Message-Id: <6kh3ca$6jt$1@spock.asic.sc.ti.com>
Leon Shaigorodsky (LeonS@amdocs.com) wrote:
> How can i convert predefined text file to RTF format.
> Or how can i make RTF file (what is the specification of it)
> May be some package already exist ?
The spec for RTF can be found at
http://www.sunpack.com/RTF/RTF114.htm
--
David Thomas (david-at-micro-dot-ti-dot-com)
Texas Instruments, Houston (281)-274-2347
------------------------------
Date: 27 May 1998 14:34:00 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Xor computation
Message-Id: <6kh88o$ib4$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels) writes:
:Oh no, not the 'how to swap two integers without using
:a temporary variable' thread *all* *over* *again*.
Who said anything about integers?
($alpha = <<EOF) =~ s/^\s*//gm;
This particularly rapid unintelligible patter isn't
generally heard and if it it, it doesn't matter.
EOF
($beta = <<EOF) =~ s/^\s*//gm;
What a to-do to die to day at a minute or two to two.
A thing distinctly hard to say, yet harder still to do.
And they'll beat a tatoo at twenty to two, a rat-ta-tat
tat-ta-tat tat-ta-tatoo. And the dragon will come when
he hears the drum at a minute or two to two today at
a minute or two to two.
EOF
$alpha ^= $beta;
$beta ^= $alpha;
$alpha ^= $beta;
print "$alpha\n\n$beta\n\n";
--tom
--
There's no such thing as a simple cache bug. --Rob Pike
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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". 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 2735
**************************************