[23968] in Perl-Users-Digest
Perl-Users Digest, Issue: 6169 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 20 11:05:43 2004
Date: Fri, 20 Feb 2004 08:05:09 -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 Fri, 20 Feb 2004 Volume: 10 Number: 6169
Today's topics:
ANNOUNCE: CGI::EasyCGI <jeremy@marzhillstudios.com>
Configuration question <chatiman@free.fr>
Re: Configuration question <beable+unsenet@beable.com.invalid>
Re: Configuration question <fifo@despammed.com>
Re: Configuration question <chatiman@free.fr>
Re: Configuration question <chatiman@free.fr>
Re: Configuration question <uri@stemsystems.com>
Re: Configuration question <chatiman@free.fr>
Re: Configuration question <usenet@morrow.me.uk>
Re: Configuration question <fifo@despammed.com>
Re: Configuration question <usenet@morrow.me.uk>
Email::Valid bug? <Guru03@despammed.com>
Re: Email::Valid bug? <xx087@freenet.carleton.ca>
Re: Email::Valid bug? <Guru03@despammed.com>
Re: Email::Valid bug? <ittyspam@yahoo.com>
Re: Email::Valid bug? <xx087@freenet.carleton.ca>
Re: Example of web application done right? <shirsch@adelphia.net>
Re: FORM POST submission <flavell@ph.gla.ac.uk>
IO::Socket::INET: Address already in use (hagen)
Re: IO::Socket::INET: Address already in use <chatiman@free.fr>
Re: more stripping <noreply@gunnar.cc>
Newbie question on use <chatiman@free.fr>
Parsing Word Doc files <arthur0421@163.com>
Re: Parsing Word Doc files <ceo@nospan.on.net>
Re: Recommended mail module for plaintext sending? <ian@WINDOZEdigiserv.net>
Re: regex <matthew.garrish@sympatico.ca>
Re: Replacing a text in multiple files with regular exp <matthew.garrish@sympatico.ca>
Re: Search and replace problem <beable+unsenet@beable.com.invalid>
Re: Search and replace problem <fifo@despammed.com>
Re: SOAP::Lite install problem <shirsch@adelphia.net>
What with this open file descriptor/"Read on closed fil (Rex Gustavus Adolphus)
Re: What with this open file descriptor/"Read on closed <usenet@morrow.me.uk>
Re: your partner <rmarkoff@msn.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 19 Feb 2004 21:43:04 GMT
From: Zaphar <jeremy@marzhillstudios.com>
Subject: ANNOUNCE: CGI::EasyCGI
Message-Id: <HtDw2y.1BGn@zorch.sf-bay.org>
Hi this is my first announcment on the Modules list also my first
upload to cpan, so if I make a mistake somewhere please let me know.
CGI::EasyCGI is a CGI Module. I wrote it for a project I was working
on where I didn't need all the bells and whistles of the other
projects and found them too confusing for a first timer writing CGI
application. EasyCGI is for those situations where you don't want or
need the swiss army knife of cgi modules. It has no dependencies other
than strict and exporter. And as far as I know works in any OS
It's quite possible I may have messed up the distribution file so
please let me know if you find any errors there. :-)
you can find it on CPAN at this link:
http://search.cpan.org/~zaphar/CGI-EasyCGI-0.4.2/
direct any comments to Jeremy <at> marzhillstudios <dot> com
thank you.
------------------------------
Date: Fri, 20 Feb 2004 14:51:32 +0100
From: "chatiman" <chatiman@free.fr>
Subject: Configuration question
Message-Id: <403610e9$0$28134$626a14ce@news.free.fr>
Hello,
I'd like to put all the configuration variables in a separate file.
The configuration file will contain etheir a hash:
%conf = ( ... )
or constants :
use constant { ... }
How can I do that in perl without the "dirty":
eval (`cat ...`)
?
Thanks
------------------------------
Date: Fri, 20 Feb 2004 14:10:07 GMT
From: Beable van Polasm <beable+unsenet@beable.com.invalid>
Subject: Re: Configuration question
Message-Id: <lbptc9q1ub.fsf@dingo.beable.com>
"chatiman" <chatiman@free.fr> writes:
> Hello,
>
> I'd like to put all the configuration variables in a separate file.
> The configuration file will contain etheir a hash:
> %conf = ( ... )
> or constants :
> use constant { ... }
>
> How can I do that in perl without the "dirty":
> eval (`cat ...`)
You could make it into a module. See "perldoc perlmod", and
"perldoc perlmodlib".
--
------------------------------
Date: Fri, 20 Feb 2004 14:29:46 +0000
From: fifo <fifo@despammed.com>
Subject: Re: Configuration question
Message-Id: <20040220142946.GC18088@fleece>
At 2004-02-20 14:51 +0100, chatiman wrote:
> I'd like to put all the configuration variables in a separate file.
> The configuration file will contain etheir a hash:
> %conf = ( ... )
> or constants :
> use constant { ... }
>
> How can I do that in perl without the "dirty":
> eval (`cat ...`)
> ?
>
perldoc -f do
------------------------------
Date: Fri, 20 Feb 2004 15:35:01 +0100
From: "chatiman" <chatiman@free.fr>
Subject: Re: Configuration question
Message-Id: <40361b1a$0$28108$626a14ce@news.free.fr>
do doesn't reexport variables set from a files if I remember.
I would like a function like this but which does :
eval (`cat ...`)
"fifo" <fifo@despammed.com> a écrit dans le message
> perldoc -f do
------------------------------
Date: Fri, 20 Feb 2004 15:36:54 +0100
From: "chatiman" <chatiman@free.fr>
Subject: Re: Configuration question
Message-Id: <40361b8b$0$28140$626a14ce@news.free.fr>
You mean make a module and than export the variable ... that's nice I didn't
think about it
Thanks
"Beable van Polasm" > You could make it into a module. See "perldoc
perlmod", and
> "perldoc perlmodlib".
>
>
> --
>
------------------------------
Date: Fri, 20 Feb 2004 14:37:20 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Configuration question
Message-Id: <x7k72hkeao.fsf@mail.sysarch.com>
>>>>> "c" == chatiman <chatiman@free.fr> writes:
c> do doesn't reexport variables set from a files if I remember.
c> I would like a function like this but which does :
c> eval (`cat ...`)
huh????
what do you think do does? and how is it different than that code (other
than being faster)? and what in the world does 'reexport' mean? and if
you don't remember, look it up in the docs and relearn it.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Fri, 20 Feb 2004 15:48:32 +0100
From: "chatiman" <chatiman@free.fr>
Subject: Re: Configuration question
Message-Id: <40361e45$0$28133$626a14ce@news.free.fr>
Well, english is not my native language. I understand it a bit so excuse me
if I misunderstand the following words from perldoc -f do :
""do FILENAME" cannot see lexicals in the enclosing scopre; "eval STRING"
does.
Which I translate (that's probably wrong) as :
- When a file evaluated with "do" sets a variable, you cannot see this
variable from the file that called "do"
........
"Uri Guttman" <uri@stemsystems.com> a écrit dans le message de news:
x7k72hkeao.fsf@mail.sysarch.com...
> >>>>> "c" == chatiman <chatiman@free.fr> writes:
>
> c> do doesn't reexport variables set from a files if I remember.
> c> I would like a function like this but which does :
> c> eval (`cat ...`)
>
> huh????
>
> what do you think do does? and how is it different than that code (other
> than being faster)? and what in the world does 'reexport' mean? and if
> you don't remember, look it up in the docs and relearn it.
>
> uri
>
> --
> Uri Guttman ------ uri@stemsystems.com --------
http://www.stemsystems.com
> --Perl Consulting, Stem Development, Systems Architecture, Design and
Coding-
> Search or Offer Perl Jobs ----------------------------
http://jobs.perl.org
------------------------------
Date: Fri, 20 Feb 2004 14:50:34 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Configuration question
Message-Id: <c156rq$ir7$1@wisteria.csv.warwick.ac.uk>
Uri Guttman <uri@stemsystems.com> wrote:
> >>>>> "c" == chatiman <chatiman@free.fr> writes:
>
> c> do doesn't reexport variables set from a files if I remember.
> c> I would like a function like this but which does :
> c> eval (`cat ...`)
>
> what do you think do does? and how is it different than that code (other
> than being faster)?
ObPedant:
perldoc -f do:
| except that it's more efficient and concise, keeps track of the
| current filename for error messages, searches the @INC libraries, and
| updates %INC if the file is found.
:)
Ben
--
Heracles: Vulture! Here's a titbit for you / A few dried molecules of the gall
From the liver of a friend of yours. / Excuse the arrow but I have no spoon.
(Ted Hughes, [ Heracles shoots Vulture with arrow. Vulture bursts into ]
/Alcestis/) [ flame, and falls out of sight. ] ben@morrow.me.uk
------------------------------
Date: Fri, 20 Feb 2004 14:55:55 +0000
From: fifo <fifo@despammed.com>
Subject: Re: Configuration question
Message-Id: <20040220145551.GE18088@fleece>
At 2004-02-20 15:48 +0100, chatiman wrote:
> Well, english is not my native language. I understand it a bit so excuse me
> if I misunderstand the following words from perldoc -f do :
>
> ""do FILENAME" cannot see lexicals in the enclosing scopre; "eval STRING"
> does.
>
> Which I translate (that's probably wrong) as :
> - When a file evaluated with "do" sets a variable, you cannot see this
> variable from the file that called "do"
No, it means you can't see _lexical_ variables, i.e. those created using
"my". Packages variables, like those in your original example, will be
visible.
------------------------------
Date: Fri, 20 Feb 2004 14:59:58 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Configuration question
Message-Id: <c157de$ir7$2@wisteria.csv.warwick.ac.uk>
[stop top-posting]
"chatiman" <chatiman@free.fr> wrote:
> Well, english is not my native language. I understand it a bit so excuse me
> if I misunderstand the following words from perldoc -f do :
>
> ""do FILENAME" cannot see lexicals in the enclosing scopre; "eval STRING"
> does.
>
> Which I translate (that's probably wrong) as :
> - When a file evaluated with "do" sets a variable, you cannot see this
> variable from the file that called "do"
> ........
You do misunderstand. What this means is that if you have
file1:
my $var1 = 'hello world';
do 'file2';
print $var1;
file2:
$var1 = 'foo bar';
then the code in file2 will not be able to access $var1 from $file1. If
you are using constants, which are subs, this will not affect you; if
you want variables to pass between files they should be package globals
('our' variables) rather than file lexicals ('my' variables), viz.:
file1:
do 'file2';
print $var;
file2:
our $var = 'hello world';
Note that even when using eval `cat file`, lexicals cannot pass out from
the included file to the including file, that is
file1:
eval `< file2`; # no need for useless-use-of-cat :)
print $var;
file2:
my $var = 'hello world';
will *not* print 'hello world'.
Using a module to hold the config information is better again, though,
as it allows you more control over which bits of config information you
import into your namespace at a given time.
Ben
--
The cosmos, at best, is like a rubbish heap scattered at random.
- Heraclitus
ben@morrow.me.uk
------------------------------
Date: Fri, 20 Feb 2004 13:46:11 +0000 (UTC)
From: Guru03 <Guru03@despammed.com>
Subject: Email::Valid bug?
Message-Id: <Xns9495963EA12B3Guru03despammedcom@193.43.96.1>
Hi, i tried this:
print Email::Valid->rfc822 ('ppp@ppp.com');
and it says OK. But:
print Email::Valid->rfc822 ('<ppp@ppp.com>');
it says error. Why?
Email::Valid is not good...
------------------------------
Date: 20 Feb 2004 14:30:19 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: Email::Valid bug?
Message-Id: <slrnc3c6fr.dm5.xx087@smeagol.ncf.ca>
Guru03 <Guru03@despammed.com> wrote:
> print Email::Valid->rfc822 ('<ppp@ppp.com>');
> it says error. Why?
Because, according to RFC 822, it is not valid.
http://www.faqs.org/rfcs/rfc822.html
If you use <angle brackets>, you have to precede it with a phrase, which
is one or more words. This is valid:
Email::Valid->rfc822 ('my name <ppp@ppp.com>');
--
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca
------------------------------
Date: Fri, 20 Feb 2004 15:10:00 +0000 (UTC)
From: Guru03 <Guru03@despammed.com>
Subject: Re: Email::Valid bug?
Message-Id: <Xns9495A474ADCE3Guru03despammedcom@193.43.96.1>
Glenn Jackman <xx087@freenet.carleton.ca> wrote in
news:slrnc3c6fr.dm5.xx087@smeagol.ncf.ca:
> Guru03 <Guru03@despammed.com> wrote:
>> print Email::Valid->rfc822 ('<ppp@ppp.com>');
>> it says error. Why?
>
> Because, according to RFC 822, it is not valid.
> http://www.faqs.org/rfcs/rfc822.html
>
> If you use <angle brackets>, you have to precede it with a phrase, which
> is one or more words. This is valid:
> Email::Valid->rfc822 ('my name <ppp@ppp.com>');
Mmmh...
it's RFC 2822 Valid. See in appendix A.1.2 of RFC 2822...
------------------------------
Date: Fri, 20 Feb 2004 10:45:58 -0500
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Email::Valid bug?
Message-Id: <20040220104526.R5358@dishwasher.cs.rpi.edu>
On Fri, 20 Feb 2004, Guru03 wrote:
> Glenn Jackman <xx087@freenet.carleton.ca> wrote in
> news:slrnc3c6fr.dm5.xx087@smeagol.ncf.ca:
>
> > Guru03 <Guru03@despammed.com> wrote:
> >> print Email::Valid->rfc822 ('<ppp@ppp.com>');
> >> it says error. Why?
> >
> > Because, according to RFC 822, it is not valid.
> > http://www.faqs.org/rfcs/rfc822.html
> >
> > If you use <angle brackets>, you have to precede it with a phrase, which
> > is one or more words. This is valid:
> > Email::Valid->rfc822 ('my name <ppp@ppp.com>');
>
> Mmmh...
>
> it's RFC 2822 Valid. See in appendix A.1.2 of RFC 2822...
There's a reason the method is called rfc822, not rfc2822.
Paul Lalli
------------------------------
Date: 20 Feb 2004 15:45:34 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: Email::Valid bug?
Message-Id: <slrnc3casu.9ap.xx087@smeagol.ncf.ca>
Guru03 <Guru03@despammed.com> wrote:
> Glenn Jackman <xx087@freenet.carleton.ca> wrote in
> > Guru03 <Guru03@despammed.com> wrote:
> >> print Email::Valid->rfc822 ('<ppp@ppp.com>');
> >> it says error. Why?
> >
> > Because, according to RFC 822, it is not valid.
[...]
>
> Mmmh...
>
> it's RFC 2822 Valid. See in appendix A.1.2 of RFC 2822...
It's too bad that Email::Valid doesn't have a rfc2822 method, isn't it?
--
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca
------------------------------
Date: Fri, 20 Feb 2004 07:41:17 -0500
From: "Steven N. Hirsch" <shirsch@adelphia.net>
Subject: Re: Example of web application done right?
Message-Id: <su6dnTpvqMvxnavd4p2dnA@adelphia.com>
thumb_42@yahoo.com wrote:
> It was 4 years ago. (During the tail of the dot-com era) mod_perl *was* nice
> for the simple things, but when I used it for stuff like storing database
> connections (and yes, I used Apache::DBI) I had terrible memory leaks. Tried
> different variations of them but couldn't weed them out. Removed DBI and the
> leaks went away.
>
> Now I *know* others didn't have this problem, in fact, most people probably
> didn't. So, maybe it had something to do with the other modules I was using,
> maybe it had to do with the order they were loaded in, could have been
> a buggy database driver, I really don't know. (was using DB2 if that matters)
There have been other comments on the net alluding to memory leaks with
certain versions of DBD::DB2. Did you report it to DB2 support? IIRC,
the DBI driver is a supported application.
------------------------------
Date: Fri, 20 Feb 2004 11:34:48 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: FORM POST submission
Message-Id: <Pine.LNX.4.53.0402201122110.821@ppepc56.ph.gla.ac.uk>
On Fri, 20 Feb 2004, Gregory Toomey wrote:
> Andrew V. Tkachenko wrote:
>
> > I'm not sure its a good idea to pass passwords through GET method. They
> > may be viewed in log files either by admin or by successfull hacker :)
There's a generic URL syntax for providing passwords as part of a URL,
and such passwords would indeed get logged; but for the http://
scheme, the use of this generic syntax is explicitly excluded. Basic
authentication credentials are supposed to be provided in response to
401 status (which in a typical browser would result in a user dialog).
Such credentials (passwords) are NOT logged, unless the server admin
has gone crazy.
The above is true irrespective of GET or POST. Sure, the actual
software implementations _do_ support supplying credentials as part of
the URL, despite the specifications ruling them out for http://, but
the fact that they're implemented doesn't mean it's a good idea to use
them (except maybe for special cases such as guest:guest).
Nevertheless, the credentials will be passed over the network "in
clear", and are thus insecure on the end-to-end path, unless https is
used.
> GET and POST offer the same level of security (ie none) unless you
> are using https.
Even there, if some idiot server admin decided to log the passwords,
all bets would be off. https only provides security over the network
path. You need some other kind of authentication if it's to be proof
against snoopers on the same machine.
> BTW, there's also a syntax to supply userid & password in the URL when using
> basic authentication ie those pop up boxes the browser gives you for some
> sites. The syntax to logon would be:
> http://userid:password@youresite.com/rest-of-url
That's exactly the problem, and that's exactly why the http:// URL
rules out this usage, even though it's defined in the generic URL
syntax.
(For URL read "URI", if you are so inclined ;-)
ref: rfc1738 section 3.1 "Common Internet Scheme Syntax" and
3.3 "HTTP". The latter says specifically:
| No user name or password is allowed.
(, not that implementers have felt themselves much constrained by this
prohibition.)
I think you'll find this confirmed in later RFCs.
------------------------------
Date: 20 Feb 2004 07:35:36 -0800
From: h.muench@substring.ch (hagen)
Subject: IO::Socket::INET: Address already in use
Message-Id: <1ff2226.0402200735.1f26e6e4@posting.google.com>
I try to write a dhcp-client to get user defined dhcp option.I'm
stranding already with this reduced script:
#!/usr/bin/perl
use IO::Socket::INET;
$sock = IO::Socket::INET->new(ReuseAddr => '1',
LocalPort => '68',
Proto => 'udp') or die "can't bind:
$@\n";
this dies with: "IO::Socket::INET: Address already in use"
some ideas?
thanx, hagen
------------------------------
Date: Fri, 20 Feb 2004 16:42:03 +0100
From: "chatiman" <chatiman@free.fr>
Subject: Re: IO::Socket::INET: Address already in use
Message-Id: <40362ad1$0$29955$626a14ce@news.free.fr>
If i remember when you close a socket, it stays open for a certain amount of
time (a few minutes or seconds).
So you have to wait a bit before you open the socket for a second time.
"hagen" <h.muench@substring.ch> a écrit dans le message de news:
1ff2226.0402200735.1f26e6e4@posting.google.com...
> I try to write a dhcp-client to get user defined dhcp option.I'm
> stranding already with this reduced script:
>
> #!/usr/bin/perl
>
> use IO::Socket::INET;
>
> $sock = IO::Socket::INET->new(ReuseAddr => '1',
> LocalPort => '68',
> Proto => 'udp') or die "can't bind:
> $@\n";
>
> this dies with: "IO::Socket::INET: Address already in use"
>
> some ideas?
>
> thanx, hagen
------------------------------
Date: Fri, 20 Feb 2004 16:35:02 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: more stripping
Message-Id: <c159ha$1f0lm0$1@ID-184292.news.uni-berlin.de>
gnari wrote:
> "Michael Hill" <hillmw@ram.lmtas.lmco.com> wrote in message
> news:40355894.98456116@ram.lmtas.lmco.com...
>>
> [attribution to Gunnar lost]
>>> Again, I posted in this thread because security aspects were
>>> mentioned in such a way that you falsely could get the
>>> impression that using CGI.pm automatically takes care of them.
>>> If those comments hadn't been posted, I would have kept my
>>> mouth shut this time. ;-)
>>
>> And this was why I asked about security because it didn't seem
>> correct.
>
> see what you have done, Gunnar ?
> you have made support for hand-rolled cgi to a newbie that thinks
> that POST will make his script more secure
*If* that is a result of this thread, those who
- claim security reasons for not "hand-rolling" and then refer
to Google when OP asks for examples, or
- exemplify with security issues that need to be addressed
irrespective of the method for data parsing
are responsible for that result.
Btw, you were referring to OP's reply to your example with eval()ing
CGI parameters, right? Well, that is undoubtedly an example of
insecure programming, and POSTing data does of course not offer any
protection against it. On the other hand, you can well write similar
stupid code when using CGI.pm:
no strict;
use CGI;
$q = new CGI;
$$_ = $q->param($_) for $q->param;
If you *really* want to fight stupid behaviour among the Perl users,
you'd better show them, in a manner you would expect among decently
educated people, that you respect their intelligence and trust their
judgement. Doing so is by far the best way to teach a responsible,
secure programming style.
As regards CGI.pm: There are good, valid reasons for using it, some of
which have (also) been mentioned in this thread. Those reasons are
applicable to quite a few modules, btw.
If you want to *convince* people about the advantages with using
modules in general and CGI.pm in particular, please stick to those
reasons.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 20 Feb 2004 16:50:51 +0100
From: "chatiman" <chatiman@free.fr>
Subject: Newbie question on use
Message-Id: <40362ce1$0$22397$626a14ce@news.free.fr>
Hello again,
If i have 2 modules :
-------------------------
package A;
use lib "/path";
--------------------------
package B;
use A;
--------------------------
Will the package B search have "/path" in @INC ?
------------------------------
Date: Fri, 20 Feb 2004 21:13:08 +0800
From: "Regent" <arthur0421@163.com>
Subject: Parsing Word Doc files
Message-Id: <c15165$2rla$1@mail.cn99.com>
Hi, friends
I searched cpan in vain for a module that can read (parse) MS Word .doc files. Can someone refer me to one somewhere or give me a hint about the structure of such files? Thanks!
Regent
arthur0421@163.com
------------------------------
Date: Fri, 20 Feb 2004 14:54:50 GMT
From: Chris <ceo@nospan.on.net>
Subject: Re: Parsing Word Doc files
Message-Id: <_cpZb.41412$f96.12875@newssvr33.news.prodigy.com>
Regent wrote:
> Hi, friends
>
> I searched cpan in vain for a module that can read (parse) MS Word .doc files. Can someone refer me to one somewhere or give me a hint about the structure of such files? Thanks!
>
Assuming you are (1) on *nix and (2) wanting to use Perl to just get the
text from a Word document, trying piping the results of 'antiword' into
Perl:
$ antiword microslop.doc | perl script.pl # or...
$ antiword microslop.doc | perl -e 'while (<>) { chomp; do_stuff; }'
Chris
-----
Chris Olive
chris -at- --spammer-speed-bump-- technologEase -dot- com
http://www.technologEase.com
(pronounced "technologies")
------------------------------
Date: Fri, 20 Feb 2004 11:11:35 GMT
From: "Ian.H" <ian@WINDOZEdigiserv.net>
Subject: Re: Recommended mail module for plaintext sending?
Message-Id: <pan.2004.02.20.11.11.35.94684@hybris.digiserv.net>
On Tue, 17 Feb 2004 00:04:29 -0500, James Willmore wrote:
> On Mon, 16 Feb 2004 14:21:22 +0000, Ian.H wrote:
>
>> There are many mail modules on CPAN.. but are any recommended over
>> others for sending mails? This only needs to be simple and send
>> plaintext mails only. The lighter the module the better. I could do this
>> direct with IO::Socket but a light-weight module would be nicer =)
>
> I've had excellent results with Net::SMTP. Plus, the Debug option for the
> module has saved me numerous times when trying to get something to work
> (usually, the human interface is at fault :-( ).
[ snip ]
This seemed to be the ticket James. The debugging is useful and handles
authentication well too.. exactly what I was after =)
Many thanks.
Regards,
Ian
--
Ian.H
digiServ Network
London, UK
http://digiserv.net/
------------------------------
Date: Fri, 20 Feb 2004 07:18:33 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: regex
Message-Id: <rWmZb.11199$Cd6.785108@news20.bellglobal.com>
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnc3b40l.1eq.tadmc@magna.augustmail.com...
> yamini <yamini_rajan@nospam.com> wrote:
> > $tag="({NP_PP}|{NP_B})";
> > $tag1="({\/NP_PP}|{\/NP_B})";
> > $_="{NP_PP} kinase{/NP_PP} a {NP_B}tyrosine{/NP_B}";
> >
> > s/$tag[^{}]+$tag1/have/;
> > s/$tag[^{}]+$tag1/nice day/;
> > expected o/p:
> ^^^^^^^^^^^^
> ^^^^^^^^^^^^
>
> None.
>
> There are no output statements in the code you posted.
>
print $_;
He did post enough code to make it obvious that he isn't using his real
input, though, as his example outputs exactly what he expects it to.
Matt
------------------------------
Date: Fri, 20 Feb 2004 07:29:55 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Replacing a text in multiple files with regular expressions
Message-Id: <55nZb.11202$Cd6.785896@news20.bellglobal.com>
"Angel" <anichin@vip.bg> wrote in message
news:8732d910.0402192303.1f215d45@posting.google.com...
> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
news:<l55Zb.27814$5W3.6744@nwrddc02.gnilink.net>...
> > Angel wrote:
> >
> > Then why didn't you say so in the beginning?
> > And btw., no it is not possible to recurse through a directory structure
> > using REs. Those two have nothing to do with each other.
>
> I said that:
>
> "I would like to search and replace on many files located in
> different subfolders of one main folder."
>
No that was just what you said you were trying to accomplish. You said your
problem was that:
> I know it should be possible using regular expressions but
> all my attempts failed. Can anyone help me ?
The "it" in the above sentence refers back to your original problem, which
was to wrap all the images in anchor tags.
No one's interested in trying to read your mind. Next time state your
problem clearly.
Matt
------------------------------
Date: Fri, 20 Feb 2004 13:01:43 GMT
From: Beable van Polasm <beable+unsenet@beable.com.invalid>
Subject: Re: Search and replace problem
Message-Id: <8fy8qxq51e.fsf@dingo.beable.com>
Devop <as@hotmail.com> writes:
>
> This error is coming :
> Use of uninitialized value in substitution (s///)
>
> Is there any other way to solve this problem. Thanks.
>
>
> #!/usr/bin/perl -w
> #use strict;
Please don't comment out use strict. It is your friend.
> use warnings;
Good!
> my $infile = 'first.xml';
> my $outfile = 'second.xml';
>
>
> my $text1 = 'this is it =';
> my $text2 = '{and this is a new} OK '';
^^
This is wrong, surely.
> undef $/;
> open IN, $infile or die "couldn't open the file!";
This should be;
open IN, $infile or die "couldn't open the file: $!";
^^
Tells you what the error was
> my $intext = <IN>;
> close IN;
>
> $intext =s/$text1/$text2/gi;
Should be:
$intext =~ s/$text1/$text2/gi;
^^
Note typo.
> open OUT, ">$outfile" or die $!;
> print OUT $intext;
> close OUT;
Also, you might like to use one of the XML modules like XML::Simple
to deal with XML files, rather than using regular expressions.
--
------------------------------
Date: Fri, 20 Feb 2004 13:07:13 +0000
From: fifo <fifo@despammed.com>
Subject: Re: Search and replace problem
Message-Id: <20040220130710.GB18088@fleece>
At 2004-02-20 12:34 +0000, Devop wrote:
>
> HI. every one.
>
> I wanted to search a string from a file, then replace it, and write to
> the file again.
>
> But i have come up with this solution, where the replaced contents will
> be written in to the an other file.
>
> But it does not work.
>
> This error is coming :
> Use of uninitialized value in substitution (s///)
>
> Is there any other way to solve this problem. Thanks.
>
>
> #!/usr/bin/perl -w
> #use strict;
Why have you commented this out?
> use warnings;
>
> my $infile = 'first.xml';
> my $outfile = 'second.xml';
>
>
> my $text1 = 'this is it =';
> my $text2 = '{and this is a new} OK '';
This shouldn't have compiled ----------^
> undef $/;
> open IN, $infile or die "couldn't open the file!";
Print out $! as well as your message:
open IN, $infile or die "couldn't open the file: $!";
> my $intext = <IN>;
> close IN;
>
> $intext =s/$text1/$text2/gi;
Here's your error, this should be:
$intext =~ s/$text1/$text2/gi;
>
> open OUT, ">$outfile" or die $!;
> print OUT $intext;
> close OUT;
------------------------------
Date: Fri, 20 Feb 2004 07:52:05 -0500
From: "Steven N. Hirsch" <shirsch@adelphia.net>
Subject: Re: SOAP::Lite install problem
Message-Id: <su6dnTVvqMtun6vd4p2dnA@adelphia.com>
Dan Pelton wrote:
> I am trying to install SOAP::Lite on a Sun box.
> I tried installing the module using the following command and got the
> error "don't know what it is". I can get it directly from the authors
> web site, but I was wondering what my problem is? The author states that
> it has been testes under Perl 5.7.1. Does SOAP::Lite version 0.55 work
> under Perl 5.8?
FYI, I am seeing the same thing. SOAP::Lite seems to have vanished from
the CPAN indices between last Friday and the end of the weekend. Who is
in charge of PAUSE data-management?
Steve
p.s. - Yes, SOAP::Lite works fine under Perl 5.8.x assuming you can make
heads or tails out of the documentation.
------------------------------
Date: 20 Feb 2004 03:41:46 -0800
From: uffesterner@spamhole.com (Rex Gustavus Adolphus)
Subject: What with this open file descriptor/"Read on closed filehandle " stuff?
Message-Id: <c70a85ff.0402200341.566fcc47@posting.google.com>
Hej hej
This
I recently got problems with this (rather ugly, it was one of my
first) subroutine:
sub check_for_file {
my ($dbh, $filename,$wait_after_last_write, $msglevel) = @_;
my ($file);
my @files;
my $age_in_seconds;
&printlog($msglevel,3,"looking for $filename");
@files = glob($filename);
FILENAME: foreach $file (@files) {
next FILENAME unless -s $file; # next iteration of the
loop unless file exists
$age_in_seconds = time() - (stat($file))[9];
&printlog($msglevel,3,"Found $file, last changed
$age_in_seconds seconds ago."
. " Should be older than
$wait_after_last_write seconds");
return($file) if ($age_in_seconds >=
$wait_after_last_write);
}
return;
}
On a couple of rare, unrepeatable instances, this has caused the
following:
Read on closed filehandle <_GEN_0> at xxxx line 39, <_GEN_0> chunk
yyyyy.
where line 39 is the line with the call to glob.
I'm not at that site now, but it's an older perl, 5.005, I think,
running on Solaris, (sorry for being so vague).
I've done a bit of research and found this thread from last century:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=199905131922.OAA22891%40gallium.asic.sc.ti.com&rnum=2&prev=/groups%3Fnum%3D20%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3Dread%2Bon%2Bclosed%2Bfilehandle%2Bglob%26sa%3DN%26tab%3Dwg
This seems to be just like my case.
I didn't think my code opened any file descriptors at all.
In other parts of the program I am renaming or moving the found file
with this code:
sub move_file {
my ($dbh, $to_dir, $file, $msglevel) = @_;
my $target = $to_dir;
if ( -d $to_dir ) {
$target .= "/".basename($file);
}
&printlog($msglevel,3,"moving $file to $target");
if ( (rename $file => $target ) or move($file,$target) ) {
return $target;
} else {
printlog($msglevel,0,"rename $file to $target failed, system
message:$!");
rename $file => $file.time()
or die "$0 terminates due to problems moving
files:\n$0 $!\n";
return;
}
} # end of sub move_file
So finally my questions:
Does glob open file descriptors for the found files?
Does rename or File::move open file descriptors?
Would using File::glob solve the issue?
Thanx for reading so far.
------------------------------
Date: Fri, 20 Feb 2004 11:55:42 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: What with this open file descriptor/"Read on closed filehandle " stuff?
Message-Id: <c14sju$c84$1@wisteria.csv.warwick.ac.uk>
uffesterner@spamhole.com (Rex Gustavus Adolphus) wrote:
>
> sub check_for_file {
> my ($dbh, $filename,$wait_after_last_write, $msglevel) = @_;
> my ($file);
> my @files;
> my $age_in_seconds;
You don't really need to declare these up here: it's better to keep
variables in as small a scope as possible, and simply declare them the
first time you use them.
> &printlog($msglevel,3,"looking for $filename");
Don't call subs with & unless you need to (here you don't).
> @files = glob($filename);
> FILENAME: foreach $file (@files) {
> next FILENAME unless -s $file; # next iteration of the
> loop unless file exists
> $age_in_seconds = time() - (stat($file))[9];
You might consider using File::stat to make this clearer.
> &printlog($msglevel,3,"Found $file, last changed
> $age_in_seconds seconds ago."
> . " Should be older than
> $wait_after_last_write seconds");
>
> return($file) if ($age_in_seconds >=
> $wait_after_last_write);
> }
> return;
> }
>
> On a couple of rare, unrepeatable instances, this has caused the
> following:
> Read on closed filehandle <_GEN_0> at xxxx line 39, <_GEN_0> chunk
> yyyyy.
> where line 39 is the line with the call to glob.
>
> In other parts of the program I am renaming or moving the found file
> with this code:
...
> if ( (rename $file => $target ) or move($file,$target) ) {
There's no need to do that (I take it move() comes from File::Copy?) as
it will use rename if it can.
> I'm not at that site now, but it's an older perl, 5.005, I think,
> running on Solaris, (sorry for being so vague).
>
<snip>
> I didn't think my code opened any file descriptors at all.
>
> So finally my questions:
> Does glob open file descriptors for the found files?
On older perls (pre-5.6), glob is performed by forking a csh(1). This is
a Bad Thing, so it was replaced with File::Glob in 5.6.
> Does rename or File::move open file descriptors?
^^ Copy::, almost certainly
rename: no.
File::Copy::move: it depends on whether it could be done with rename or
if the file had to be copied then deleted.
> Would using File::glob solve the issue?
^ G
Yes.
Ben
--
"The Earth is degenerating these days. Bribery and corruption abound.
Children no longer mind their parents, every man wants to write a book,
and it is evident that the end of the world is fast approaching."
-Assyrian stone tablet, c.2800 BC ben@morrow.me.uk
------------------------------
Date: Fri, 20 Feb 2004 15:07:21 GMT
From: "Robert M." <rmarkoff@msn.com>
Subject: Re: your partner
Message-Id: <rmarkoff-43CF25.09072120022004@news4.west.earthlink.net>
In article <LWVYb.553$oj7.369@reader1.news.jippii.net>,
"Bob Smith" <bobsmith@[don't-even-think-about-it]jippii.fi> wrote:
>
> "Robert M." <rmarkoff@msn.com> wrote in message
> news:rmarkoff-C1FBCF.21021018022004@news4.west.earthlink.net...
> > In article <BoVYb.552$5X7.85@reader1.news.jippii.net>,
> > "Bob Smith" <bobsmith@[don't-even-think-about-it]jippii.fi> wrote:
> >
> > > http://www.geocities.com/etc
> >
> > "We prefer not to publish pricing" it says.
> >
> > Then whats the point of a web site?
> the point is to get the customer to talk,
You sell website development and you won't even buy yourself a domain
name?
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 6169
***************************************