[29845] in Perl-Users-Digest
Perl-Users Digest, Issue: 1088 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 3 09:09:44 2007
Date: Mon, 3 Dec 2007 06:09:06 -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 Mon, 3 Dec 2007 Volume: 11 Number: 1088
Today's topics:
Re: ActiveState Perl 5.10 under Windows XP <bik.mido@tiscalinet.it>
ANNOUNCE: Image::Magick::PolyText V 1.0.0 ron@savage.net.au
eBay API Programming admin@combatpaintball.net
execute a shell script in a shell script <moongeegee@gmail.com>
File::Find make me mad <walter.newsgroup@gmail.com>
Re: File::Find make me mad <krahnj@telus.net>
Re: File::Find make me mad <xueweizhong@gmail.com>
Re: Increment in nested loop <tlissner@gmail.com>
new CPAN modules on Mon Dec 3 2007 (Randal Schwartz)
Re: OT raibow <nospam-abuse@ilyaz.org>
Re: OT raibow <stoupa@practisoft.cz>
Re: Perl and a Ramdisk <bugbear@trim_papermule.co.uk_trim>
Re: what "shift" does, if not "$_ = shift;" ? <joe@inwap.com>
Re: writing to a notepad in perl (hymie!)
Re: YI,A Liang ! I love this game! www.netfashion2008.c indifferente32@gmail.com
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 02 Dec 2007 21:40:59 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: ActiveState Perl 5.10 under Windows XP
Message-Id: <j266l35r57sf5p5mnvdftcnfc2a8er0628@4ax.com>
On Sun, 2 Dec 2007 10:35:27 -0800 (PST), dilbert1999@gmail.com wrote:
>(the only alteration I had to make was to move the line "property for
>(...)" below the sub property(_) definition)
Of course...
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Mon, 3 Dec 2007 00:29:03 GMT
From: ron@savage.net.au
Subject: ANNOUNCE: Image::Magick::PolyText V 1.0.0
Message-Id: <JsG87n.4vG@zorch.sf-bay.org>
The pure Perl module Image::Magick::PolyText V 1.0.0
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.
On-line docs are available from the latter site.
This module allows you to draw text along a polyline.
An extract from the docs:
Revision history for Perl extension Image::Magick::PolyText.
1.0.0 Mon Nov 26 12:00:00 2007
- Original version
- Note: The image examples/target.jpg was kindly prepared for me by
Francisco Ferreiro
------------------------------
Date: Mon, 3 Dec 2007 02:59:07 GMT
From: admin@combatpaintball.net
Subject: eBay API Programming
Message-Id: <fivrdr01dgi@news5.newsguy.com>
Sorry if this is the wrong place to ask for help, Its just the first place I
thought of.
I need someone who knows about working with the eBay API develper program.
Basically, I need someone who can mod a script or build a new one.
if you're not, no problem and thanks for reading my post. you can contack me
at: admin@combatpaintball.net thanks.
Please don't waste your time and mine by bashing me something as
insigificant as posting in the wrong place, becuase I wont read it or
respond to it okay.
------------------------------
Date: Mon, 3 Dec 2007 05:30:57 -0800 (PST)
From: moongeegee <moongeegee@gmail.com>
Subject: execute a shell script in a shell script
Message-Id: <e4776ccb-359c-4cb4-ac45-3546fbb6e66c@w40g2000hsb.googlegroups.com>
Please help.
I have been stumbled on this issue, please see below. I am unable to
execute a shell script in a shell script.
I need to use perl script but not others and have tried eval, -exec
and other on perl script but failed.
system"cleartool setview -exec \"cleartool describe -fmt 'On %Sd
modified %En and comment:\n %c\n\n' /myproject/vob/myprogram.C\"
my_lag ";
tks.
------------------------------
Date: Sun, 2 Dec 2007 19:10:56 -0800 (PST)
From: Alitaia <walter.newsgroup@gmail.com>
Subject: File::Find make me mad
Message-Id: <015402c0-0375-4367-94bc-7e76c719b02a@s19g2000prg.googlegroups.com>
I write a simple perl, del.pl, to use File::Find to find *.ape and
delete them. I can find the *.ape but can not del outside the
directory, can del them within the directory, I dont know what's
wrong.
for example:
If directory structure like this:
---./layer1
|
/layer2
|
a.ape
b.ape
with the following code, within layer2
#del.pl ./ a.ape and b.ape can be deleted
but if under ./layer1,
#del.pl ./layer2 a.ape, b.ape can be found but can not del
what is wrong?
#!/usr/bin/perl -w
#name: del.pl
use strict;
use File::Find;
sub wanted {
$_ = $File::Find::name;
if ( /\.ape$/ ) {
my $file = $File::Find::name;
print "Found ape file: $file\n";
#system "shntool", "conv", "-o", "flac", $File::Find::name;
my $cnt = unlink $file;
print "\$cnt is $cnt\n";
}
}
my $dir = shift;
$dir ||=".";
find (\&wanted, $dir);
------------------------------
Date: Mon, 03 Dec 2007 07:00:49 GMT
From: "John W. Krahn" <krahnj@telus.net>
Subject: Re: File::Find make me mad
Message-Id: <4753A99F.DFAE449D@telus.net>
Alitaia wrote:
>
> I write a simple perl, del.pl, to use File::Find to find *.ape and
> delete them. I can find the *.ape but can not del outside the
> directory, can del them within the directory, I dont know what's
> wrong.
>
> for example:
> If directory structure like this:
> ---./layer1
> |
> /layer2
> |
> a.ape
> b.ape
>
> with the following code, within layer2
> #del.pl ./ a.ape and b.ape can be deleted
>
> but if under ./layer1,
> #del.pl ./layer2 a.ape, b.ape can be found but can not del
>
> what is wrong?
>
> #!/usr/bin/perl -w
> #name: del.pl
> use strict;
> use File::Find;
perldoc File::Find
[ SNIP ]
You are chdir()'d to $File::Find::dir when the function is called,
unless no_chdir was specified.
> sub wanted {
If './layer1' is passed from the command line and the current file is
'./layer1/layer2/a.ape' then $File::Find::dir contains './layer1/layer2'
and $_ contains 'a.ape' and $File::Find::name contains
'./layer1/layer2/a.ape'.
> $_ = $File::Find::name;
Now both $_ and $File::Find::name contain './layer1/layer2/a.ape'. Why
are you doing this?
> if ( /\.ape$/ ) {
> my $file = $File::Find::name;
> print "Found ape file: $file\n";
> #system "shntool", "conv", "-o", "flac", $File::Find::name;
> my $cnt = unlink $file;
The current directory is './layer1/layer2' so unlink is looking for the
file in './layer1/layer2/layer1/layer2/a.ape' instead of the current
directory.
> print "\$cnt is $cnt\n";
> }
> }
> my $dir = shift;
> $dir ||=".";
> find (\&wanted, $dir);
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 3 Dec 2007 01:36:24 -0800 (PST)
From: Todd <xueweizhong@gmail.com>
Subject: Re: File::Find make me mad
Message-Id: <9645e45f-4718-44ce-8371-0e9f5207b6b6@e25g2000prg.googlegroups.com>
Hi,
I got the simplest form for this questions :)
perl -MFile::Find -e '
find sub { unlink if /\.ape$/} , shift || "."
'
-Todd
------------------------------
Date: Mon, 03 Dec 2007 05:34:08 GMT
From: Tony Lissner <tlissner@gmail.com>
Subject: Re: Increment in nested loop
Message-Id: <kzM4j.19733$CN4.13599@news-server.bigpond.net.au>
Jürgen Exner wrote:
> Tony Lissner wrote:
>> This is a shortened version.
>> Anyone have any ideas how to get the
>> inner loop to increment.
>>
>> Source file unknown number of lines.
>> Read the file and print two lines per
>> page until EOF
>>
>> This is what I want.
>> Page N
>> Headers
>> Two lines on each page
>>
>> Page 1
>> Headers
>> 25,Fred,Nerk
>> 23,Foo,Bar
>>
>> Page 2
>> Headers
>> 05,perl,v5.8.8
>> blank line
>>
>> This is what I get.
>>
>> Page 1
>> Headers
>> 25, Fred, Nerk
>> 25, Fred, Nerk
>>
>> my $page_num = 1;
>>
>> while (<DATA>) {
>> my ($num, $fname, $lname) = split ',';
>> print "\nPage $page_num\nHeaders\n";
>> foreach (1 .. 2) {
>> print "$num, $fname, $lname";
>> }
>
> Intead you may want to reconsider your algorithm and read, split(), and
> print() each line as you are already doing in the outer while() loop but
> injecting that page header at every other line by a simple if() statement:
>
> if ($. % 2 == 0) # Note: $. is the current INPUT_LINE_NUMBER
> {print "Header goes here\n";}
>
> jue
>
Thanks jue and Ron for your suggestions. This should do what I wanted.
#!/usr/bin/perl
use strict;
use warnings;
while (<DATA>) {
# Start line count from zero
my $zero_base_lc = $. - 1;
my ($num, $fname, $lname) = split ',';
if ($zero_base_lc % 2 == 0) {
print "\nNew Page\nHeaders\n";
}
print "$num, $fname, $lname";
}
__DATA__
25,Fred,Nerk
23,Foo,Bar
05,perl,v5.8.8
------------------------------
Date: Mon, 3 Dec 2007 05:42:16 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon Dec 3 2007
Message-Id: <JsGL6G.oK3@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Algorithm-DrillDown-0.001
http://search.cpan.org/~mooli/Algorithm-DrillDown-0.001/
Turns a long list into an easy-to-navigate tree
----
Audio-FLAC-Header-1.9
http://search.cpan.org/~daniel/Audio-FLAC-Header-1.9/
interface to FLAC header metadata.
----
Catalyst-Authentication-Store-DBIx-Class-0.101
http://search.cpan.org/~jayk/Catalyst-Authentication-Store-DBIx-Class-0.101/
A storage class for Catalyst Authentication using DBIx::Class
----
Catalyst-Model-SVN-0.07
http://search.cpan.org/~bobtfish/Catalyst-Model-SVN-0.07/
Catalyst Model to browse Subversion repositories
----
Catalyst-Plugin-Authentication-0.10003
http://search.cpan.org/~jayk/Catalyst-Plugin-Authentication-0.10003/
Infrastructure plugin for the Catalyst authentication framework.
----
Config-Options-0.01
http://search.cpan.org/~ealleniii/Config-Options-0.01/
Module to provide a configuration hash with option to read from file.
----
Date-Baha-i-0.1601
http://search.cpan.org/~gene/Date-Baha-i-0.1601/
Convert to and from Baha'i dates
----
Date-Baha-i-0.17
http://search.cpan.org/~gene/Date-Baha-i-0.17/
Convert to and from Baha'i dates
----
Date-Baha-i-0.18
http://search.cpan.org/~gene/Date-Baha-i-0.18/
Convert to and from Baha'i dates
----
Date-Baha-i-0.1801
http://search.cpan.org/~gene/Date-Baha-i-0.1801/
Convert to and from Baha'i dates
----
Email-Send-Gmail-0.32
http://search.cpan.org/~lbrocard/Email-Send-Gmail-0.32/
Send Messages using Gmail
----
GD-Graph-radar-0.1001
http://search.cpan.org/~gene/GD-Graph-radar-0.1001/
Make radial bar charts
----
HTML-Template-Compiled-Filter-Whitespace-0.03
http://search.cpan.org/~steffenw/HTML-Template-Compiled-Filter-Whitespace-0.03/
whitespace filter for HTML output
----
HTML-Template-Pro-0.67
http://search.cpan.org/~viy/HTML-Template-Pro-0.67/
Perl/XS module to use HTML Templates from CGI scripts
----
Image-Magick-PolyText-1.0.0
http://search.cpan.org/~rsavage/Image-Magick-PolyText-1.0.0/
Draw text along a polyline
----
JavaScript-Writer-0.0.8
http://search.cpan.org/~gugod/JavaScript-Writer-0.0.8/
JavaScript code generation from Perl.
----
Linux-BootCleanup-0.03
http://search.cpan.org/~kerisman/Linux-BootCleanup-0.03/
Clean up old kernel files in /boot and update bootloader menu entries accordingly
----
Math-Random-BlumBlumShub-0.01
http://search.cpan.org/~sisyphus/Math-Random-BlumBlumShub-0.01/
the Blum-Blum-Shub pseudorandom bit generator.
----
Math-Random-MicaliSchnorr-0.01
http://search.cpan.org/~sisyphus/Math-Random-MicaliSchnorr-0.01/
the Micali-Schnorr pseudorandom bit generator.
----
Music-MPDScrobble-0.01
http://search.cpan.org/~ealleniii/Music-MPDScrobble-0.01/
Module providing routines to submit songs to last.fm from MPD
----
Music-Tag-0.23
http://search.cpan.org/~ealleniii/Music-Tag-0.23/
Module for collecting information about music files.
----
Music-Tag-0.24
http://search.cpan.org/~ealleniii/Music-Tag-0.24/
Module for collecting information about music files.
----
Net-Pcap-0.15
http://search.cpan.org/~saper/Net-Pcap-0.15/
Interface to pcap(3) LBL packet capture library
----
Parse-CPAN-Packages-2.27
http://search.cpan.org/~lbrocard/Parse-CPAN-Packages-2.27/
Parse 02packages.details.txt.gz
----
QDBM_File-0.01
http://search.cpan.org/~yamato/QDBM_File-0.01/
Tied access to Quick Database Manager
----
Qmail-Deliverable-1.00
http://search.cpan.org/~juerd/Qmail-Deliverable-1.00/
Determine deliverability of local addresses
----
SOAP-WSDL-2.00_25
http://search.cpan.org/~mkutter/SOAP-WSDL-2.00_25/
SOAP with WSDL support
----
Test-Virtual-Filesystem-0.10
http://search.cpan.org/~cdolan/Test-Virtual-Filesystem-0.10/
Validate a filesystem
----
Text-Template-Simple-0.49_06
http://search.cpan.org/~burak/Text-Template-Simple-0.49_06/
Simple text template engine
----
Video-ZVBI-0.2.3
http://search.cpan.org/~tomzo/Video-ZVBI-0.2.3/
VBI decoding (teletext, closed caption, ...)
----
WebService-MusicBrainz-0.13
http://search.cpan.org/~bfaist/WebService-MusicBrainz-0.13/
----
reslog-3.13
http://search.cpan.org/~imacat/reslog-3.13/
Reverse-resolve IP in Apache log files
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 3 Dec 2007 00:42:15 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: OT raibow
Message-Id: <fivjd7$v6v$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Joost Diepenmaat
<joost@zeekat.nl>], who wrote in article <475203a8$0$20387$e4fe514c@dreader32.news.xs4all.nl>:
> On Sun, 02 Dec 2007 00:35:53 +0000, Ilya Zakharevich wrote:
> > A rainbow contains VERY mixed colors. It's a wonder that these colors
> > are distinguishable by eye at all; they are very low saturation (even if
> > the background is very dark - which it usually is not).
>
> Getting further and further off-topic.
>
> I am under the impression that a rainbow contains/is a "frequency sweep"
> of visible light, which would mean that the colors aren't mixed - at
> every point you'd have light of a single frequency.
It is very very far from being true. Looking at the picture of ray
tracing through a droplet, you can see that there is A CONCENTRATION
of rays going out near a certain cone; as with "the usual `fold'
concentrators" (see catastrophe theory) the corresponding density will
be about const/sqrt(A-a0); here A is the angle with the direction to the
sun, and a0 the angle at the vertex of the cone. a0 depends slightly
on the frequency of light.
Therefore, looking in the particular direction A, you get density of
rainbow light with frequency F as const/sqrt(A - a0(F)); this may be
rewritten as something "about const/sqrt(F - F0)". "Single frequency"
conjecture corresponds to distribution with density concentrated at
one particular frequency F0.
Since dependence of a0 on F is very small, this "about" above should
give quite good an approximation; thus the distribution is "very
wide", not "very narrow".
Hope this helps,
Ilya
------------------------------
Date: Mon, 3 Dec 2007 02:41:34 +0100
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: OT raibow
Message-Id: <fivn5c$sds$1@ns.felk.cvut.cz>
Tad McClellan wrote:
> Petr Vileta <stoupa@practisoft.cz> wrote:
>
>> an "or die..." part is not needed for short test-type
>> scripts when I'm sure about a privileges for directory
>
> ^
> ^
> Many people reading this group are learning Perl from it. The may well
> copy/paste code found here into their real programs.
>
> "Seeding" the world with poorly formed code is a disservice to the
> community.
>
> When you post here, the audience that your article is written for is
> not really "you", it is to dozens or hundreds or thousands of "us".
>
Yes, you are right. I redeem myself :-)
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)
Please reply to <petr AT practisoft DOT cz>
------------------------------
Date: Mon, 03 Dec 2007 11:21:53 +0000
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: Perl and a Ramdisk
Message-Id: <13l7pmhii8pqj06@corp.supernews.com>
Bill H wrote:
>
> I am not concerned about loosing the data with shutdown, since it is
> chat the data is transient, only need what someone types for a few
> seconds to echo it to the other chatters. I am more concerned with
> speed and less disk accesses. I figure it will be a whole lot faster
> open a file, reading, writing, closing files in a ramdisk than in on a
> HD.
As has been pointed out, any decent OS will
perform cacheing of HD data, in (well...) RAM.
BugBear
------------------------------
Date: Sun, 02 Dec 2007 17:05:25 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: what "shift" does, if not "$_ = shift;" ?
Message-Id: <doadnXhez6jIy87anZ2dnUVZ_jCdnZ2d@comcast.com>
devphylosoff wrote:
> print map {" @{$_} \n"} values %all;
> check_items_for_all(\%all);
> print map {" @{$_} \n"} values %all;
So, you're expecting $_ to be unchanged after calling check_items_for_all().
It won't be, based on the code you commented out.
You'd need
local $_ = shift;
Or better yet, use a private lexical variable instead of the global $_ variable.
my $href = shift;
for $key (keys %$href) {
check_required_items($key, $href->{$key});
}
-Joe
------------------------------
Date: Mon, 03 Dec 2007 07:35:44 -0600
From: hymie_@_lactose.homelinux.net (hymie!)
Subject: Re: writing to a notepad in perl
Message-Id: <eOSdnbD1c9itm8nanZ2dnUVZ_oGjnZ2d@comcast.com>
In our last episode, the evil Dr. Lacto had captured our hero,
RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>, who said:
>hymie! wrote:
>>
>> The whole concept of a text file is based on it being text (that is,
>> unformatted).
>
>I know what you mean, and it's pertinent since the OP mentions notepad,
>but I'd say "plain text" where you say "text". To me, Rich Text Format
>(RTF) is text too, though only just :-). Widely used MIME types like
>"text/plain", "text/rtf" and "text/html" tend to reinforce this idea.
To be honest, I'm not at all familiar with RTF, but you make a good point
about "text" vs "plain text".
>Just a thought: if you change your "signature" separator to hyphen
>hyphen space newline then most newsreaders will recognise it as a
>"signature", display it differently and automatically omit it from replies.
*gasp* there are people other than me using newsreaders? :)
--
hymie! http://lactose.homelinux.net/~hymie hymie@lactose.homelinux.net
------------------------ Without caffeine for 398 days ------------------------
------------------------------
Date: Mon, 3 Dec 2007 01:32:55 -0800 (PST)
From: indifferente32@gmail.com
Subject: Re: YI,A Liang ! I love this game! www.netfashion2008.cn
Message-Id: <3d54c12c-9aa6-4089-b282-310f96c81bad@y5g2000hsf.googlegroups.com>
venditore sconsigliato
------------------------------
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 1088
***************************************