[29622] in Perl-Users-Digest
Perl-Users Digest, Issue: 866 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 19 21:09:39 2007
Date: Wed, 19 Sep 2007 18:09:08 -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 Wed, 19 Sep 2007 Volume: 11 Number: 866
Today's topics:
Re: are you using Perl in your job? <devliegendehollander@attempt-at-not-applicable-domain-name.com>
Re: are you using Perl in your job? <kkeller-usenet@wombat.san-francisco.ca.us>
Re: are you using Perl in your job? <wahab@chemie.uni-halle.de>
Re: are you using Perl in your job? <eflorac@imaginet.fr>
Re: are you using Perl in your job? <stoupa@practisoft.cz>
Re: Challenge: CPU-optimized byte-wise or-equals (for a <wahab@chemie.uni-halle.de>
Re: could you use array or string as hash key in Perl? <bik.mido@tiscalinet.it>
Re: could you use array or string as hash key in Perl? <bik.mido@tiscalinet.it>
General way to run an exe with errors written to a file bencejohn@gmail.com
Re: I need help ! <tadmc@seesig.invalid>
List Variable becomes undefined inexplicably mattbreedlove@yahoo.com
Re: List Variable becomes undefined inexplicably <kenslaterpa@hotmail.com>
Re: PERL PACKAGE IN MODULE <bik.mido@tiscalinet.it>
Using (?{}) code blocks and $^R <clint.olsen@gmail.com>
Web interface to script? <thorassic5@gmail.com>
Web interface to script? <thorassic5@gmail.com>
Re: Writing a C++ Style Checker <benkasminbullock@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 19 Sep 2007 20:20:59 +0200
From: De Vliegende Hollander <devliegendehollander@attempt-at-not-applicable-domain-name.com>
Subject: Re: are you using Perl in your job?
Message-Id: <46f1688b$0$25247$e4fe514c@dreader15.news.xs4all.nl>
The sentient life form Summercool posted the following:
> I heard there are many many Perl programmers. But the job interviews
> I went to lately, they either use Java, PHP, Python, or Ruby. So I
> wonder for all the people who know Perl quite well, are you using Perl
> in your job?
Yes, coding almost exclusively in Perl (some JavaScript too).
------------------------------
Date: Wed, 19 Sep 2007 12:12:42 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: are you using Perl in your job?
Message-Id: <au88s4x9me.ln2@goaway.wombat.san-francisco.ca.us>
On 2007-09-19, Summercool <Summercoolness@gmail.com> wrote:
> I heard there are many many Perl programmers. But the job interviews
> I went to lately, they either use Java, PHP, Python, or Ruby. So I
> wonder for all the people who know Perl quite well, are you using Perl
> in your job?
Yes. I also use (though don't really write) Java, PHP, and Python.
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information
------------------------------
Date: Wed, 19 Sep 2007 22:00:39 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: are you using Perl in your job?
Message-Id: <fcrv57$1edc$1@nserver.hrz.tu-freiberg.de>
Summercool wrote:
> But the job interviews I went to lately, they either use
> Java, PHP, Python, or Ruby. So I wonder for all the people
> who know Perl quite well, are you using Perl in your job?
So you are wondering why you don't have
to use Perl on a job where people
don't use Perl?
Did I understand you correctly?
Why don't you simply apply
for a Perl related job?
http://seeker.dice.com/jobsearch/servlet/JobSearch?LOCATION_OPTION=4&N=0&Hf=0&Ntk=JobSearchRanking&op=300&values=&FREE_TEXT=perl&Ntx=mode+matchall&AREA_CODES=&AC_COUNTRY=1525&WHERE=&RADIUS=120.7008&ZC_COUNTRY=1525&COUNTRY=1525&STAT_PROV=0&METRO_AREA=37.76891744%2C-122.4230505&TRAVEL=0&TAXTERM=0&SORTSPEC=0&FRMT=0&DAYSBACK=30&NUM_PER_PAGE=30&x=39&y=5
Regards
M.
------------------------------
Date: Wed, 19 Sep 2007 22:57:27 +0200
From: Emmanuel Florac <eflorac@imaginet.fr>
Subject: Re: are you using Perl in your job?
Message-Id: <pan.2007.09.19.20.57.25.453686@imaginet.fr>
Le Wed, 19 Sep 2007 17:30:10 +0000, Summercool a écrit :
> I heard there are many many Perl programmers. But the job interviews I
> went to lately, they either use Java, PHP, Python, or Ruby. So I wonder
> for all the people who know Perl quite well, are you using Perl in your
> job?
Yes, and all developers in my company use mostly Perl, plus some shell.
--
That ideas should freely spread from one to another over the globe,
for the moral and mutual instruction of man, and the improvement of his
conditions, seems to have been peculiarly and benevolently designed by
nature, when she made them, like fire, expansible over all space,
without lessening their density in any point, and like the air in which
we breathe, move, and have our physical being, incapable of confinement
of exclusive appropriation. Inventions then cannot, in nature, be a
subject of property.
Thomas Jefferson.
------------------------------
Date: Thu, 20 Sep 2007 02:31:35 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: are you using Perl in your job?
Message-Id: <fcsg82$2iae$1@ns.felk.cvut.cz>
Summercool wrote:
> I heard there are many many Perl programmers. But the job interviews
> I went to lately, they either use Java, PHP, Python, or Ruby. So I
> wonder for all the people who know Perl quite well, are you using Perl
> in your job?
Yes, I use Perl for writing for small jobs on Linux and for dynamic web
pages (mostly database driven). I use Perl rather then PHP because by me
Perl is less dependent on used version then PHP. Script which work under
Perl 5.6 work weel unde Perl 5.8, but PHP script under 4.0 mostly not work
unde 4.1, 4.3 or 5.0 ;-) When I compare Perl and PHP to another languages I
mean that Perl is some like C and PHP is some like Basic :-) In other word
in PHP anybody can write scripts (mostly terrible), but for using Perl
people must know to think.
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
------------------------------
Date: Wed, 19 Sep 2007 20:18:27 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)
Message-Id: <fcrp5j$1crh$1@nserver.hrz.tu-freiberg.de>
Michele Dondi wrote:
> <http://perlmonks.org/?node_id=638584> would have been more
> appropriate. And you may have included the longer portions of code in
> readmore tags, just highlighting your contributed code. Anyway, well
Thanks for your hints, I posted another response
and included links to the code which I deposited
on a server. But I think thats really to late in
this case.
BTW, what I learned (and what I'm glad to know)
is how dead slow the Core2 on CISC IA32 repeated
(prefixed) string operations is (like "rep stringop").
On every Athlon out there, such problems (as said)
can be solved by (IA32) "repne scasb" on the string
in qestion - this will be faster than anything by
a margin.
Not on a Core2, the "rep stringop" will be about
3x slower than a naive load/compare/load/store
sequence.
OK, thats not really Perl related anymore ...
Regards
M.
------------------------------
Date: Wed, 19 Sep 2007 22:51:10 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: could you use array or string as hash key in Perl?
Message-Id: <6t23f3db14kc7gj09ejf6kqp7sv6n26vaj@4ax.com>
On Wed, 19 Sep 2007 17:27:19 -0000, Summercool
<Summercoolness@gmail.com> wrote:
>yes, i tried using
>
>$h{(3,4)} = "hee";
>
>and print out all the key value pairs.
>the key "3 4" show up with a strange character between them.
That's $;
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: Wed, 19 Sep 2007 22:53:39 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: could you use array or string as hash key in Perl?
Message-Id: <9v23f39o0frs3j40echft42bbpstd098gu@4ax.com>
On Wed, 19 Sep 2007 08:33:18 -0700, patrick <pgovern@u.washington.edu>
wrote:
>If you want to try and keep the array values you can always use
>
>$h{ join('.', @a) } = 'ha';
>
>print " $h{ join('.', @a) }\n";
How does that work with
@a=('a', 'b.c');
and
@a=qw/a b c/;
respectively?
Not to say that your answer is *incorrect* but that one should add
that some care is required.
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: Thu, 20 Sep 2007 00:04:27 -0000
From: bencejohn@gmail.com
Subject: General way to run an exe with errors written to a file
Message-Id: <1190246667.492258.87050@y27g2000pre.googlegroups.com>
Is there a purely Perl way to do the following (i.e., without relying
on a system specific call)?
use strict;
use warnings;
system("foo.exe bar > errs 2>&1");
Thanks
------------------------------
Date: Wed, 19 Sep 2007 05:53:49 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: I need help !
Message-Id: <slrnff1vtt.ahf.tadmc@tadmc30.sbcglobal.net>
Jeet A <dumpe2fs@gmail.com> wrote:
> Subject: I need help !
And your article needs a subject in its Subject.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Wed, 19 Sep 2007 17:32:03 -0700
From: mattbreedlove@yahoo.com
Subject: List Variable becomes undefined inexplicably
Message-Id: <1190248323.546269.250090@q5g2000prf.googlegroups.com>
Using Perl v5.8.4
This type of problem has plagued me over the years several times. Each
time I have had to rearrange the way that my PERL script was designed
to work around it.
At this point I think its a bug or something really strange.
I was able to reproduce it with the test script below.
The issue is that a global list variable that is built inside
subroutine A, iterated over in a foreach loop in subroutine B, is then
magically undefined after the foreach loop if the loop contains a
command pipe with a while loop.
According the laws of PERL that I am used to when you run the below
script you *should* get:
main_before-ITERATE_HOSTS -apple orange durian-
start_inside_ITERATE_HOSTS -apple orange durian-
end_inside_ITERATE_HOSTS -apple orange durian-
main_after-ITERATE_HOSTS -apple orange durian-
However instead you get
main_before-ITERATE_HOSTS -apple orange durian-
start_inside_ITERATE_HOSTS -apple orange durian-
end_inside_ITERATE_HOSTS - -
main_after-ITERATE_HOSTS - -
Any ideas?
Here is the test script:
#!perl
SETUP_HOSTS();
print "main_before-ITERATE_HOSTS -@SLAVE_HOSTS-\n";
ITERATE_HOSTS();
print "main_after-ITERATE_HOSTS -@SLAVE_HOSTS-\n";
sub SETUP_HOSTS {
push(@SLAVE_HOSTS, apple);
push(@SLAVE_HOSTS, orange);
push(@SLAVE_HOSTS, durian);
}
sub ITERATE_HOSTS {
print "start_inside_ITERATE_HOSTS -@SLAVE_HOSTS-\n";
foreach (@SLAVE_HOSTS) {
$REMOTE_HOST="$_";
#open(CMD, "$SSH $REMOTE_HOST 'do some stuff'|");
while(<CMD>) {
chomp;
$LINE="$_";
if ( "$LINE" =~ /service id\=/ ) {
print "blah\n";
}
}
close(CMD);
}
print "end_inside_ITERATE_HOSTS -@SLAVE_HOSTS-\n";
}
------------------------------
Date: Wed, 19 Sep 2007 18:08:52 -0700
From: kens <kenslaterpa@hotmail.com>
Subject: Re: List Variable becomes undefined inexplicably
Message-Id: <1190250532.096753.30130@22g2000hsm.googlegroups.com>
On Sep 19, 8:32 pm, mattbreedl...@yahoo.com wrote:
> Using Perl v5.8.4
> This type of problem has plagued me over the years several times. Each
> time I have had to rearrange the way that my PERL script was designed
> to work around it.
>
> At this point I think its a bug or something really strange.
> I was able to reproduce it with the test script below.
>
> The issue is that a global list variable that is built inside
> subroutine A, iterated over in a foreach loop in subroutine B, is then
> magically undefined after the foreach loop if the loop contains a
> command pipe with a while loop.
>
> According the laws of PERL that I am used to when you run the below
> script you *should* get:
> main_before-ITERATE_HOSTS -apple orange durian-
> start_inside_ITERATE_HOSTS -apple orange durian-
> end_inside_ITERATE_HOSTS -apple orange durian-
> main_after-ITERATE_HOSTS -apple orange durian-
>
> However instead you get
> main_before-ITERATE_HOSTS -apple orange durian-
> start_inside_ITERATE_HOSTS -apple orange durian-
> end_inside_ITERATE_HOSTS - -
> main_after-ITERATE_HOSTS - -
>
> Any ideas?
>
> Here is the test script:
>
> #!perl
use strict;
use warnings;
>
my @SLAVE_HOSTS;
> SETUP_HOSTS();
> print "main_before-ITERATE_HOSTS -@SLAVE_HOSTS-\n";
> ITERATE_HOSTS();
> print "main_after-ITERATE_HOSTS -@SLAVE_HOSTS-\n";
>
> sub SETUP_HOSTS {
>
Note that you will be forced to quote barewords when using strict:
> push(@SLAVE_HOSTS, apple);
> push(@SLAVE_HOSTS, orange);
> push(@SLAVE_HOSTS, durian);
>
> }
>
> sub ITERATE_HOSTS {
> print "start_inside_ITERATE_HOSTS -@SLAVE_HOSTS-\n";
Here is part of your problem - using the default variable ($_)
It would be better to define a new variable
foreach my $slave (@SLAVE_HOSTS)
> foreach (@SLAVE_HOSTS) {
Useless use of quotes
my $REMOTE_HOST = $_;
> $REMOTE_HOST="$_";
>
> #open(CMD, "$SSH $REMOTE_HOST 'do some stuff'|");
Note that you are using $_ as the loop variable here.
This is not good, as $_ is one of the elements of @SLAVE_HOSTS (see
above foreach)
When you modify $_ you modify an element of @SLAVE_HOSTS - essentially
you are 'undef' ing the whole array since the 'OPEN' statement is
commented.
> while(<CMD>) {
> chomp;
Useless use of quotes
my $LINE = $_;
> $LINE="$_";
Useless use of quotes also no need to backslash the equal sign
> if ( "$LINE" =~ /service id\=/ ) {
> print "blah\n";
> }
> }
> close(CMD);
> }
> print "end_inside_ITERATE_HOSTS -@SLAVE_HOSTS-\n";
>
> }
HTH, Ken
------------------------------
Date: Wed, 19 Sep 2007 22:55:11 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: PERL PACKAGE IN MODULE
Message-Id: <5433f39uolks7q0hnv92fsibbng0eojd3t@4ax.com>
On Wed, 19 Sep 2007 17:24:48 +0100, Ben Morrow <ben@morrow.me.uk>
wrote:
>However, before you do this you should take a step back. What are you
>actually trying to achieve here? Chances are you can do it without
>resorting to rewriting your module on the fly, say by creating a
>'package factory' module that will, on request, create a new package and
>import some functions into it.
This can be "easily" done with the code-in-@INC facility.
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: Wed, 19 Sep 2007 18:06:14 -0500
From: Clint Olsen <clint.olsen@gmail.com>
Subject: Using (?{}) code blocks and $^R
Message-Id: <slrnff3ar6.5mi.clint.olsen@belle.0lsen.net>
Hi:
I've been writing some behemoth reguar expressions and having some good
luck relying on $^R to pass results from the RE. However, I have a
non-intuitive result coming from Perl:
#!/usr/bin/perl
use strict;
use warnings;
#use re 'debug';
my $multiline_comment = qr@/\*(?{ print "starting multi-line\n"; [ 0, 2 ] })
(?:(.)+?
(?{ [ $^R->[0], $^R->[1] + length $^N ] })
| (?: (\n+) (?{ print "found newline in multi\n"; [ length $^N, 1 ] }))
)*?
\*/ (?{ print "finished comment\n"; [1, 1]; })
@x;
my $foo = "/* foo
bar */";
while ($foo =~ m/$multiline_comment/g) {
print "@{$^R}\n";
}
When I run this example, I get:
# ./test
starting multi-line
found newline in multi
finished comment
0 2
I expected to see $^R contain the results of the final code block, not the
block above. I assume there's some weird scoping that I didn't anticipate,
but I'm not sure why. I figured the code would evaluate left->right.
Thanks,
-Clint
--
Clint Olsen . -- .
clint at NULlsen dot net .' ,-. `.
;_,' ( ;
"I am Dick Lexic of Borg. Prepare to be ass-laminated." `. ``;'
-- Styx Allum ` -- '
------------------------------
Date: Wed, 19 Sep 2007 21:02:11 -0000
From: Mike Stroud <thorassic5@gmail.com>
Subject: Web interface to script?
Message-Id: <1190235731.820720.184120@v29g2000prd.googlegroups.com>
I have a perl script sitting in svn repos, associated with many web
development projects at my work. The script scoops the repo revision
# and dumps it into a .txt that developers then print out to their
pages to ensure version compatiblity (for me in qa, i can see what
version im looking at and tell quickly what is a new bug and what's
been fixed, etc..) It was recently requested that I add a 'web based
interface' to my script(s, we are currently working on 20+ projects)
to basically have a 'button that runs the script before the developers
update their local repo'.
Im not a super perl hacker, and dont know cgi very well, is there any
pointers you can give me on how to accomplish this (or even better, a
script that updates on checkout)?
Thanks!
------------------------------
Date: Wed, 19 Sep 2007 21:02:15 -0000
From: Mike Stroud <thorassic5@gmail.com>
Subject: Web interface to script?
Message-Id: <1190235735.391260.78560@y27g2000pre.googlegroups.com>
I have a perl script sitting in svn repos, associated with many web
development projects at my work. The script scoops the repo revision
# and dumps it into a .txt that developers then print out to their
pages to ensure version compatiblity (for me in qa, i can see what
version im looking at and tell quickly what is a new bug and what's
been fixed, etc..) It was recently requested that I add a 'web based
interface' to my script(s, we are currently working on 20+ projects)
to basically have a 'button that runs the script before the developers
update their local repo'.
Im not a super perl hacker, and dont know cgi very well, is there any
pointers you can give me on how to accomplish this (or even better, a
script that updates on checkout)?
Thanks!
------------------------------
Date: Wed, 19 Sep 2007 23:50:25 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: Writing a C++ Style Checker
Message-Id: <fcsck1$qfd$1@ml.accsnet.ne.jp>
On Wed, 19 Sep 2007 17:18:21 +0100, Ben Morrow wrote:
> Quoth ids <ishan.desilva@gmail.com>:
>> Hi,
>>
>> I'm new to Perl. I'm trying to use Perl to write a C++ Style Checker
>> to validate various coding standards followed in our organization.
>>
>> Some of the things I need to do in this tool include:
>> - verifying whether identifier naming conventions have been followed
>> - differentiating between member variables and local variables
>> (because their naming conventions are different)
>> - determining method/function boundaries
>> - identifying control structures such as 'if', 'while' etc to see
>> whether they are written with code blocks (i.e. { }) all the time
>> - check whether statements are more than a given width (say 100
>> column)
>> - etc. etc.
>>
>> This need not go in to semantics of the program; what I need is a
>> basic style checker.
>>
>> What I see is that parsing line by line independently is not going to
>> help. This parser needs to build context and remember stuff across
>> lines to satisfy above goals.
>
> This is going to be seriously hard work. What you need is a parser for
> C++, and as C++ is a *very* complex language this is not going to be
> easy to get right, unless you are content to only recognize simple
> constructions without parsing the code properly.
Similarly, one also needs to completely parse the English language in order
to write a spelling checker. For example to check for "right" misspelt
as "write" requires one to comprehensively parse all possible English
sentences, distinguish between verbs and adjectives, and detect the word
"right" where a verb should be. Making such a spelling checker is going to
be seriously hard work too - maybe it will take the rest of your life. But
a simple system which catches 99% of errors is a few lines of code.
------------------------------
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 866
**************************************