[24785] in Perl-Users-Digest
Perl-Users Digest, Issue: 6938 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 31 18:06:14 2004
Date: Tue, 31 Aug 2004 15:05:06 -0700 (PDT)
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, 31 Aug 2004 Volume: 10 Number: 6938
Today's topics:
Re: Execute Windows program from Perl script (??) <zebee@zip.com.au>
Help: Open an URL an keep reading from it, non-blocking <postmaster@castleamber.com>
Re: Larry Wall & Cults <shannon@news.widomaker.com>
Re: Larry Wall & Cults (Brian {Hamilton Kelly})
Re: OS/2 port of Perl 5.8 not adding CR to \n <nospam-abuse@ilyaz.org>
Re: OS/2 port of Perl 5.8 not adding CR to \n <pweilba@gwdg.de>
Re: perl pattern matching <peter@semantico.com>
Re: perl pattern matching <glex_nospam@qwest.invalid>
Re: problems with MIME:Lite timeout <jwillmore@adelphia.net>
Re: problems with MIME:Lite timeout <noreply@gunnar.cc>
Reading UTF-8 string from file with read() function. (Sergei)
Re: Reading UTF-8 string from file with read() function <nobull@mail.com>
Regex matching a string that DOESN'T contain a given wo (alan)
Re: Regex matching a string that DOESN'T contain a give <mritty@gmail.com>
Re: Regex matching a string that DOESN'T contain a give <tore@aursand.no>
Re: Regex matching a string that DOESN'T contain a give <dwall@fastmail.fm>
Re: unexpected EXTENDED_OS_ERROR on Windows <Joe.Smith@inwap.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 31 Aug 2004 21:03:39 GMT
From: Zebee Johnstone <zebee@zip.com.au>
Subject: Re: Execute Windows program from Perl script (??)
Message-Id: <slrncj9pil.qc.zebee@zeus.zipworld.com.au>
In comp.lang.perl.misc on 31 Aug 2004 07:43:37 -0700
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
> *** post for FREE via your newsreader at post.newsfeed.com ***
>
>>>>>> "Zebee" == Zebee Johnstone <zebee@zip.com.au> writes:
>
>Zebee> But I think most people are lost and really dont' understand what to ask
>Zebee> yet.
>
> Then they should find a help desk. Usenet is not a help desk.
WHich is what learn.perl.org *is* more or less. WHich is why I'm having
trouble working out why you are opposed to telling people it's there and
go to it.
After all, where are non-corporate people going to find a help desk
about perl if the community doesn't provide it?
> Neither are the mailing lists that you keep waving about at
> learn.perl.org, which have less noise only because they also have less
> signal. If those mailing lists handled as much volume as this
> newsgroup, the noise would go up significantly.
Noise isn't the problem, it's how the noise is handled.
>
And the tribalism is precisely the problem that they are trying to
solve. I hope they can continue to be successful in it.
Zebee
------------------------------
Date: 31 Aug 2004 21:39:45 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Help: Open an URL an keep reading from it, non-blocking
Message-Id: <Xns9556A97A6215castleamber@130.133.1.4>
A web based chat uses a method I call infinite loading. Basically the
browser opens the url, but it never stops, like it is downloading an
infinite long page. The chat system just keeps adding new lines.
Is there a way to do this in Perl. I mean, is there a module that let's me
see if there is data available, and read it, and move on in a loop?
I can write it, but I don't like reinventing wheels.
Thanks,
John
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Tue, 31 Aug 2004 11:35:59 -0400
From: Charles Shannon Hendrix <shannon@news.widomaker.com>
Subject: Re: Larry Wall & Cults
Message-Id: <vs52hc.89m.ln@escape.goid.lan>
["Followup-To:" header set to alt.folklore.computers.]
On 2004-08-26, Markus Wankus <markus_wankusGETRIDOFALLCAPS@hotmail.com> wrote:
>>>I think you're getting confused with the Blue Öyster Cult.
>>>Don't Fear the Reaper - great song.
>>
>>
>
> It was a great song, but it needed more cowbell...
Well, there is always Witchunt by Rush...
--
shannon "AT" widomaker.com -- ["Tara is grass, and behold how Troy lieth
low--And even the English, perchance their hour will come!"]
------------------------------
Date: Mon, 30 Aug 2004 23:27:45 +0100 (BST)
From: bhk@dsl.co.uk (Brian {Hamilton Kelly})
Subject: Re: Larry Wall & Cults
Message-Id: <20040830.2227.57577snz@dsl.co.uk>
On Sunday, in article
<pan.2004.08.30.00.02.19.911327@bar.net> foo@bar.net "Mac"
wrote:
> Hmm. No explicit comparison was made, but since the post is a cautionary
> tale (well, the post is a rambling mess, but I think it is trying to be a
> cautionary tale) I think the comparison is understood.
"Cautionary tale"???? Cautionary tale, my arse.
The post was the fuckwitted ramblings of a total raving looney; kill the
thread (and the original poster) and forget about it.
--
Brian {Hamilton Kelly} bhk@dsl.co.uk
"I don't use Linux. I prefer to use an OS supported by a large multi-
national vendor, with a good office suite, excellent network/internet
software and decent hardware support."
------------------------------
Date: Tue, 31 Aug 2004 19:09:39 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: OS/2 port of Perl 5.8 not adding CR to \n
Message-Id: <ch2idj$h3o$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Shmuel (Seymour J.) Metz
<spamtrap@library.lspace.org.invalid>], who wrote in article <4133ff54$4$fuzhry+tra$mr2ice@news.patriot.net>:
> That is, I wanted to verify that the Perl at
> <http://www.cpan.org/authors/id/I/IL/ILYAZ/os2/582+/> is in fact the
> most recnt OS/2 port.
Since it is not a port, but a build, your question does not make sense.
> >What bug?
>
> The code
>
> print "testline1a\ntestline1b\n","testline2\n";
> print "testline2\n";
This is not a code somebody can run. Try
perl -we "%ENV=(); system $^X, @ARGV" -- -e "print qq(a\nb\n)"
(This starts a kid Perl process without any environment. You may need
to double % if you start it from 4os2.)
Hope this helps,
Ilya
------------------------------
Date: 31 Aug 2004 20:48:29 GMT
From: "Peter Weilbacher" <pweilba@gwdg.de>
Subject: Re: OS/2 port of Perl 5.8 not adding CR to \n
Message-Id: <F3cu0n62uTsd-pn2-1EfiZ5UMVyXX@gaston.Weilbacher.org>
On Tue, 31 Aug 2004 19:09:39 UTC, Ilya Zakharevich wrote:
> Since it is not a port, but a build, your question does not make sense.
But you could still try to answer the question he really has. :-)
At least I am using that version and it works quite well for me.
Although I almost only use it for Mozilla compilation currently (which
makes quite heavy use of perl scripts).
> > The code
> >
> > print "testline1a\ntestline1b\n","testline2\n";
> > print "testline2\n";
>
> This is not a code somebody can run.
No, but if I put that into a test.pl and then run perl test.pl I get
[M:\PETER]perl test.pl
testline1a
testline1b
testline2
testline2
[M:\PETER]
Where the linebreaks really are 0x0d, 0x0a.
> Try
>
> perl -we "%ENV=(); system $^X, @ARGV" -- -e "print qq(a\nb\n)"
That gives me
[M:\PETER]perl test.pl
a
b
[M:\PETER]
just as expected. If Shmuel does not then something is probably wrong
with the installation.
--
Greetings, Please reply in newsgroup, I rarely
Peter. read emails to pweilba@gwdg.de...
------------------------------
Date: Tue, 31 Aug 2004 16:18:53 +0100
From: Peter Hickman <peter@semantico.com>
Subject: Re: perl pattern matching
Message-Id: <413496de$0$11789$afc38c87@news.easynet.co.uk>
Niko wrote:
> Hi,
>
> i need help replacing string in the middle of line like this :
>
>
> var1:string:yyy:zzz:kkk.....:ggg
>
>
> Need to replace the string.
>
> I already know the value of var1, that help me to find the specific line in my file.
>
> only left is to replace the string with a new string.
>
> any idea ?
>
> Thanks.
Well this works but it assumes that : is a field delimiter and does not appear
in the data, specifically it does not appear in the first two fields.
$x = 'var1:string:yyy:zzz:kkk:ggg';
@l = split(':', $x);
$l[1] = 'fred';
$x = join(':', @l);
print "$x\n";
------------------------------
Date: Tue, 31 Aug 2004 10:51:46 -0500
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: perl pattern matching
Message-Id: <m81Zc.10$Iv3.18891@news.uswest.net>
Niko wrote:
> Hi,
>
> i need help replacing string in the middle of line like this :
>
>
> var1:string:yyy:zzz:kkk.....:ggg
>
>
> Need to replace the string.
>
> I already know the value of var1, that help me to find the specific line in my file.
>
> only left is to replace the string with a new string.
>
> any idea ?
>
> Thanks.
I'm guessing you want to replace 'string', in your example line above,
with another value and you know the beginning of the line you want to
replace, which in this case is 'var1'.
my $str = 'var1:string:abcd:edfg';
my $beg = 'var1';
my $new_string = 'new_value1';
$str =~ s/^$beg:([^:]*)/$beg:$new_string/;
print $str, "\n";
In the future, it'd really help others if there was code or a few lines
of data, showing cases where you want the line changed and where you
don't want them changed. That would help find a more accurate solution.
See ya
------------------------------
Date: Tue, 31 Aug 2004 12:59:04 -0400
From: James Willmore <jwillmore@adelphia.net>
To: dan baker <botfood@yahoo.com>
Subject: Re: problems with MIME:Lite timeout
Message-Id: <4134AE58.80905@adelphia.net>
<CC to you - posted to group>
dan baker wrote:
> I am trying to build a simple little script using MIME:Lite to run
> through about 200 email addresses and send a simple text message. I
> seem to be having a problem with a timeout as it gets though 5 or ten
> addresses and then quits with the message:
> Failed to connect to mail server: Bad file descriptor
In replay to what you wrote about dealing with the timeout issue ...
..snip..
> here is a snippet, with some error checking removed for brevity:
>
> foreach $Recipient ( @tempList ) {
sleep 10; #or whatever value seems good for you
Since you need the script to not "ponud the living <insert explitive
here>" out of the server and counting/chomping/splitting/etc. doesn't
seem practical, this may be the best solution.
HTH
Jim
------------------------------
Date: Tue, 31 Aug 2004 20:07:55 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: problems with MIME:Lite timeout
Message-Id: <2pjt5iFm19j1U1@uni-berlin.de>
dan baker wrote:
> Gunnar Hjalmarsson wrote:
>> dan baker wrote:
>>> Failed to connect to mail server: Bad file descriptor
>>
>> Sounds like a server configuration thing to me.
>
> that is what I suspect... I use Comcast cable for my ISP, and
> apparently they have some "throttling" going on to attempt to
> control outgoing mail in case people get a virus, or try to spam
> the world.
Unfortunately, Comcast's customers are not just *trying* to spam the
world. One of the Comcast connected spammers is sending from a vast
number of open relay servers, forging "From:" addresses using my
domain name, and as a result my mail server receives 5-10 bounces per
minute - day after day, week after week... I have frantically tried
to call Comcast's attention to it, but not even a human reply. :(
Maybe your problem indicates that they are at least doing something
with respect to their own mail servers.
> I am not is a huge hurry to send out my couple hundred newsletters,
> so I am hoping that there is some way for me to use MIME:Lite to
> send a couple, disconnect, reconnect, and send a couple more... I
> just want to automate it so I dont have to manually chop the list
> up .
To be perfectly honest, and don't misunderstand me, personally I hope
that your problem is not too easily solved. ;-)
Some ISP's grant temporary permission to send bulk emails for a
specific reason. Don't know about Comcast, but maybe it would be worth
asking.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 31 Aug 2004 09:38:54 -0700
From: sergeisn-tma@yahoo.com (Sergei)
Subject: Reading UTF-8 string from file with read() function.
Message-Id: <1ce4f694.0408310838.68b92cb4@posting.google.com>
Hi,
I need to read a string from UTF-8 encoded text file.
I know at which byte position the string starts and its length (also
in byte units).
The problem is that read( FILEHANDLE,SCALAR,LENGTH) function takes
LENGTH in character units, not in bytes.
I've tried to open the file in binary mode instead of UTF-8, so I can
read the correct length, but then I can't process the string with
regular expressions correctly as Perl thinks it's in binary encoding,
not UTF-8.
Also, I've tried to read the string using getc() function, but it is
unacceptably slow.
Is there any solution ?
Thanks a lot,
--Sergei
------------------------------
Date: Tue, 31 Aug 2004 17:50:30 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Reading UTF-8 string from file with read() function.
Message-Id: <ch2a0p$dc6$1@sun3.bham.ac.uk>
Sergei wrote:
> I need to read a string from UTF-8 encoded text file.
> I know at which byte position the string starts and its length (also
> in byte units).
> The problem is that read( FILEHANDLE,SCALAR,LENGTH) function takes
> LENGTH in character units, not in bytes.
> I've tried to open the file in binary mode instead of UTF-8, so I can
> read the correct length, but then I can't process the string with
> regular expressions correctly as Perl thinks it's in binary encoding,
> not UTF-8.
> Is there any solution ?
Read the string from file as binary and then utf8::decode() it.
------------------------------
Date: 31 Aug 2004 12:07:25 -0700
From: alanbrown@pacbell.net (alan)
Subject: Regex matching a string that DOESN'T contain a given word
Message-Id: <ff1cce22.0408311107.5b3a5760@posting.google.com>
I have a tough little nut to crack, and I'm no regexpert so I thought
I'd see if anyone out there had a solution.
I need to match strings that represent directory structures. I want
to know if I have a directory represented in my file that is
underneath directory a/b/c
However, I'm not interested if it's directory a/b/c/tests/...
so I need someway to filter that out of my matches.
But I have to do it in one regex expression because I'm forced to use
a grepping tool from within my application that takes a regular
expression.
Surely this isn't as hard as it seems like it is to me.
Can anyone help me with the pattern for this?
alan
------------------------------
Date: Tue, 31 Aug 2004 19:46:47 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Regex matching a string that DOESN'T contain a given word
Message-Id: <HA4Zc.36$e26.12@trndny02>
"alan" <alanbrown@pacbell.net> wrote in message
news:ff1cce22.0408311107.5b3a5760@posting.google.com...
> I have a tough little nut to crack, and I'm no regexpert so I thought
> I'd see if anyone out there had a solution.
>
> I need to match strings that represent directory structures. I want
> to know if I have a directory represented in my file that is
> underneath directory a/b/c
>
> However, I'm not interested if it's directory a/b/c/tests/...
>
> so I need someway to filter that out of my matches.
>
> But I have to do it in one regex expression because I'm forced to use
> a grepping tool from within my application that takes a regular
> expression.
>
> Surely this isn't as hard as it seems like it is to me.
>
> Can anyone help me with the pattern for this?
This question pops up in this group every other month or so. I'm almost
surprised it's not a FAQ yet. The solution is to use a negative
lookahead assertion (read about them in perldoc perlre )
#!/usr/bin/perl
use strict;
use warnings;
while (<DATA>) {
print if /^(?!.*foobar)/;
}
__DATA__
This has foobar in it.
This does not.
foobar at the start.
ends with foobar
Output:
This does not.
That regexp is saying "Match the beginning of the string and then check
to see if 'foobar' does not follow anything in the string"
Hope this helps.
Paul Lalli
------------------------------
Date: Tue, 31 Aug 2004 22:04:28 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: Regex matching a string that DOESN'T contain a given word
Message-Id: <pan.2004.08.31.20.04.28.546617@aursand.no>
On Tue, 31 Aug 2004 19:46:47 +0000, Paul Lalli wrote:
> while (<DATA>) {
> print if /^(?!.*foobar)/;
> }
Why use a regular expression for this? Isn't it more convenient (at least
performance wise) to use the 'index' function?
--
Tore Aursand <tore@aursand.no>
"Poor management can increase software costs more rapidly than any
other factor." (Barry Boehm)
------------------------------
Date: Tue, 31 Aug 2004 21:10:52 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: Regex matching a string that DOESN'T contain a given word
Message-Id: <Xns9556AEC826A44dkwwashere@216.168.3.30>
Tore Aursand <tore@aursand.no> wrote in message
<news:pan.2004.08.31.20.04.28.546617@aursand.no>:
> On Tue, 31 Aug 2004 19:46:47 +0000, Paul Lalli wrote:
>> while (<DATA>) {
>> print if /^(?!.*foobar)/;
>> }
>
> Why use a regular expression for this? Isn't it more convenient
> (at least performance wise) to use the 'index' function?
If I understand the OP correctly, he isn't even using Perl:
"But I have to do it in one regex expression because I'm forced to use
a grepping tool from within my application that takes a regular
expression."
------------------------------
Date: Tue, 31 Aug 2004 18:26:51 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: unexpected EXTENDED_OS_ERROR on Windows
Message-Id: <Lp3Zc.10028$_g7.4879@attbi_s52>
Griff wrote:
> system($cmdstr);
> print "$^E";
$^E is set if there is an error.
$^E is *not* cleared on success; the previous (and now
irrelevant) error message is still there.
-Joe
------------------------------
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 6938
***************************************