[28788] in Perl-Users-Digest
Perl-Users Digest, Issue: 32 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 15 14:05:53 2007
Date: Mon, 15 Jan 2007 11:05:07 -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, 15 Jan 2007 Volume: 11 Number: 32
Today's topics:
Re: A question about socket programming <bik.mido@tiscalinet.it>
Re: Any buddy looking for Job in software testing <glex_no-spam@qwest-spam-no.invalid>
Any module for gathering system statistics? <howachen@gmail.com>
Re: Ascii characters in a loop <hjp-usenet2@hjp.at>
Re: Ascii characters in a loop <bik.mido@tiscalinet.it>
Re: backtick and system command mail4ashok@gmail.com
Re: backtick and system command <glex_no-spam@qwest-spam-no.invalid>
how to "see" DOS errorlevel codes? <Ross.Landis@gmail.com>
Re: how to "see" DOS errorlevel codes? <purlgurl@purlgurl.net>
Re: how to "see" DOS errorlevel codes? <glex_no-spam@qwest-spam-no.invalid>
How to create a binary file from a perl pgm <ranrodrig@gmail.com>
Re: How to create a binary file from a perl pgm <john@castleamber.com>
Re: Indirect function call via Name <uri@stemsystems.com>
Re: Indirect function call via Name <bik.mido@tiscalinet.it>
Re: Issue with CGI module and hidden fields xhoster@gmail.com
Re: Issue with CGI module and hidden fields (NOSPAM)
Re: Parsing some input - easy to explain but lengthy to <spam.meplease@ntlworld.com>
Re: Parsing some input - easy to explain but lengthy to <spam.meplease@ntlworld.com>
Re: Perl free e-books <bik.mido@tiscalinet.it>
Re: Perl free e-books <bik.mido@tiscalinet.it>
Re: Perl free e-books <bik.mido@tiscalinet.it>
Re: Perl free e-books <bik.mido@tiscalinet.it>
Re: Perl free e-books <bik.mido@tiscalinet.it>
Runs Fine In Perl :: Not As Cron Job <beauchamp.jim@gmail.com>
Re: Runs Fine In Perl :: Not As Cron Job <john@castleamber.com>
Re: Skip non english character values <bik.mido@tiscalinet.it>
Re: variables in substitution (NOSPAM)
Re: variables in substitution <noreply@gunnar.cc>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 15 Jan 2007 18:11:44 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: A question about socket programming
Message-Id: <r12iq2he8ehthin7lftdcjnf678iu9mmlj@4ax.com>
On 12 Jan 2007 05:49:47 -0800, "firenet" <kevinmiter@gmail.com> wrote:
>Subject: A question about socket programming
Not at all!
>My code is like this:
>
>while( 1 )
>{
> my $i = 0;
> my $buffer;
> my $from_who = recv( UDP_IN, $buffer, 10, 0 );
> if ( $from_who )
> {
> my ( $the_port, $the_ip ) = sockaddr_in( $from_who );
> warn 'Received from ', inet_ntoa( $the_ip ), ": $buffer\n";
> $i=$i+1;
> print $i."\n";
> $data=$data.$buffer;
> }
> else
> {
> warn "Problem with recv: $!\n";
> }
>}
>
while (1) {
my $i = 0;
my $whatever = int rand 7;
if ($whatever) {
warn "Got $whatever\n";
$i=$i+1;
print $i, "\n";
# a.k.a. print ++$i, "\n";
}
else {
warn "Problem with rand()\n";
}
}
Does the problem go away?
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, 15 Jan 2007 12:12:11 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Any buddy looking for Job in software testing
Message-Id: <45abc358$0$63458$815e3792@news.qwest.net>
fhk6431@gmail.com wrote:
> Hey..
>
> My company is aggresively looking for people to hire in software
> testing.. New graduates are welcome. You need to know how to do
> whitebox and blackbox testing.
It's great to see that knowing how to spell certainly isn't required
to work at your company.
>Also have previous experience in writing
> testcases in perl or any other language.
I do now. How about French or German? examinez le cas, prüfen Sie
Fälle. When do I start?
------------------------------
Date: 15 Jan 2007 08:26:40 -0800
From: "howa" <howachen@gmail.com>
Subject: Any module for gathering system statistics?
Message-Id: <1168878398.378180.24460@11g2000cwr.googlegroups.com>
such as cpu loading, active tcp connection, free memory, io etc?
thanks.
------------------------------
Date: Mon, 15 Jan 2007 18:33:15 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Ascii characters in a loop
Message-Id: <slrneqnemr.ko6.hjp-usenet2@yoyo.hjp.at>
On 2007-01-15 12:50, anno4000@radom.zrz.tu-berlin.de <anno4000@radom.zrz.tu-berlin.de> wrote:
> Peter J. Holzer <hjp-usenet2@hjp.at> wrote in comp.lang.perl.misc:
>> On 2007-01-14 10:04, Mark Hobley <markhobley@hotpop.deletethisbit.com> wrote:
>> > It seems strange that if I increment $l (which equals 'z') then I now have a
>> > value that is comparitively less than 'z'.
>>
>> That's because the "le" operator doesn't define "less" and "greater" in
>> the same sense as "++" increments. The same happens if you use numbers:
>>
>> for (my $l = 0; $l le 9; $l++) {
>> print "$l ";
>> }
>>
>> prints
>>
>> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
>> 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
>> 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
>> 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
>>
>> Because 90 is the first number which is greater than 9 in a string
>> comparison.
>>
>> Only with numbers there is a simple solution (use "<=" instead of "le"),
>> while there is no builtin comparison operator for "alphanumeric
>> numbers".
>
> That doesn't mean you can't define an appropriate comparison.
I didn't mean to imply that. It should always be possible to define a
comparison function for a given sequence. The point was that the
programmer has to define that himself and can't use a builtin.
> In terms of a sort block (untested):
>
> { length( $a) <= length( $b) and $a le $b }
Not quite. It returns false for $a = "b" and $b = "aa".
{
length($a) < length($b) ? 1 :
length($a) == length($b) ? $a le $b :
0;
}
should be correct (except that a sort block should return negative,
zero, positive instead of true, false).
> Applied back to the OPs loop that results in
>
> for (my $l = 'a'; length( $l) <= 1 and $l le 'z'; $l++) { #...
Right.
hp
--
_ | Peter J. Holzer | > Wieso sollte man etwas erfinden was nicht
|_|_) | Sysadmin WSR | > ist?
| | | hjp@hjp.at | Was sonst wäre der Sinn des Erfindens?
__/ | http://www.hjp.at/ | -- P. Einstein u. V. Gringmuth in desd
------------------------------
Date: Mon, 15 Jan 2007 19:26:32 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Ascii characters in a loop
Message-Id: <t9hnq21osn37f1rpaq1ulhjm98nkfaacau@4ax.com>
On Sun, 14 Jan 2007 10:04:15 GMT, markhobley@hotpop.deletethisbit.com
(Mark Hobley) wrote:
>It seems strange that if I increment $l (which equals 'z') then I now have a
>value that is comparitively less than 'z'.
>
>This looks like a bug to me, at least in the context of an a to z loop.
A bug of what? of the increment operator or of the comparison one? To
me both act sensibly taken individually, and in a much too precious
way. That any of them should behave differently in a C<for> loop would
be yet another deviation from orthogonality and a not particularly
useful one, given that there is a better way to do it anyway, in fact
I seldom find C-style C<for> loops useful in perl: sometimes they are,
just rarely, certainly not in this case. The fact that the two
operators somehow interact badly "in this context", is just another
hint that one would better avoid it altogether, and use Perl's
idiomatic form instead.
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: 15 Jan 2007 08:20:14 -0800
From: mail4ashok@gmail.com
Subject: Re: backtick and system command
Message-Id: <1168878011.983048.130200@38g2000cwa.googlegroups.com>
> It's not the Perl script's fault that the Tcl interpreter buffers its
> output.
> There is little you can do in your Perl script to correct that.
that is not true.
#!/usr/bin/perl -w
select STDOUT;
$|=1;
print `echo test;sleep 5;echo test`;
__END__
o/p:
time goes by 5 seconds
test
test
#!/usr/bin/perl -w
select STDOUT;
$|=1;
print system "echo test;sleep 5;echo test";
__END__
o/p:
test
time goes by 5 seconds
test
> I almost wrote "nothing you can do" as there is a solution:
> do not run your Tcl script through a pipe but rather set up a pseudo-tty
> between the Perl and the Tcl script. That way the Tcl script will assume
> a terminal on its stdout (which, in effect, it has) and will send
> line-buffered output.
>
> Expect (a Tcl based software) does that.
Actually I wasn't doing fully disclosing all the details, the script
called by Perl is a Expect script
most of it Tcl. I think I am correct in saying that the "puts" Tcl
function is unbuffered.
So what I experienced is a difference between backtick and system
command. Anyway, I used a work around as mentioned in my last post.
Thanks for your reply
------------------------------
Date: Mon, 15 Jan 2007 11:55:22 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: backtick and system command
Message-Id: <45abbf67$0$502$815e3792@news.qwest.net>
mail4ashok@gmail.com wrote:
> Actually I wasn't doing fully disclosing all the details, the script
> called by Perl is a Expect script
> most of it Tcl. I think I am correct in saying that the "puts" Tcl
> function is unbuffered.
There's an Expect module, you could use, instead of an external Tcl
script: http://search.cpan.org/~rgiersig/Expect-1.20/Expect.pod
------------------------------
Date: 15 Jan 2007 09:17:30 -0800
From: "Rossman123" <Ross.Landis@gmail.com>
Subject: how to "see" DOS errorlevel codes?
Message-Id: <1168881449.247670.90990@v45g2000cwv.googlegroups.com>
The xcopy command in DOS returns the following codes on
error/success...
0 - Files were copied without error.
1 - No files were found to copy.
2 - The user pressed CTRL+C to terminate xcopy.
4 - Initialization error occurred. There is not enough memory or disk
space, or you entered an invalid drive name or invalid syntax on the
command line.
5 - Disk write error occurred.
How can I find out what code was returned, after I do an xcopy using
the Perl system command?
My code looks like this:
system ("xcopy /E /Y /F /I /D $source $destination");
Many thanks...
------------------------------
Date: Mon, 15 Jan 2007 09:50:09 -0800
From: Purl Gurl <purlgurl@purlgurl.net>
Subject: Re: how to "see" DOS errorlevel codes?
Message-Id: <45ABBED1.7010309@purlgurl.net>
Rossman123 wrote:
> The xcopy command in DOS returns the following codes on
> error/success...
> 0 - Files were copied without error.
> 1 - No files were found to copy.
> 2 - The user pressed CTRL+C to terminate xcopy.
> 4 - Initialization error occurred. There is not enough memory or disk
> space, or you entered an invalid drive name or invalid syntax on the
> command line.
> 5 - Disk write error occurred.
> How can I find out what code was returned
> system ("xcopy /E /Y /F /I /D $source $destination");
Your error numerical codes are partially correct. None of
your error messages are system quote correct.
---
$error_code = system ("xcopy /E /Y /F /I /D test.txt test2.txt");
print "Error Code: $error_code";
RESULTS:
Cannot perform a cyclic copy
0 File(s) copied
Error Code: 1024
---
$error_code = system ("copy test.txt test2.txt");
print "Error Code: $error_code";
RESULTS:
1 file(s) copied
Error Code: 0
---
$error_code = system ("copy bad.txt test2.txt");
print "Error Code: $error_code";
RESULTS:
File not found - bad.txt
0 file(s) copied
(control C interrupt)
---
Purl Gurl
------------------------------
Date: Mon, 15 Jan 2007 12:14:22 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: how to "see" DOS errorlevel codes?
Message-Id: <45abc3db$0$63458$815e3792@news.qwest.net>
Rossman123 wrote:
[...]
> How can I find out what code was returned, after I do an xcopy using
> the Perl system command?
> My code looks like this:
> system ("xcopy /E /Y /F /I /D $source $destination");
By actually examining what system returns.
Try the documentation.
perldoc system
------------------------------
Date: 15 Jan 2007 10:32:16 -0800
From: "ranrodrig" <ranrodrig@gmail.com>
Subject: How to create a binary file from a perl pgm
Message-Id: <1168885936.247326.88990@v45g2000cwv.googlegroups.com>
Folks, I know that you can create a binary file from a Perl pgm, so I
would like to know if you can tell me how to do this, or giving me some
tips about where to look for info.
I've already search about how to this with no luck, so I thank you in
advance for you patience & help with this.
BR.
Raul
------------------------------
Date: 15 Jan 2007 18:38:39 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: How to create a binary file from a perl pgm
Message-Id: <Xns98B9809F6439Ecastleamber@130.133.1.4>
"ranrodrig" <ranrodrig@gmail.com> wrote:
> Folks, I know that you can create a binary file from a Perl pgm, so I
> would like to know if you can tell me how to do this, or giving me some
> tips about where to look for info.
perldoc -f binmode
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: Mon, 15 Jan 2007 11:18:49 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Indirect function call via Name
Message-Id: <x7mz4kp8k6.fsf@mail.sysarch.com>
>>>>> "R" == Ronny <ro.naldfi.scher@gmail.com> writes:
R> Uri Guttman schrieb:
>>
>> you should still use a dispatch table as was mentioned before. it is
>> safer and smarter.
R> Correct, but with a dispatch table, you kind of need in advance
R> what functions are going to be called that way. In my particular
R> case, safety is not an issue. Actually, I want to be able to
R> supply at run-time the function name, but the knowledge *what*
R> functions can be called that way are not known to the program. Of
R> course this is a considerably security whole (passing function
R> names such as 'unlink' or 'system' to my program could produce
R> uncontrollable damage), but this is a very special case and so I
R> don't care about this risk.
that makes no sense. how can you not know in advance all the functions
you have? unless you are using AUTOLOAD which is only for methods (and
methods can be called symbolically anyhow), you know your codebase. this
isn't only about risk but design and coding technique. symrefs are evil
in many ways. they are slower, use the symbol table as a hash (so why
not use your own hash), require disabling strict, you can't as easily
check for missing subs, etc. there is no win to using symrefs for sub
calling, no matter what you say about special cases.
R> Actually, I already had considered passing a whole perl statement
R> to the program and executing it with eval, but in this very
R> particular case I found it more useful to pass the function name
R> and the arguments separately. Hence, the solution with no strict
R> 'refs' does exactly what I want.
your loss. don't expect me to use any of your modules or code.
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: Mon, 15 Jan 2007 18:11:43 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Indirect function call via Name
Message-Id: <6quhq2putvcbc5ci0ht8uqh5vaqao5q8iq@4ax.com>
On Tue, 09 Jan 2007 18:39:48 +0100, Mark Clements
<mark.clementsREMOVETHIS@wanadoo.fr> wrote:
>I'd use a dispatch table.
[snip]
>sub printmessage {
> my $funcname = shift;
> print $dispatch{$funcname}->()."\n";
>}
If real need be, along with magic goto. Generally, there's not.
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: 15 Jan 2007 16:56:17 GMT
From: xhoster@gmail.com
Subject: Re: Issue with CGI module and hidden fields
Message-Id: <20070115115641.351$KO@newsreader.com>
info@misterdoo.co.uk wrote:
> Hi There,
>
> Has anyone seen this behaviour before? If I do this:
>
> print $page->hidden(-name=>'DeleteNoteVal',
> -value=>$data->[$i][0]) ;
>
> the value of $data->[$i][0] is sometimes incorrect
It is hard to figure out what exactly you mean. I suspect it has something
to do with "no_sticky" and "override" in the CGI module. Search the docs
for those terms.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Mon, 15 Jan 2007 11:24:53 -0600
From: "Mumia W. (NOSPAM)" <paduille.4060.mumia.w+nospam@earthlink.net>
Subject: Re: Issue with CGI module and hidden fields
Message-Id: <eoggj6$80e$1@aioe.org>
On 01/15/2007 07:40 AM, info@misterdoo.co.uk wrote:
> Hi There,
>
> Has anyone seen this behaviour before? If I do this:
>
> print $page->hidden(-name=>'DeleteNoteVal',
> -value=>$data->[$i][0]) ;
>
> the value of $data->[$i][0] is sometimes incorrect (not always! - only
> the first hidden variable in a form in this particular case) whereas,
> if I use 'straight' html:
>
> print "<input type='hidden' name='DeleteNoteVal'
> value='$data->[$i][0]' />" ;
>
> everything's fine.
>
> Any ideas?
>
> Cheers
>
> Steve
>
I think I have an idea of what going on there, put I'd prefer to test on
a complete (but small) program. Can you demonstrate the problem in a
small, self-contained CGI/Perl program for me?
--
Windows Vista and your freedom in conflict:
http://www.securityfocus.com/columnists/420/2
------------------------------
Date: 15 Jan 2007 09:53:28 -0800
From: "doolittle" <spam.meplease@ntlworld.com>
Subject: Re: Parsing some input - easy to explain but lengthy to code - suggestions?
Message-Id: <1168883608.210723.164170@38g2000cwa.googlegroups.com>
anno4000@radom.zrz.tu-berlin.de wrote:
> Bob Walton <see.sig@rochester.rr.com> wrote in comp.lang.perl.misc:
> > doolittle wrote:
> > > Hi,
> > >
> > > I have to check that some input conforms to some rules. Although the
> > > rules are simple to expain, my perl function looks too complex/long,
> > > can it be done more simply?
> > >
> > > The rule is that the first character must be a letter, and the second
> > > and third characters must form a number between 1 and 25 (so the third
> > > character is optional)
> > >
> > Try:
> >
> > use warnings;
> > use strict;
> > while(<DATA>){
> > chomp;
> > print "$_->".isOK($_)."\n";
> > }
> > sub isOK{
> > my $str=shift;
> > if($str=~/^[a-z](\d\d?)/i){
> > return(($1>0 and $1<26)?1:0);
> > }
> > else{return 0}
> > }
> > __END__
>
> [data snipped]
>
> That's still more complicated than it has to be. Neither "if {} else
> {}" nor the "?:" construct are necessary:
>
> sub is_ok {
> shift =~ /^[a-z](\d\d?)/i and 1 <= $1 and $1 <= 25;
> }
>
> The only difference is that your routine returns 0 for false while
> is_ok() returns Perl's boolean false which prints as an empty string.
>
> Anno
>
> --
> $anagram = 'Knuth heals rare project'; # by Abigail
> push @{ $pos{ $_}}, $pos ++ for split //, lc $anagram;
> print "print +(split //, '$anagram')[ $_]\n" for
> join ', ', map shift @$_, @pos{ split //, lc "Just another Perl hacker"};
Thanks for the suggestions everyone.
This looks the shortest:
sub is_ok {
shift =~ /^[a-z]([1-9]\d?)$/i and 1 <= $1 and $1 <= 25;
}
I changed it slightly from your original to deal with the fact that Q01
is not allowed, nor is Q123 (no trailing characters)
------------------------------
Date: 15 Jan 2007 10:15:50 -0800
From: "doolittle" <spam.meplease@ntlworld.com>
Subject: Re: Parsing some input - easy to explain but lengthy to code - suggestions?
Message-Id: <1168884950.433240.25640@v45g2000cwv.googlegroups.com>
Tad McClellan wrote:
> doolittle <spam.meplease@ntlworld.com> wrote:
>
>
> > return 0 if $chr !~ /[a-z]/o;
>
> > return 0 if $chr !~ /[1-9]/o;
>
> > return 0 if $chr !~ /\d/o;
>
>
> Why do you think you need the m//o modifier there?
>
> (you don't, it is a no-op)
>
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
Because I grokked 'o' as something you could always append to a regexp
and it would never be bad, provided the regexp didn't contain a
variable that could change.
Incidentally, I grok grok as 'understand partially or
(in)sufficiently', but if grok means 'understand deeply' (as a little
delving suggests) do I grok grok anymore? Guess thats one of those
things you either know or you don't.
------------------------------
Date: Mon, 15 Jan 2007 18:11:44 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Perl free e-books
Message-Id: <l8vhq290fhep38q9j1rd2q7064g854g3qo@4ax.com>
On Fri, 12 Jan 2007 11:08:16 -0500, Uri Guttman <uri@stemsystems.com>
wrote:
> SS> I just wanna make the format of my message as "Times New Roman", not the
> SS> default format of Plain Text file.
>
>STOP TOP POSTING.
>
>and usenet is a PLAIN TEXT only medium. no one cares about your
>formatting requests. html IS NOT ACCEPTED.
Whoa! So Uri does have a shift key...
;-)
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, 15 Jan 2007 18:32:06 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Perl free e-books
Message-Id: <pcenq2h9divgdmu384kurhlu33mru7ukpj@4ax.com>
On Sat, 13 Jan 2007 14:53:07 +0800, "Shuo Shi" <moya0901@126.com>
wrote:
>I am not sure whether your patience has been exhausted, I am amazed about
>it, I was trying to keep myself as a gentleman, all words of mine are nice.
Yet you are once again top posting. This is considered rude. Maybe you
are not even aware that you're doing, but you ARE. Yet I'm sure
somebody already explained you what it's up to: can you read these
words of mine? They're BELOW a trimmed down portion of text quoted
from your own post. You insist in putting your text at the top of the
message leaving the full quoted text of posts you're replying to
below. THAT is top posting and is inconvenient and annoying in many
ways, PLEASE stop to!
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, 15 Jan 2007 18:45:26 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Perl free e-books
Message-Id: <vnenq2tceugb905u8qc8rhkeokvomgrkju@4ax.com>
On Sat, 13 Jan 2007 21:00:46 +0800, "Shuo Shi" <moya0901@126.com>
wrote:
>"Uri Guttman" <uri@stemsystems.com> wrote in message
[snip full quoted content]
>Excuse me, I didn't follow the meaning of STOP TOP POSTING! Just got it.
Ok, you're half way through: indeed you put your reply BELOW the
quoted text. Now you need to learn to trim the latter down, i.e. we
don't need to read it all again, in particular we don't like reading
the quoted .sig, we want to see to which part of the original post
each and any of your comments refer to. For example this comment of
mine refers exclusively to the four lines (one of which blank) above,
no more no less...
HTH,
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, 15 Jan 2007 18:47:15 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Perl free e-books
Message-Id: <0dfnq2h3krrrhlibqsof76k113brceort7@4ax.com>
On 13 Jan 2007 12:16:40 -0800, "solomonrex" <mwidrick@gmail.com>
wrote:
>And I don't understand the top-posting Nazis. This isn't a dinner
Haha, Godwin's Law!
>table, it's a street corner and Google owns it. Be a little clearer
Yes, Google owns it and all your base are belong to us... Sad to say
this, because I appreciate most of Google services and I find them
either interesting or useful or even precious, but the impact of
Google Groups on USENET is IMNSHO awful instead...
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, 15 Jan 2007 18:53:41 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Perl free e-books
Message-Id: <8rfnq2po8qclfgkusn6521383enhar3erk@4ax.com>
On Sun, 14 Jan 2007 14:13:10 -0600, Tad McClellan
<tadmc@augustmail.com> wrote:
>You demean people when you suggest that they cannot type "top-posting"
>into the little box at www.google.com.
Or compose the URL http://www.google.com/search?q=top+posting
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: 15 Jan 2007 10:19:42 -0800
From: "Bucker" <beauchamp.jim@gmail.com>
Subject: Runs Fine In Perl :: Not As Cron Job
Message-Id: <1168885182.296017.38200@v45g2000cwv.googlegroups.com>
Dear Folks,
I have a Perl application that just unzips a zip file once per day.
Perl Program is as follows: (daily.pl is program name)
system("cd /home/website/www/htdocs/batch/");
system("unzip -o /home/website/www/htdocs/batch/images.zip");
That is it..i also send a email to myself once this is completed but
that isn't the issue
because I receive the email every day.
Now..when I run this from the SSH prompt in the batch directory, (perl
daily.pl)
it runs like a champ..no problems no errors.
When I run this from a cron job. The unzip never occurs but I get the
email.
Here is the cron job
15 12 * * * cd /home/website/www/htdocs/batch; perl daily.pl
Now the above launches once a day because I receive the email in
daily.pl. My only issue is that
the unzip -o command in the daily.pl doesn't run. Any one have a
suggestion?
Regards,
Jim
------------------------------
Date: 15 Jan 2007 18:41:23 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Runs Fine In Perl :: Not As Cron Job
Message-Id: <Xns98B98116996B3castleamber@130.133.1.4>
"Bucker" <beauchamp.jim@gmail.com> wrote:
> Dear Folks,
>
> I have a Perl application that just unzips a zip file once per day.
>
> Perl Program is as follows: (daily.pl is program name)
>
>
>
> system("cd /home/website/www/htdocs/batch/");
> system("unzip -o /home/website/www/htdocs/batch/images.zip");
>
>
> That is it..i also send a email to myself once this is completed but
> that isn't the issue
> because I receive the email every day.
>
> Now..when I run this from the SSH prompt in the batch directory, (perl
> daily.pl)
> it runs like a champ..no problems no errors.
>
> When I run this from a cron job. The unzip never occurs but I get the
> email.
>
> Here is the cron job
>
> 15 12 * * * cd /home/website/www/htdocs/batch; perl daily.pl
>
>
> Now the above launches once a day because I receive the email in
> daily.pl. My only issue is that
> the unzip -o command in the daily.pl doesn't run. Any one have a
> suggestion?
Check the output of system, and mail yourself an error if it fails. I
guess that the path to unzip is not known. You could try:
which unzip
and provide the full path.
Yet I still recommend to check if system failed or not, and if it failed
to include this in the email.
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: Mon, 15 Jan 2007 19:07:41 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Skip non english character values
Message-Id: <hlgnq2pr21vqt98vtu02sok38044ntcn8s@4ax.com>
On 13 Jan 2007 00:48:40 -0800, aaron80v@yahoo.com.au wrote:
>I will try to compliant to guide as much as possible. Perhaps it would
You didn't try hard, did you? You missed the very first step, i.e. you
failed to properly quote the post you're replying to...
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, 15 Jan 2007 11:44:07 -0600
From: "Mumia W. (NOSPAM)" <paduille.4060.mumia.w+nospam@earthlink.net>
Subject: Re: variables in substitution
Message-Id: <eoggj8$80e$2@aioe.org>
On 01/15/2007 09:07 AM, Wim wrote:
> Hello,
>
> I am trying to make a substition using rules taken from an array. The
> basics of the program are:
>
> my @A= ( 'AName-9.45', 'Another-6.123' ) ;
> my @NameMap= (
> [ qr/^aname-(\d+)\.(\d+)$/io, 'groupzero-$1-$2' ],
> [ qr/^another-(\d+)\.(\d+)$/io, q/groupone-$1-$2/ ] ) ;
>
> foreach my $a ( @A ) {
> printf "%-17s -> ", $a ;
> $a=~ s/$$_[0]/$$_[1]/i foreach ( @NameMap ) ;
> printf "$a\n" ;
> }
>
> Matching an input string (taken from @A) succeeds. However, replacing
> $1 and $2 by the numbers matched between the parenthesis in de left
> part fails. the literal string $1 appears in the result. Using
> evaluation doesn't work: it will report an uninitialised value. How
> can one take both substitute parameters from an array and use local
> variables $1 at the same time?
>
> Regards,
> Wim Nelis.
>
I would do it this way:
my @A= ( 'AName-9.45', 'Another-6.123' ) ;
my @NameMap= (
[ qr/^aname-(\d+)\.(\d+)$/io, 'groupzero-%d-%d' ],
[ qr/^another-(\d+)\.(\d+)$/io, q/groupone-%d-%d/ ] ) ;
foreach my $a ( @A ) {
printf "%-17s -> ", $a ;
$a =~ s/$$_[0]/sprintf($$_[1],$1,$2)/ei foreach @NameMap;
printf "$a\n" ;
}
HTH
--
Windows Vista and your freedom in conflict:
http://techdirt.com/articles/20061019/102225.shtml
------------------------------
Date: Mon, 15 Jan 2007 19:59:31 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: variables in substitution
Message-Id: <51214qF1hh5utU1@mid.individual.net>
Wim wrote:
> I am trying to make a substition using rules taken from an array. The
> basics of the program are:
>
> my @A= ( 'AName-9.45', 'Another-6.123' ) ;
> my @NameMap= (
> [ qr/^aname-(\d+)\.(\d+)$/io, 'groupzero-$1-$2' ],
> [ qr/^another-(\d+)\.(\d+)$/io, q/groupone-$1-$2/ ] ) ;
>
> foreach my $a ( @A ) {
> printf "%-17s -> ", $a ;
> $a=~ s/$$_[0]/$$_[1]/i foreach ( @NameMap ) ;
> printf "$a\n" ;
> }
>
> Matching an input string (taken from @A) succeeds. However, replacing
> $1 and $2 by the numbers matched between the parenthesis in de left
> part fails. the literal string $1 appears in the result. Using
> evaluation doesn't work: it will report an uninitialised value. How
> can one take both substitute parameters from an array and use local
> variables $1 at the same time?
This is one way:
my @A = ( 'AName-9.45', 'Another-6.123' ) ;
my @NameMap = (
[ qr/^aname-(\d+)\.(\d+)$/i, '"groupzero-$1-$2"' ],
[ qr/^another-(\d+)\.(\d+)$/i, q/"groupone-$1-$2"/ ]
);
foreach my $a ( @A ) {
printf "%-17s -> ", $a;
$a =~ s/$$_[0]/$$_[1]/eei foreach @NameMap;
print "$a\n";
}
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
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 32
*************************************