[30622] in Perl-Users-Digest
Perl-Users Digest, Issue: 1867 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 22 06:09:43 2008
Date: Mon, 22 Sep 2008 03:09:09 -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 Mon, 22 Sep 2008 Volume: 11 Number: 1867
Today's topics:
Auto-downloading file from CPAN <nospam-abuse@ilyaz.org>
Re: Auto-downloading file from CPAN <ben@morrow.me.uk>
Re: Auto-downloading file from CPAN <nospam-abuse@ilyaz.org>
Re: Auto-downloading file from CPAN <brian.d.foy@gmail.com>
closing filehandle for tee STDOUT <yandry77@gmail.com>
Re: Easiest way to do this? <john@castleamber.com>
Re: Easiest way to do this? <brian.d.foy@gmail.com>
Memo2 - Free djroofdorsey@googlemail.com
Memo3 - Free djroofdorsey@googlemail.com
Memo4 - Free djroofdorsey@googlemail.com
Memo5 - Free djroofdorsey@googlemail.com
Perl Tk and Net issues mcarthey@gmail.com
qer <werwolf13@gmail.com>
Re: Regular express for <p>, <ul> and <ol> tags sln@netherlands.com
Re: Rename of FileName using PERL <joe@inwap.com>
testx1 - Free djroofdorsey@googlemail.com
testx2 - Free djroofdorsey@googlemail.com
why no output <sun_tong_001@users.sourceforge.net>
Re: why no output <tim@burlyhost.com>
Re: why no output <ben@morrow.me.uk>
Re: why no output <jurgenex@hotmail.com>
Re: why no output <sun_tong_001@users.sourceforge.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 21 Sep 2008 21:31:36 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Auto-downloading file from CPAN
Message-Id: <gb6efo$1g1l$1@agate.berkeley.edu>
I need to copy a file from CPAN (this file is not a Perl
distribution!) to the current directory - programmatically. I can
easily do it if I hardcode a CPAN site. Is there a simple way to do
this using user-preferences for CPAN access?
Thanks,
Ilya
------------------------------
Date: Sun, 21 Sep 2008 23:00:00 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Auto-downloading file from CPAN
Message-Id: <0osiq5-3ol.ln1@osiris.mauzo.dyndns.org>
Quoth Ilya Zakharevich <nospam-abuse@ilyaz.org>:
>
> I need to copy a file from CPAN (this file is not a Perl
> distribution!) to the current directory - programmatically. I can
> easily do it if I hardcode a CPAN site. Is there a simple way to do
> this using user-preferences for CPAN access?
use CPAN;
CPAN::HandleConfig->load;
print for @{ $CPAN::Config->{urllist} }
appears to give the list of mirrors, although it's undocumented, it
writes some rubbish to STDOUT, and it will start a user-configuration
dialogue if some of the parameters are missing.
Ben
--
It will be seen that the Erwhonians are a meek and long-suffering people,
easily led by the nose, and quick to offer up common sense at the shrine of
logic, when a philosopher convinces them that their institutions are not based
on the strictest morality. [Samuel Butler, paraphrased] ben@morrow.me.uk
------------------------------
Date: Mon, 22 Sep 2008 03:36:32 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Auto-downloading file from CPAN
Message-Id: <gb73s0$1n8m$1@agate.berkeley.edu>
[A complimentary Cc of this posting was NOT [per weedlist] sent to
Ben Morrow
<ben@morrow.me.uk>], who wrote in article <0osiq5-3ol.ln1@osiris.mauzo.dyndns.org>:
>
> Quoth Ilya Zakharevich <nospam-abuse@ilyaz.org>:
> >
> > I need to copy a file from CPAN (this file is not a Perl
> > distribution!) to the current directory - programmatically. I can
> > easily do it if I hardcode a CPAN site. Is there a simple way to do
> > this using user-preferences for CPAN access?
>
> use CPAN;
> CPAN::HandleConfig->load;
> print for @{ $CPAN::Config->{urllist} }
>
> appears to give the list of mirrors, although it's undocumented, it
> writes some rubbish to STDOUT, and it will start a user-configuration
> dialogue if some of the parameters are missing.
Hmm, this is exactly the type of mess I would like to avoid. Maybe
calling CPAN::Config (?) directly would be more approriate? Anyone
with an experience?
Thanks,
Ilya
------------------------------
Date: Mon, 22 Sep 2008 01:01:45 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: Auto-downloading file from CPAN
Message-Id: <220920080101456736%brian.d.foy@gmail.com>
In article <gb73s0$1n8m$1@agate.berkeley.edu>, Ilya Zakharevich
<nospam-abuse@ilyaz.org> wrote:
> > use CPAN;
> > CPAN::HandleConfig->load;
> > print for @{ $CPAN::Config->{urllist} }
> Hmm, this is exactly the type of mess I would like to avoid. Maybe
> calling CPAN::Config (?) directly would be more approriate? Anyone
> with an experience?
CPAN::Config->load is now CPAN::HandleConfig->load. There really isn't
any other way of doing this. If you look inside CPAN.pm you'll see that
the point of load() is to create $CPAN::Config, a hash reference, and
everything after that is a hash access.
I just hacked the cpan script to allow someone to load their own
config, but that doesn't do much for you because it would be an
external process. One of the features I've got on my todo list is a
switch to simply fetch a distro (but not unpack it, etc).
Adam and Andreas recently (or are close to) added a mirrors list to
PAUSE so you could download a known file and have easy access to
various mirrors (easier than MIRRORED>BY, anyway). The Mirror::*
concept is to be able to quickly find the fastest mirror by pinging a
bunch of them.
http://search.cpan.org/dist/Mirror-YAML
You could also use that list to present to the user. Only recently
tested good mirrors should be in there.
------------------------------
Date: Mon, 22 Sep 2008 02:16:20 -0700 (PDT)
From: Andry <yandry77@gmail.com>
Subject: closing filehandle for tee STDOUT
Message-Id: <0efba21a-0f4d-4e1f-82aa-1e7fcaa9028c@z66g2000hsc.googlegroups.com>
Hi all,
I have a problem trying to "tee" STDOUT at some intervals, opening and
closing filehandles.
The following is a sample script:
******************************************************************
#!/usr/bin/perl -w
use File::Tee qw(tee);
$|=1;
open my $target1, '>', 'log1.txt';
tee STDOUT, $target1;
print "line one\n";
close $target1;
open my $target2, '>', 'log2.txt';
tee STDOUT, $target2;
print "line two\n";
close $target2;
*******************************************************************
Given the above script, I expect to write "line one" in log1.txt and
"line two" in log2.txt.
Instead I get both "line one" and "line two" in log1.txt (while
log2.txt only includes "line two").
So I cannot manage to close log1.txt after printing "line one".
Can anyone help with that?
Thank you,
Andrea
------------------------------
Date: 21 Sep 2008 14:36:49 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Easiest way to do this?
Message-Id: <Xns9B2061CC2AF9Dcastleamber@130.133.1.4>
Pilcrow <pilcrow6@gmail.com> wrote:
> you *did* say 'ceiling function'? So ceil(0.14) would be 0.15, *if*
> perl had a ceiling function.
perldoc -q ceil
--
John http://johnbokma.com/ - Hacking & Hiking in Mexico
Perl help in exchange for a gift:
http://johnbokma.com/perl/help-in-exchange-for-a-gift.html
------------------------------
Date: Sun, 21 Sep 2008 13:57:44 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: Easiest way to do this?
Message-Id: <210920081357446933%brian.d.foy@gmail.com>
In article <o6pbd4t6ts73g9atifbctt7ke9hf67thfq@4ax.com>, Pilcrow
<pilcrow6@gmail.com> wrote:
> On Fri, 19 Sep 2008 10:13:29 -0700 (PDT), "void.no.spam.com@gmail.com"
> <void.no.spam.com@gmail.com> wrote:
>
> you *did* say 'ceiling function'? So ceil(0.14) would be 0.15, *if*
> perl had a ceiling function.
Well, Perl has the ceil() that comes with the POSIX module, which comes
in the Standard Library.
------------------------------
Date: Sun, 21 Sep 2008 15:30:27 -0700 (PDT)
From: djroofdorsey@googlemail.com
Subject: Memo2 - Free
Message-Id: <06b90c1b-0310-4779-80bc-531136a23c9b@k30g2000hse.googlegroups.com>
Memo2
.
.
.
*******CLICK HERE********
http://vids365.cn/Memo2
*****************************
.
.
.
.
.
.
.
.
.
.
.
.
Memo2
------------------------------
Date: Sun, 21 Sep 2008 15:32:42 -0700 (PDT)
From: djroofdorsey@googlemail.com
Subject: Memo3 - Free
Message-Id: <16688c9c-a8fc-44e2-ac03-05e2c41e17b7@k30g2000hse.googlegroups.com>
Memo3
.
.
.
*******CLICK HERE********
http://vids365.cn/Memo3
*****************************
.
.
.
.
.
.
.
.
.
.
.
.
Memo3
------------------------------
Date: Sun, 21 Sep 2008 15:32:50 -0700 (PDT)
From: djroofdorsey@googlemail.com
Subject: Memo4 - Free
Message-Id: <9192847b-6a3c-484c-bcde-0b1a3af89eee@d1g2000hsg.googlegroups.com>
Memo4
.
.
.
*******CLICK HERE********
http://vids365.cn/Memo4
*****************************
.
.
.
.
.
.
.
.
.
.
.
.
Memo4
------------------------------
Date: Sun, 21 Sep 2008 15:32:59 -0700 (PDT)
From: djroofdorsey@googlemail.com
Subject: Memo5 - Free
Message-Id: <63cf1378-af63-473e-91dd-ceb67cbb676c@d45g2000hsc.googlegroups.com>
Memo5
.
.
.
*******CLICK HERE********
http://vids365.cn/Memo5
*****************************
.
.
.
.
.
.
.
.
.
.
.
.
Memo5
------------------------------
Date: Sun, 21 Sep 2008 18:03:50 -0700 (PDT)
From: mcarthey@gmail.com
Subject: Perl Tk and Net issues
Message-Id: <9429c42a-b51a-4908-89e4-768a241478aa@s50g2000hsb.googlegroups.com>
I am having problems capturing the output from a cmd when using
Net::Telnet. I have been able to use both cmd() and the print() and
waitfor() combo, but with varying results.
I have done something like the following (please consider this a sort
of perl psuedo-code because I don't have my source in front of me)
$trm = new Net::Telnet
@output = $trm->cmd($cmd);
$txt->insert( 'end', @output ); #using Perl Tk
At this point, the text window does not completely display the output.
It only displays a few lines of the output (which is from a 'ps'
command, by the way). The strange thing is that if I loop through the
output and display one line at a time then all the lines are there.
I have tried to use the combo of print() and waitfor() to send the
command and capture the output as well. This results in the text
window displaying the contents properly, but I lose the ability to
parse the output line-by-line because all lines of the output are in a
single string. I thought that perhaps I could break the multi-line
"scalar" into an array by splitting on /\n/ but it strangely wasn't
working.
If it matters, I am running the Perl script from ActivePerl on Windows
XP and connecting to a OSF1 Alpha box.
I'd appreciate some insight into this problem as it's driving me
crazy. I don't know if it's a limitation in how Net::Telnet builds the
output or a limitation in how Tk creates the text window.
Thanks much!
------------------------------
Date: Sun, 21 Sep 2008 15:20:47 -0700 (PDT)
From: werwolf <werwolf13@gmail.com>
Subject: qer
Message-Id: <e4b3a44b-ffbf-4abe-84d2-e18581f3f0df@m45g2000hsb.googlegroups.com>
qwer
------------------------------
Date: Sun, 21 Sep 2008 22:17:11 GMT
From: sln@netherlands.com
Subject: Re: Regular express for <p>, <ul> and <ol> tags
Message-Id: <vhhdd45q95bndih6kbbkkocnemunj23npj@4ax.com>
On Sun, 21 Sep 2008 04:42:42 -0700, Jürgen Exner <jurgenex@hotmail.com> wrote:
<your bullshit deleted>
>So what?
>
>>WHAT, YOU WANT TO PARSE HTML WITH THE SIMPLEST REGULAR EXPRESSION ???????
maybe I should have put an 'S' on the end of this
>>Simple, and stupid, and the most basic!!!!
>
>Not possible. As has been _PROVEN_ in the past 4 decades many times over
>you cannot parse a context-sensitive language with regular expressions.
>If a language can be parsed with REs then it is a regular language. If
>it is not a regular language, then it cannot be parsed with RE.
>That's where the name regular expression originates.
>
<other bullshit deleted>
>
>robic0, robic0, .... somehow that rings a bell. Indeed, there was that
>troll who infested this NG a few years ago:
>http://groups.google.com/groups?as_q=robic0+and+PLONK&as_ugroup=comp.lang.perl.misc
>
>I thought I smelled the same stench of clueless ignorance again.
>
>*PLONK*
>
>jue
You are indeed an utter, and complete moron!
sln
------------------------------
Date: Mon, 22 Sep 2008 01:29:36 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Rename of FileName using PERL
Message-Id: <sL6dnRVsX4LwykrVnZ2dnUVZ_szinZ2d@comcast.com>
Laarni wrote:
> I need to rename all the files in the directory with this format:
>
> Original FileName : txn.data
> New File Name : txn.0000000001.data (where 0000000001 come from the
> database table where column is seqquence number. The 0000000001 is
> incrementing)
1) Read all the names in the directory using opendir() and readdir().
2) For each name, decide if it is appropriate to process, maybe using grep().
3) Perform a database query, giving it the file name and receiving a sequence number.
4) Build a new file name from the old one and the sequence number.
5) Use rename() to change the file name.
Which step is giving you trouble?
-Joe
------------------------------
Date: Sun, 21 Sep 2008 15:40:59 -0700 (PDT)
From: djroofdorsey@googlemail.com
Subject: testx1 - Free
Message-Id: <3f23278f-e0f5-4465-af06-44b4033c63fa@26g2000hsk.googlegroups.com>
testx1
.
.
.
*******CLICK HERE********
http://vids365.cn/testx1
*****************************
.
.
.
.
.
.
.
.
.
.
.
.
testx1
------------------------------
Date: Sun, 21 Sep 2008 15:41:11 -0700 (PDT)
From: djroofdorsey@googlemail.com
Subject: testx2 - Free
Message-Id: <d1c4995c-2695-42f7-93c1-ec0d9e0b841d@r66g2000hsg.googlegroups.com>
testx2
.
.
.
*******CLICK HERE********
http://vids365.cn/testx2
*****************************
.
.
.
.
.
.
.
.
.
.
.
.
testx2
------------------------------
Date: Sun, 21 Sep 2008 16:00:27 -0500
From: * Tong * <sun_tong_001@users.sourceforge.net>
Subject: why no output
Message-Id: <cfGdnRyz9OZ2KEvVnZ2dnUVZ_q_inZ2d@golden.net>
Hi,
For the following simple code,
for(;;){
print ". ";
sleep 1;
}
My intent is to output something on the same line every second. However,
when I run it, there is no output. Why is that? because of flushing or...?
How can I fix it?
Thanks
tong
------------------------------
Date: Sun, 21 Sep 2008 14:08:03 -0700
From: Tim Greer <tim@burlyhost.com>
Subject: Re: why no output
Message-Id: <UIyBk.27217$QF5.17404@newsfe08.iad>
* Tong * wrote:
> for(;;){
> print ". ";
> sleep 1;
> }
Put: $| = 1; above that, otherwise it'll just sleep for 1 second forever
looping, before it wants to print.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Sun, 21 Sep 2008 22:13:51 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: why no output
Message-Id: <f1qiq5-fkk.ln1@osiris.mauzo.dyndns.org>
Quoth * Tong * <sun_tong_001@users.sourceforge.net>:
>
> For the following simple code,
>
> for(;;){
> print ". ";
> sleep 1;
> }
>
> My intent is to output something on the same line every second. However,
> when I run it, there is no output. Why is that? because of flushing or...?
Because by default output is buffered. See $| in perldoc perlvar for how
to turn it off.
Ben
--
And if you wanna make sense / Whatcha looking at me for? (Fiona Apple)
* ben@morrow.me.uk *
------------------------------
Date: Sun, 21 Sep 2008 15:12:25 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: why no output
Message-Id: <mjhdd49ligdd4acbleggjp55ovpmlsj8kk@4ax.com>
* Tong * <sun_tong_001@users.sourceforge.net> wrote:
>For the following simple code,
>
> for(;;){
> print ". ";
> sleep 1;
> }
>
>My intent is to output something on the same line every second. However,
>when I run it, there is no output. Why is that? because of flushing or...?
No, because of buffering.
>How can I fix it?
See 'perldoc -q output':
How do I flush/unbuffer an output filehandle? Why must I do
this?
jue
------------------------------
Date: Sun, 21 Sep 2008 17:39:56 -0500
From: * Tong * <sun_tong_001@users.sourceforge.net>
Subject: Re: why no output
Message-Id: <KKednQRQ8ZShUEvVnZ2dnUVZ_tninZ2d@golden.net>
On Sun, 21 Sep 2008 15:12:25 -0700, Jürgen Exner wrote:
>>My intent is to output something on the same line every second. However,
>>when I run it, there is no output. Why is that? because of flushing
>>or...?
>
> No, because of buffering.
Thanks every one for the reply. Just for the archive, I added
local $| = 1;
above the loop to ask Perl explicitly to flush after each write to solve
the problem.
tong
------------------------------
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 V11 Issue 1867
***************************************