[18492] in Perl-Users-Digest
Perl-Users Digest, Issue: 660 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 9 14:06:04 2001
Date: Mon, 9 Apr 2001 11:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <986839516-v10-i660@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 9 Apr 2001 Volume: 10 Number: 660
Today's topics:
[Fwd: help a perl newbie with script] (Daniel)
Re: Blocking pipe. <cernava@itexas.net>
Re: command line perl (Christian Kruse)
Re: complaint about moderation of this group (Anno Siegel)
Re: complaint about moderation of this group <jazrant@zsc.nrcan.zc.ca>
Re: complaint about moderation of this group (Tad McClellan)
Re: complaint about moderation of this group <ritchie@fnal.gov>
Re: complaint about moderation of this group <uri@sysarch.com>
Re: complaint about moderation of this group <bart.lateur@skynet.be>
Re: Criticism (searching a syslog) <joeybach@127.0.0.1>
Re: Criticism (searching a syslog) <bart.lateur@skynet.be>
how can i get rid of ^M in files saved out using perl? <abcd@ntlworld.com>
Re: how can i get rid of ^M in files saved out using pe <dperham@dperham.eng.tvol.net>
Re: how to break a regexpr over a line? (Tad McClellan)
Re: how to break a regexpr over a line? <vmurphy@Cisco.Com>
Re: inheritance within one file? <prlawrence@lehigh.edu>
Re: Net::SMTP and MIME::Base64 problem - help <root@novastar.dtdns.net>
Re: NT User Group Administration with Perl <lmoran@wtsg.com>
Re: opening several Sendmail processes with Perl <iltzu@sci.invalid>
Re: Perl + SFTP method? <smilepak@hotmail.com>
Perl as an email client <dsw4@lucent.com>
Re: problem with quoting or how to avoid \n at the the <joe+usenet@sunstarsys.com>
Re: problem with quoting or how to avoid \n at the the (Anno Siegel)
Re: Provo Perl Mongers Meeting <comdog@panix.com>
Re: So what do YOU use Perl for? <smilepak@hotmail.com>
Re: So what do YOU use Perl for? <jesse@uchicago.edu>
Re: So what do YOU use Perl for? <camerond@mail.uca.edu>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 09 Apr 2001 12:35:02 -0400
From: "Lincoln, D. E. (Daniel)" <dlincol1@ford.com>
Subject: [Fwd: help a perl newbie with script]
Message-Id: <3AD1E4B6.DC9FA7B1@ford.com>
-------- Original Message --------
Subject: help a perl newbie with script
Date: Fri, 06 Apr 2001 08:26:46 -0400
From: "Lincoln, D. E. (Daniel)" <dlincol1@ford.com>
Organization: R&VT VCP&M
Newsgroups: comp.lang.perl
I'm new to perl and have written a script that formats a file
from this format:
1
2
3
to this format:
"$name", "*1*;*2*;*3*;"
I do not want the last ";" to be added to the line.
Is there an easy solution to this in Perl?
Here is some of the code:
# Begin formatting converted file
print OUTPUT '"';
print OUTPUT $name;
print OUTPUT '", "';
open(INPUT, "$ARGV[0]") || die "Can't open: $!\n";
while (<INPUT>){
chomp $_;
print OUTPUT "*$_*;";
}
print OUTPUT '"';
print OUTPUT "\n";
--
Regards,
Daniel E. Lincoln - Ford Motor Company
R&VT Vehicle CAD Process & Methods
------------------------------
Date: Mon, 9 Apr 2001 10:03:55 -0500
From: "Itexas" <cernava@itexas.net>
Subject: Re: Blocking pipe.
Message-Id: <9asj0p0gnt@enews4.newsguy.com>
I tryed it out on Linux and it worked awsome. LOVE Linux, but have to make
this thing work on M$ Windows. If it worked on Linux what would make so it
does not work on Windows? I'm using Windows Me, that might have somthing to
do with it. I don't have another windows to try it on so I wonder if that
works on other windows systems..
Hope some one can help.
Richard.
------------------------------
Date: 9 Apr 2001 16:47:51 GMT
From: CK1@wwwtech.de (Christian Kruse)
Subject: Re: command line perl
Message-Id: <Xns907EBFBDAA1AECK1wwwtechde@130.133.1.4>
Hi,
Caron Franck <frnack.caron@infineon.com> wrote in
<3A0FF903.580DA7D5@infineon.com>:
>/opt/perl -e 'your script'
>
>for ex :
>
>/opt/perl -r 'my $a = 2;my $b=3;$c = ($a+$b); print $c."\n";'
>
>this will print
>5
You also can use the psh :-)
http://sourceforge.net/projects/psh
Greets,
Christian
------------------------------
Date: 9 Apr 2001 15:50:00 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: complaint about moderation of this group
Message-Id: <9asln8$79d$2@mamenchi.zrz.TU-Berlin.DE>
According to Tad McClellan <tadmc@augustmail.com>:
> Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
> >Hah! I'd like to see you write a Perl program to cut down a Redwood with
> >a bana...Whoops, wrong thread.
>
>
> 1 while 1; # wait for the tree to rot and fall over
You missed the specification:
'banana' while 1;
Oops, that prints
"Useless use of a banana in void context..."
1 while 'banana';
That's it.
Anno
------------------------------
Date: Mon, 9 Apr 2001 11:54:52 -0400
From: "John A. Grant" <jazrant@zsc.nrcan.zc.ca>
Subject: Re: complaint about moderation of this group
Message-Id: <9asmc5$c2e12@nrn2.NRCan.gc.ca>
"---Pete---" <bogus@erol.com> wrote in message
news:3ad0207a.434607225@news.earthlink.net...
> PS: To anyone else like Kyle, it's not likely
> that a new CGI newsgroup will be formed because
> comp.infosystems.www.authoring.cgi
> is low traffic as it is.
Perhaps that's why people ask their CGI questions in clp.
I'm not saying that excuses it, but that might be a
contributing factor.
--
John A. Grant * I speak only for myself * (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here
------------------------------
Date: Mon, 9 Apr 2001 12:05:05 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: complaint about moderation of this group
Message-Id: <slrn9d3ndh.25t.tadmc@tadmc26.august.net>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>According to Tad McClellan <tadmc@augustmail.com>:
>> Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>
>> >Hah! I'd like to see you write a Perl program to cut down a Redwood with
>> >a bana...Whoops, wrong thread.
>>
>> 1 while 1; # wait for the tree to rot and fall over
>
>You missed the specification:
>
> 'banana' while 1;
>
>Oops, that prints
>
>"Useless use of a banana in void context..."
>
> 1 while 'banana';
>
>That's it.
Looks as if the specification is once again incomplete.
I thought the requirement was "with a banality", so that is
what I implemented. :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 09 Apr 2001 12:16:17 -0500
From: "David J. Ritchie" <ritchie@fnal.gov>
Subject: Re: complaint about moderation of this group
Message-Id: <3AD1EE61.9900A35B@fnal.gov>
Being a newbie myself, I have a certain sympathy for
Kyle's points. His subject line is more 'on target' than
his content in that the moderation (e.g., civility) of this
group is certainly not present at times.
One time I went limping to an older more
experienced person around here about some drubbing
I'd received at the hands of the regulars of
this newsgroup. I got told, without sympathy, that I had
failed to wear my flak jacket when posting and that putting
one on was, with this as with any other old internet newsgroup,
a requirement for which failure I had only myself to blame.
Newbie's usually don't realize this and it comes as
a surprise when they post and then get eaten for lunch
by the regulars. They'd get the same treatment if they
showed up in any professional group (say, theoretical
physicists) and asked questions in the field that they
hadn't taken the time to research themselves to at
least something approaching the expertise of their audience.
Newbie's need to learn that it's not a help desk (as another
poster pointed out). It's not a place where they or someone
pays money so that they can get their question answered.
The treatment they receive is simply a resource allocation
mechanism in lieu of money and shouldn't be taken personally.
It's intent is to make people go away who don't take the time
to figure out the rules and follow them.
When that happens, the desired result has been achieved.
David
--
David J. Ritchie
ritchie@fnal.gov
http://home.fnal.gov/~ritchie/
------------------------------
Date: Mon, 09 Apr 2001 17:44:38 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: complaint about moderation of this group
Message-Id: <x7puemotmh.fsf@home.sysarch.com>
>>>>> "SRG" == Scott R Godin <webmaster@webdragon.unmunge.net> writes:
SRG> Which is unfortunate, as I've been attempting to get some answers
SRG> to a DBD::CSV problem I'm having where a program is generating
SRG> around 7300 "use of uninitialized value" warnings into the ISP
SRG> weblogs every time the .cgi gets hit. (It's definitely not a cgi
SRG> problem -- I've tracked the offending code down, but still can't
SRG> grok it well enough to either patch it or offer a solution to the
SRG> author. :/
DBD in general has uninitialized value issues. one well know thing is
that the NULL SQL value usually gets translated into undef which can
cause problems. i have usually done a map to convert any undefines to ''
before doing any record/field processing. just don't trust DBI/DBD to do
that for you.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: Mon, 09 Apr 2001 18:03:10 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: complaint about moderation of this group
Message-Id: <89u3dtorckts45m3voqkveui4uusf49jmu@4ax.com>
Anno Siegel wrote:
>> >Hah! I'd like to see you write a Perl program to cut down a Redwood with
>> >a bana...Whoops, wrong thread.
> 1 while 'banana';
>
>That's it.
It's not. It is continuing as long as you have a banana, not as long as
the tree still stands.
It looks as if perl considers bananas as lasting forever.
--
Bart.
------------------------------
Date: Mon, 09 Apr 2001 17:03:55 GMT
From: "John Doe" <joeybach@127.0.0.1>
Subject: Re: Criticism (searching a syslog)
Message-Id: <%XlA6.15764$Qi6.1567016@typhoon.tampabay.rr.com>
In article <i4o2dtc4pg0s9o1t3b0cknt4260dbp7fn8@4ax.com>, "Bart Lateur"
<bart.lateur@skynet.be> wrote:
Thanks for the criticism. That is exactly what I was looking for, but now
I have questions.
Don't I have to use global var to pass then through to other subroutines?
> John Doe wrote:
>
>>use CGI qw/-debug :standard/;
>>print header;
>>our $tnMon = param(endMon); our $tnDay = param(endDay); our $tnYear =
>>param(endYear); # Test ending dates our $tsMon = param(startMon); our
>>$tsDay = param(startDay); our $tsYear = param(startYear); # Test
>>starting dates
> Can't you combine the param call to return multiple values at once?
> Apparently not. One of the reasons I really don't like CGI.pm.
>>our @words = split' ',param(startSearch); #search string; our $loop = 0;
>>our @found;
>>#########This Subroutine checks the date sub dateCheck(){
>>%Months =(
> Oops. You should have made this a local variable to the sub. This is a
> general critiscism, you seem to be using global variables for
> everything. A dangerous practise. ALL variables in a sub should be
> localized, always, unless there's a specific need for them to have a
> wider scope.
> You could also have put it outside the sub, in an enclosing block around
> the variable declaration and the sub itself, but initialization should
> then always happen before the first sub call. That is rather messy, I'm
> afraid. So: never mind.
>
>> "Jan"=>1,
>> "Feb"=>2,
>> "Mar"=>3,
>> "Apr"=>4,
>> "May"=>5,
>> "Jun"=>6,
>> "Jul"=>7,
>> "Aug"=>8,
>> "Sep"=>9,
>> "Oct"=>10,
>> "Nov"=>11,
>> "Dec"=>12
>> );
>>####### validate the dates
>>####
>>###
>>###ENDING DATE
>>if ($tnMon eq "Apr" || $tnMon eq "Jun" || $tnMon eq "Sep" || $tnMon eq
>>"Nov"){
>> if ($tnDay > 30){
>> print "There are only 30 Days in $tnMon . <BR>\n"; $loop = 1;
>> return;
>> }
>> }
> Are you assuming that the user will never enter a number above 31?
> That's an unsafe assumption.
> You also seem to assume that the user's enetered month name is always
> valid. Perhaps you've used a dropdown in your HTML form, and then maybe
> you may just assume this.
> I'd check anyway.
> The %month hash is an excellent tool for this check.
>>if ($tnMon eq "Feb"){
>> if ($tnDay > 28){
>> print "There are only 28 days in $tnMon . <br>\n";
>> $loop = 1;
>> return;
>> }
>> }
> No leap years?
>
>>#########
>>###
>>### STARTING DATE
>
>>if ($tsMon eq "Apr" || $tsMon eq "Jun" || $tsMon eq "Sep" || $tsMon eq
>>"Nov"){
>> if ($tsDay > 30){
>> print "There are only 30 Days in $tsMon . <BR>\n"; $loop = 1;
>> return;
>> }
>> }
> Same code again? Then put it in a sub. And no check for february?
>
>>my $test1 = (($Months{$tsMon})*31)+$tsDay + (($tsYear - 2000) * 403); my
>>$test2 = (($Months{$tnMon})*31)+$tnDay + (($tnYear - 2000) * 403);
> That is very artisanal code. A huge chance for buggy code. Tell yo what
> I would do: after some minimal checking for valid months and after
> seeing the other parameters are indeed numbers, I'd use the (standard,
> always present) Time::Local module to change the "date" into a
> seconds-since-the-epoch, and then back again, and see if you get the
> same date. If you do, your date is valid. Use either the gmtime+timegm
> combo, or localtime+timelocal.
> I'll skip a few things...
>
>>## Read the syslog
>>open (SYSLOG, "<cisco.log");
>>@found = ('');
>>while(<SYSLOG>){
>> if (m/^$start.*/i../^$end.*/i){push @found, $_ } }
> Since this is a CGI script, I'd use the /o modifier. And drop the ".*"
> at the end of the regexes, they're useless. But the whole concept is
> vulnerable. If for some starting date there are no log entries, think of
> an extremely quiet day, or a day where your server was down, then your
> script will return nothing. If if there are no log entries for the end
> date, everything until the end of the log file will be returned.
> And your end check isn't right either. It will accept the first log
> entry for the end date, but none of the remainder.
> HTH,
> Bart.
------------------------------
Date: Mon, 09 Apr 2001 17:37:32 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Criticism (searching a syslog)
Message-Id: <cms3dt0uibqi2f2q5q0p7b7m8s03qa85f8@4ax.com>
John Doe wrote:
>Don't I have to use global var to pass then through to other subroutines?
You could, but it is generally frowned upon. The common way to share
values between subs is to pass them as parameters, and return one value
(or a list) into a variable of your own.
Using global variables between subs is one sure way to get mysterious
bugs, such as if one sub updates the value of such a variable while the
next sub expects to find the old value. By passing values around as
parameters, this hardly ever crops up.
--
Bart.
------------------------------
Date: Mon, 9 Apr 2001 17:56:05 +0100
From: "Chile" <abcd@ntlworld.com>
Subject: how can i get rid of ^M in files saved out using perl?
Message-Id: <MSlA6.3810$Fm4.1059657@news2-win.server.ntlworld.com>
i have a simple form where i type stuff into a textarea input box and then i
take the input and save it to a file but returns are represented by ^M's and
when i read it back i get wired indents and stuff
any ideas?
Cheers,
Scott
------------------------------
Date: 09 Apr 2001 13:44:03 -0400
From: Doug Perham <dperham@dperham.eng.tvol.net>
Subject: Re: how can i get rid of ^M in files saved out using perl?
Message-Id: <81bsq6kly4.fsf@wgate.com>
"Chile" <abcd@ntlworld.com> writes:
> i have a simple form where i type stuff into a textarea input box and then i
> take the input and save it to a file but returns are represented by ^M's and
> when i read it back i get wired indents and stuff
>
> any ideas?
>
do you?
I'll give you a hint: ^M can be represented in a regexp by \r
> Cheers,
> Scott
--
Doug Perham o{..}o
dperham@wgate.com moo! (oo)___
WorldGate Communications, Inc. (______)\
/ \ / \
------------------------------
Date: Mon, 9 Apr 2001 10:27:41 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: how to break a regexpr over a line?
Message-Id: <slrn9d3hmt.1po.tadmc@tadmc26.august.net>
Thomas Lohmüller <thomas.lohmueller@swisscom.com> wrote:
>
>I have a long regexpr. Is there any chance to break this line over two
>line?
Yes.
see the 'x' option in perlre.pod, $line =~ /bigRE/x
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 09 Apr 2001 11:25:44 -0400
From: Vinny Murphy <vmurphy@Cisco.Com>
Subject: Re: how to break a regexpr over a line?
Message-Id: <m3d7amhz7r.fsf@vpnrel.cisco.com>
"Thomas Lohmüller" <thomas.lohmueller@swisscom.com> writes:
> Hi
>
> I have a long regexpr. Is there any chance to break this line over two
> line?
>
> while
> ($line=~/^[^,]+,[^,]+,\"([^\"]+)\",(\d+),\"(\d+:\d+)\",\d+,(\d+),(\d+),\"(\d
> +:\d+)\",\"(\d+:\d+)\",\"(\d+:\d+)\",/)
>
Look at the /x operator in perldoc perlre.
--Vinny
------------------------------
Date: Mon, 9 Apr 2001 10:38:13 -0400
From: "Phil R Lawrence" <prlawrence@lehigh.edu>
Subject: Re: inheritance within one file?
Message-Id: <9ashgf$85k@fidoii.CC.Lehigh.EDU>
"Uri Guttman" <uri@sysarch.com> :
> >>>>> "PRL" == Phil R Lawrence <prlawrence@lehigh.edu> writes:
>
> PRL> package B;
> PRL> use base A;
>
> that is a bareword. 'A' should be quoted. arguments on a use line
are
> not special like the class/pragma name is.
OK. Thanks for another good pointer -- I appreciate your time!
Phil
------------------------------
Date: Mon, 9 Apr 2001 19:36:23 +0200
From: "novastar" <root@novastar.dtdns.net>
Subject: Re: Net::SMTP and MIME::Base64 problem - help
Message-Id: <9asoe1$mej$1@usenet.otenet.gr>
I can not stand it any more , I give up, Net::SMTP beat me up. The emails are sent, the binaries are encoded as
they should be, the headers look just ok but the email clients does not recognize the files as attached. The Base64
encoded files are showing as text messages. I create with outlook an email with some attached files and then
compare it with my script mail on smtp server repository, there was no difference. This is an investigation area
for X-Files inspectors not me .
"novastar" <root@novastar.dtdns.net> wrote in message news:9aqbjh$if3$1@usenet.otenet.gr...
> Silly me !!! I was trying to open a binary file as a text file . The binmode command solve the problem !
> open(input, "<sample.jpg");
> binmode input, ":raw";
>
>
> "Gareth Watkins" <info@gareth-watkins.co.nz> wrote in message news:752A6.1952$ndm.100008114@news.xtra.co.nz...
> > I've had the same problem with the Base64 module ... after a number of
> > terror days trying to work it it switched to using MimeLite....
> >
> >
> > "novastar" <root@novastar.dtdns.net> wrote in message
> > news:9aq54l$g76$1@usenet.otenet.gr...
> > > I have a mail script on my ISP that sends emails. The server have not
> > sendmail, MIME::Lite, or nothing else than
> > > Net::SMTP and MIME::Base64 installed. So I have to encode the attached
> > binaries files with the MIME::Base64 module.
> > > The problem is that the encoded binaries files are obviously misformated.
> > I tryied to encode several files with no
> > > success at all. I think that I am doing a mistake but I can not figure
> > out. Here is an example :
> > > use MIME::Base64;
> > > open(output,">output.bin") ; open(input, "<sample.jpg") ;
> > > while (read(input, $var, 57*60))
> > > {
> > > print output encode_base64($var)
> > > }
> > > close input ; close output ;
> > > The input file ( http://users.otenet.gr/~novastar/misc/sample.jpg ) is
> > 57.953 bytes and the output file is only 94
> > > bytes ...
> > >
> > > George
> > >
> > >
> > >
> >
> >
>
>
------------------------------
Date: Mon, 09 Apr 2001 12:31:35 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: NT User Group Administration with Perl
Message-Id: <8po3dt4gh7227foeqsv4q0nhpea2vpe40t@4ax.com>
On Tue, 03 Apr 2001 11:38:49 +0100, Greg Murphy <greg.murphy@bt.com>
wrote wonderful things about sparkplugs:
>Hi
>
>As a (very) casual user of Perl, I'm a bit in the dark on this one.
>
>I've heard that its possible to do quite a lot of NT admin automatically
>with Perl, which would be ideal for my situation. I need to be able to
>move hundreds of users between a number of NT groups pretty quickly - is
>there an easy way to do this with Perl?
I found no NG BUT for $30US or so I go WIN32 PERL SCRIPTING TH
Administrator's Handbook By Dave Roth [New Riders] to be extremely
useful. You won't necessarily "Learn Perl" or "The Elements of
Programming with Perl" but it is kind of a "Perl Cookbook" for NT
Admin types.
http://www.newriders.com/books/title.cfm?isbn=1578702151
>
>Any help appreciated.
>
>Cheers
>
>Greg Murphy
--
print "\x{263a}"
------------------------------
Date: 9 Apr 2001 17:40:51 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: opening several Sendmail processes with Perl
Message-Id: <986837899.23041@itz.pp.sci.fi>
In article <Yb4z6.29623$8y.8216549@typhoon.austin.rr.com>, George Hardisty wrote:
>I maintain a list of about 95K users who want job information. I keep the
>list very clean of old addresses, etc. I have a program in Perl that calls
>a function to merge user data (for the dynamic url to unsubscribe, etc.)
[snip]
>$address". The program gets sluggish and I am thinking there has to be a
>less expensive way to do this ... like write out the files and start
>sendmail separately or something ... but I am not sure. Any advice for me?
Take a look at Mail::Bulkmail, it's optimized for precisely this.
http://search.cpan.org/search?dist=Mail-Bulkmail
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
Date: Mon, 09 Apr 2001 16:19:09 GMT
From: "smilepak" <smilepak@hotmail.com>
Subject: Re: Perl + SFTP method?
Message-Id: <1ilA6.1971$GB2.191468@newsread1.prod.itd.earthlink.net>
will Net::FTP work with SFTP?
"Eagle Web Services" <nospam@please.com> wrote in message
news:aOZz6.43220$Gn3.597812@dbsch1.home.nl...
> Well,
>
> first of all you need the Net::FTP package.
> check www.cpan.org for that....
> There'll be a manual for that aswell.
> Also, if you're looking to rip stuff through http
> try LWP.
> Can also be found at www.cpan.org
>
> --
> ___________________________________________________
> Excellent HOSTING solutions starting at just $9.95 !!
> Eagle Web Services
> http://www.ewsnl.com/
>
>
>
> "smilepak" <smilepak@hotmail.com> schreef in bericht
> news:pQrz6.10348$Kr1.871431@newsread1.prod.itd.earthlink.net...
> > I have a question, anyone know how to create a pl script that does sftp
> pull
> > from a remote site.
> >
> > For Example:
> >
> > username: user
> > password: pass
> > sftp address: sftp.mydomain.com
> > directory: /pub/mydir/
> > file: filename$date.txt
> >
> > How am I suppose to do an FTP connection via script and provide the
> > username/password with it prompt
> > for it?
> >
> > Haven't done this before so not sure on how to do it. Oh the basic perl
> > scripting, I already know how.
> > Just unsure how to structure the FTP command to provide the
> > username/password and path and get when
> > it ask for it.
> >
> > Thanx
> > KN
> >
> >
> >
>
>
>
------------------------------
Date: Mon, 09 Apr 2001 13:56:47 -0400
From: Dionte S Wilson <dsw4@lucent.com>
Subject: Perl as an email client
Message-Id: <3AD1F7DF.AC1875A5@lucent.com>
Has anyone ever used perl to simulate an email client? If so, was it alot of
effort. I'm thinking about writing a generic email client using PERL.
--
Dionte S. Wilson
Lucent Technologies
6400 East Broad Street
Columbus, OH 43213
614-860-3255
Email: dsw4@lucent.com
------------------------------
Date: 09 Apr 2001 11:31:28 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: problem with quoting or how to avoid \n at the the end of <<EOF?
Message-Id: <m3n19q9jjj.fsf@mumonkan.sunstarsys.com>
Christoph Bergmann <info@java.seite.net> writes:
> the above code was a reply to an answer of my original question. the
> real problem is not that simple. i want to give code to a subroutine
> which evals this code (it has to be eval, because the code could come
> from outside the program):
So you have enabled taint checks then?
> &anothersub("&somesub(<<'WHATEVER'
> $val
> WHATEVER
> )");
So what's wrong with chomping inside &somesub?
my $runtime = 1;
sub somesub {
local $_ = shift;
chomp if pop; # toggle newline elimination
...
&anothersub("&somesub(<<'WHATEVER', 'chomp here doc')
$val
WHATEVER
");
> $val could contain any char, including ', ", }, ! etc. (thats why q{...}
> would not work)... chomping $val before the statement would end in the
> same problem if $val does not end with \n...
So conceivably $val could be "blah\nWHATEVER\nexec q{rm -rf /};\n=pod" ?
I don't see how here-docs will help if $val can be "anything".
> "somesub" could be called from "normal" (not eval'ed) code as well
> (like &somesub("blah\n"); ) so chomping generally in "somesub" isn't
> ok either...
See above for possible implementation.
> maybe the question sounds a bit theoretical, but i just didn't thought
> there is really no way to leave the given value unchanged (even if its
> just a \n more at the end)...
Frankly, it sounds like you should restructure your design a bit,
because sticking an arbitrary, unknown chunk of data inside an
eval statement is just asking for trouble. It would be far safer
to use an encode/decode scheme and/or a dispatch table to prevent
misinterpretation of metacharacters.
After you have laundered $val through a suitable detainting
mechanism, of course.
--
Joe Schaefer "Sacred cows make the best hamburger."
--Mark Twain
------------------------------
Date: 9 Apr 2001 15:33:41 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: problem with quoting or how to avoid \n at the the end of <<EOF?
Message-Id: <9askol$79d$1@mamenchi.zrz.TU-Berlin.DE>
According to Christoph Bergmann <info@java.seite.net>:
> Mona Wuerz wrote:
> >
> > In article <3ACF5BD7.6CA8@java.seite.net>, Christoph Bergmann
> > <info@java.seite.net> wrote:
> >
> > > is there a possibility to write
> > >
> > > $x=<<EOF
> > > text
> > > EOF
> > >
> > > without an additional \n at the end of "text" ??
> >
> > not that I know of, but what's wrong with chomp, if the \n bothers you?
> >
> > -mona
>
> if i would need it just like the above code, chomp would be fine, but i
> need it in a construct like this:
>
> &anothersub("&somesub(<<'WHATEVER'
You have the wrong quotes there if you want to interpolate $val. If,
on the other hand, access to $val is to be delegated to a later eval(),
the quotes are right. On the third hand, if there is nothing except
$val in your here-doc, you don't need the here-doc at all. I'll
assume that some more text was dropped along the thread.
> $val
> WHATEVER
> )");
I'd re-arrange this a little. Remember that <<'WHATEVER' is replaced
by the text it refers to, so there's no need to postpone the closing
quote, parenthesis and semicolon until the text is over. Write the
statement in one line:
&anothersub( "&somesub( <<'WHATEVER'");
$val
WHATEVER
# next statement here
> "anothersub" evals the code it gets (it has to be eval because the $val
> comes from outside the program).
This sounds like a questionable design, but I'll go along with it.
> a chomp afterwards is useless and a chomp before results in the same
> problem (if $val doesn't end with \n, chomp has no effect and
> <<'WHATEVER' adds \n...)
>
>
> mhh, looks like there is no solution...?
None? Well there is substr( ..., 0, -1) to remove the trailing newline
(we know it's there) and return the result. Following your layout, that
would be
&anothersub( "&somesub(" . substr( <<WHATEVER, 0, -1) . ")" );
$val
WHATEVER
But Mona's advice still applies. Take your time to construct the text
you need in a variable in the most convenient way, then hand it over to
the interpreting function (untested, as most of the code):
my $code = '&somesub( ';
$code .= <<WHATEVER;
$val
WHATEVER
chop $code; # it's chop in this case
$code .= ')';
# now call the interpreting routine
&anothersub( $code);
It's a bit longer, but much more maintainable.
Anno
------------------------------
Date: Mon, 09 Apr 2001 11:19:54 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Provo Perl Mongers Meeting
Message-Id: <comdog-9D424E.11195409042001@news.panix.com>
In article <3AD1783C.621FF8C9@acm.org>, "Roger W. Winget"
<wingetr@wingetsolutions.com> wrote:
> If not here, where would we find local Perl user groups?
>
> PS. Add me to any emailing list about the Provo / Orem Utah group(s).
you could always look at http://www.pm.org ;)
--
brian d foy <comdog@panix.com>
------------------------------
Date: Mon, 09 Apr 2001 16:41:57 GMT
From: "smilepak" <smilepak@hotmail.com>
Subject: Re: So what do YOU use Perl for?
Message-Id: <pDlA6.2032$GB2.196805@newsread1.prod.itd.earthlink.net>
Are you sure you don't
open(HND, "+> blouse") || die "unable to open blouse";
@hand = <HND>;
close(HND);
?? I am sure that how it was suppose to be done :)
"Gwyn Judd" <tjla@guvfybir.qlaqaf.bet> wrote in message
news:slrn9d02ft.ff7.tjla@thislove.dyndns.org...
> I was shocked! How could Szilvia Oszko <soszko@gmu.edu>
> say such a terrible thing:
> >One recurring theme in this newsgroup seems to be that Perl!=CGI and
> >that while Perl is often used to write CGI scripts, it can also be used
> >to do a lot of other things. I'd be curious to see what non-CGI stuff
> >you do with Perl.
>
> I use it to impress women.
>
> --
> Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
> BOFH excuse #193:
>
> Did you pay the new Support Fee?
------------------------------
Date: Mon, 09 Apr 2001 11:59:28 -0500
From: Jesse James Jensen <jesse@uchicago.edu>
Subject: Re: So what do YOU use Perl for?
Message-Id: <3AD1EA70.D27635B9@uchicago.edu>
"Randal L. Schwartz" wrote:
>
>
> "Let's invent a language that we'll just putt around with until
> the web comes along and then we can use it for CGI! Yes!"
>
Oh, I thought it was, "Let's invent a language that has a ferjillion
ways to do any one thing, tout it as a feature, and then sell lots of
books explaining the arcane syntax."
------------------------------
Date: Mon, 09 Apr 2001 12:15:16 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: So what do YOU use Perl for?
Message-Id: <3AD1EE24.69ECDC1C@mail.uca.edu>
Szilvia Oszko <soszko@gmu.edu> wrote:
> One recurring theme in this newsgroup seems to be that Perl!=CGI and
> that while Perl is often used to write CGI scripts, it can also be used
> to do a lot of other things. I'd be curious to see what non-CGI stuf
> you do with Perl.
I use it for querying databases in preparing student quizzes, preparing
PDF documents, and some calculation tasks. A colleague uses it for
finding homologies in protein amino acid sequences between species
(something akin to the Human Genome Project, which I understand that
someone is using Perl in support of, somewhere ;) ).
Cameron
--
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu
------------------------------
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 660
**************************************