[29049] in Perl-Users-Digest
Perl-Users Digest, Issue: 293 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 2 14:10:16 2007
Date: Mon, 2 Apr 2007 11:09:11 -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, 2 Apr 2007 Volume: 11 Number: 293
Today's topics:
--chop-long-lines wpmccormick@gmail.com
Re: --chop-long-lines <jurgenex@hotmail.com>
Re: --chop-long-lines wpmccormick@gmail.com
Re: --chop-long-lines <purlgurl@purlgurl.net>
Re: --chop-long-lines <jurgenex@hotmail.com>
Re: --chop-long-lines <klaus03@gmail.com>
Re: --chop-long-lines <bik.mido@tiscalinet.it>
Re: --chop-long-lines <paduille.4060.mumia.w+nospam@earthlink.net>
Re: Any good Perl coders out there? <uri@stemsystems.com>
Re: Any good Perl coders out there? <bik.mido@tiscalinet.it>
Re: Any good Perl coders out there? <uri@stemsystems.com>
Re: Any good Perl coders out there? <bik.mido@tiscalinet.it>
Apache, perl and WinXP cmd.exe - problem with percent s <barlak@poczta.onet.pl>
Re: Apache, perl and WinXP cmd.exe - problem with perce <barlak@poczta.onet.pl>
Re: Apache, perl and WinXP cmd.exe - problem with perce <bik.mido@tiscalinet.it>
Re: Apache, perl and WinXP cmd.exe - problem with perce <jurgenex@hotmail.com>
Re: Apache, perl and WinXP cmd.exe - problem with perce <bik.mido@tiscalinet.it>
Re: Apache, perl and WinXP cmd.exe - problem with perce <purlgurl@purlgurl.net>
Re: Apache, perl and WinXP cmd.exe - problem with perce <purlgurl@purlgurl.net>
Re: Apache, perl and WinXP cmd.exe - problem with perce <purlgurl@purlgurl.net>
Re: Apache, perl and WinXP cmd.exe - problem with perce <purlgurl@purlgurl.net>
comp.lang.perl.cgi? <noreply@gunnar.cc>
Re: comp.lang.perl.cgi? <cwilbur@chromatico.net>
Re: How to put the command ls -l| awk '{print $1" "$5" <someone@example.com>
TCP Server+perl <himagauri@gmail.com>
Trailing whitespace question <junk@yahoo.com>
Re: Trailing whitespace question <purlgurl@purlgurl.net>
Re: Trailing whitespace question <purlgurl@purlgurl.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 2 Apr 2007 07:04:33 -0700
From: wpmccormick@gmail.com
Subject: --chop-long-lines
Message-Id: <1175522673.254427.154900@y80g2000hsf.googlegroups.com>
How can you print a line of text without line wrapping? This would be
similar to the --chop-long-lines param in less.
Thanks!
------------------------------
Date: Mon, 02 Apr 2007 14:56:20 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: --chop-long-lines
Message-Id: <oQ8Qh.389$yL1.115@trndny04>
wpmccormick@gmail.com wrote:
> How can you print a line of text without line wrapping?
????
Buy a printer with very wide paper? Use a tiny font? Have shorter lines of
text?
jue
------------------------------
Date: 2 Apr 2007 08:08:37 -0700
From: wpmccormick@gmail.com
Subject: Re: --chop-long-lines
Message-Id: <1175526517.512502.146310@p15g2000hsd.googlegroups.com>
On Apr 2, 9:56 am, "J=FCrgen Exner" <jurge...@hotmail.com> wrote:
> wpmccorm...@gmail.com wrote:
> > How can you print a line of text without line wrapping?
>
> ????
> Buy a printer with very wide paper? Use a tiny font? Have shorter lines of
> text?
Print to the terminal
------------------------------
Date: Mon, 02 Apr 2007 08:11:00 -0700
From: Purl Gurl <purlgurl@purlgurl.net>
Subject: Re: --chop-long-lines
Message-Id: <tZ-dnW1jvr-ZgIzbnZ2dnUVZ_hadnZ2d@giganews.com>
Jürgen Exner wrote:
> wpmccormick wrote:
>> How can you print a line of text without line wrapping?
> Buy a printer with very wide paper? Use a tiny font? Have shorter lines of
> text?
Nah, load your printer paper sidewards, then print
in a "landscape" mode.
However, this might prove challenging when using a
dot matrix tractor feed printer.
Purl Gurl
------------------------------
Date: Mon, 02 Apr 2007 15:12:54 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: --chop-long-lines
Message-Id: <W39Qh.3266$hI4.300@trndny08>
wpmccormick@gmail.com wrote:
> On Apr 2, 9:56 am, "Jürgen Exner" <jurge...@hotmail.com> wrote:
>> wpmccorm...@gmail.com wrote:
>>> How can you print a line of text without line wrapping?
>>
>> ????
>> Buy a printer with very wide paper? Use a tiny font? Have shorter
>> lines of text?
> Print to the terminal
Ok, so no printer with very wide paper. But I still don't understand what
you expect to happen with a line of text, that is too long to fit on that
terminal of yours.
jue
------------------------------
Date: 2 Apr 2007 08:19:23 -0700
From: "Klaus" <klaus03@gmail.com>
Subject: Re: --chop-long-lines
Message-Id: <1175527163.705031.162480@q75g2000hsh.googlegroups.com>
On Apr 2, 4:04 pm, wpmccorm...@gmail.com wrote:
> How can you print a line of text without line wrapping? This would be
> similar to the --chop-long-lines param in less.
You should explain what you expect from "--chop-long-lines" param in
less.
Here is what I have found on http://www.computerhope.com/unix/uless.htm
==========================================
--chop-long-lines
Causes lines longer than the screen width to be chopped
rather than folded. That is, the remainder of a long line is
simply discarded. The default is to fold long lines; that is,
display the remainder on the next line.
==========================================
Is that what you expect ?
If so, then one of the many possible solutions could be:
use strict;
use warnings;
# first, read in the size of your terminal (maybe you could
# use GetTerminalSize() from Term::ReadKey)
# then, process your data line by line (don't forget to
# chomp if you read line by line from a file)
# if the length of your line is greater than the size of your
# terminal, then use substr() to cut the line (you might
# even want to consider cutting down to terminalsize - 1)
# print each line with a "\n" at the end
--
Klaus
------------------------------
Date: Mon, 02 Apr 2007 18:07:43 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: --chop-long-lines
Message-Id: <3ha213l8i9nb7f4hecntm3plj9r5b4tmsh@4ax.com>
On 2 Apr 2007 07:04:33 -0700, wpmccormick@gmail.com wrote:
>How can you print a line of text without line wrapping? This would be
>similar to the --chop-long-lines param in less.
I don't know less' switch, but basing on its name and... without
wrapping... how 'bout substr()?
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, 02 Apr 2007 16:21:28 GMT
From: "Mumia W." <paduille.4060.mumia.w+nospam@earthlink.net>
Subject: Re: --chop-long-lines
Message-Id: <c4aQh.133660$_73.59787@newsread2.news.pas.earthlink.net>
On 04/02/2007 09:04 AM, wpmccormick@gmail.com wrote:
> How can you print a line of text without line wrapping? This would be
> similar to the --chop-long-lines param in less.
>
> Thanks!
>
You can use the "substr" command:
Start->Run->"perldoc -f substr"
------------------------------
Date: Mon, 02 Apr 2007 09:26:24 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Any good Perl coders out there?
Message-Id: <x7648eucu7.fsf@mail.sysarch.com>
>>>>> "J" == Jamie <nospam@geniegate.com> writes:
J> In <x74pnzv3ea.fsf@mail.sysarch.com>,
J> Uri Guttman <uri@stemsystems.com> mentions:
>>>>>>> "f" == fishfry <BLOCKSPAMfishfry@your-mailbox.com> writes:
>> perl isn't in any decline. just that more kiddies who can't code are
>> using php. fine with us. perl is used for much more outside the web
>> anyhow. ever heard php called the ducttape of the internet?
J> I'd still say perl *is* in decline, certainly in regards to small
J> business use. Definately in regards to the jobs I run across these days.
J> Seems pretty obvious to me.
then you are not looking for the right jobs :)
J> In the past, perl was used a lot by smaller businesses (and even
J> hobby websites) I know this, because I took on a lot of perl
J> projects in those days. Nowadays, those jobs are all but gone,
J> replaced with PHP.
smaller businesses don't count. they will always use the easy way out.
J> Webmasters and people who used to hire "perl monkeys" now look to
J> PHP, I've spoken with them about doing stuff in perl, they often
J> tell me it would be a "step backwards".
that is all web stuff. perl is used for much more non-web stuff than web
stuff. ever see a sysadmin use php to glue stuff?
J> I know people who will not use perl because the perception is that perl
J> programmers are jerks. (same with apple, unix and particularly linux)
and certified redmond kiddies are morons. bfd.
>> everyone comes to the perl group as they claim we are
>> smarter. hmmm, smarter coders use perl but perl is losing ground. sounds
>> like the kiddies are learning that php is not as good as they hoped and
>> they will never learn more from their fellow php kiddies. too bad.
J> I don't believe anyone claims perl coders are "smarter" except maybe the
J> perl coders themselves.
you haven't been around enough perl media. try irc sometimes and that is
what happens a lot. "oh, no one is in #otherchannel or they are too
dumb, help me with this regex. perler all know regexes better"
i think that is because perl hackers understand that regexes are a
language and we usually know other langs. too many kiddies barely know
php so regexes are greek to them.
J> That aside, let them ask, don't assume they're stupid, could be
J> they're just seeking out a little human connection, could be they
J> are overwhelmed by all the available documentation.
or not use to being a professional programmer. simpler answer. smarts
isn't the only thing. wanting to know how to program and putting in the
effort is major. just being a php/html monkey doesn't TEACH you much
other than bad coding habits.
J> Whats more, there's no law saying anyone has to answer something they don't
J> feel like answering.
then they get bad answers from moronzilla. we regulars do have to keep
some order here. :)
J> Bottom line, if you're someone who likes perl and wants more perl
J> opportunities for everyone... be nice to people.
i try until they exasperate me.
J> BTW, uri, I heard you on perlcast, good job!
thanx. i was nice there? :)
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, 02 Apr 2007 17:55:08 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Any good Perl coders out there?
Message-Id: <lp9213l2n1ggtm513ba1psnok0dl3hqooe@4ax.com>
On Mon, 02 Apr 2007 09:26:24 -0400, Uri Guttman <uri@stemsystems.com>
wrote:
>or not use to being a professional programmer. simpler answer. smarts
Remember that amateurs built Noah's Ark.
Professionals built the Titanic.
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, 02 Apr 2007 13:36:50 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Any good Perl coders out there?
Message-Id: <x7abxqsmod.fsf@mail.sysarch.com>
>>>>> "MD" == Michele Dondi <bik.mido@tiscalinet.it> writes:
MD> On Mon, 02 Apr 2007 09:26:24 -0400, Uri Guttman <uri@stemsystems.com>
MD> wrote:
>> or not use to being a professional programmer. simpler answer. smarts
MD> Remember that amateurs built Noah's Ark.
MD> Professionals built the Titanic.
but $DEITY designed the ark and arrogant humans designed the titanic.
and i don't use the word professional as someone who gets paid. i use it
as someone who chose a profession because they are good at it. amateur
and professional also mean the attitude you have about your work. you
can say a paid piece of work looks amateurish or a free piece looks
professional.
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, 02 Apr 2007 20:00:31 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Any good Perl coders out there?
Message-Id: <4ig213lacofv6a0b7ij1inj0vbn411o02e@4ax.com>
On Mon, 02 Apr 2007 13:36:50 -0400, Uri Guttman <uri@stemsystems.com>
wrote:
>and i don't use the word professional as someone who gets paid. i use it
>as someone who chose a profession because they are good at it. amateur
Seriously, you're doing good specifying that, because I often find
your insisting on "professionalism". Even with this pinpointing, I
still find it to be...
>and professional also mean the attitude you have about your work. you
>can say a paid piece of work looks amateurish or a free piece looks
>professional.
...in fact it's all based on an IMHO popular cultural misconception,
namely the one relying on the implicit equations professional=good,
amateurish=bad. Even using the verb "to look" in your statement above
reflects this biased idea. I'm not claiming the "right" equations are
the opposite ones, either. Nor that the two things are completely
orthogonal. Personally I think some disequation is best describing the
situation...
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: 2 Apr 2007 07:15:50 -0700
From: "Bartek Lakomiec" <barlak@poczta.onet.pl>
Subject: Apache, perl and WinXP cmd.exe - problem with percent sign in arg list
Message-Id: <1175523350.073055.169320@n76g2000hsh.googlegroups.com>
Hi everybody,
I'm using Windows XP, ActivePerl 5.8, Apache HTTP server 2.2.3, and
I'm in a trouble with the following piece of code (let's call it
"my_code.pl") which calls "cleartool" application to dump some data
into a temporary file (to be used later):
my $arg = ...;
my $temp_output_filename = ...;
my $cmd = "c:\\windows\\system32\\cmd.exe /c \"cleartool descr -fmt %c
" . $arg " >$temp_output_filename \"";
ret = system($cmd);
It works fine when I execute it as "perl my_code.pl" - the result is
the same as when I paste "cleartool..." in a command window.
The code fails and generates "Cannot spawn cmd.exe" error when I try
to execute it from a website. By trials and errors I concluded the
reason for that is "-fmt %c". I tried some possible ways of escaping
the percent sign, and it doesn't help.
Will appreciate any comments on possible reasons/solutions.
--BL
------------------------------
Date: 2 Apr 2007 09:01:12 -0700
From: "Bartek Lakomiec" <barlak@poczta.onet.pl>
Subject: Re: Apache, perl and WinXP cmd.exe - problem with percent sign in arg list
Message-Id: <1175529672.517666.76970@e65g2000hsc.googlegroups.com>
The lines I enclosed are not a complete program, and are meant to
illustrate the problem.
I will be gratefull for any comments on invoking perl's system()
function and Apache/perl/cmd.exe cooperation.
Thanx
--BL
On 2 Kwi, 17:06, Purl Gurl <purlg...@purlgurl.net> wrote:
> Declaring "my" lexical variables on a global basis serves
> only to decrease script efficiency. Despite claims to the
> contrary by the "learned" around here, avoid declaring "my"
> variables as global variables. This is not a good practice.
>
> Should you be using the broken "strict" module, use "our"
> for declaring global variables, which also serves no purpose
> other than to place a band-aid on the broken strict module.
>
> Purl Gurl
------------------------------
Date: Mon, 02 Apr 2007 18:14:18 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Apache, perl and WinXP cmd.exe - problem with percent sign in arg list
Message-Id: <mma213durkpiq3rqcbvtdoif8ol5enikm3@4ax.com>
On 2 Apr 2007 07:15:50 -0700, "Bartek Lakomiec"
<barlak@poczta.onet.pl> wrote:
>my $cmd = "c:\\windows\\system32\\cmd.exe /c \"cleartool descr -fmt %c
>" . $arg " >$temp_output_filename \"";
^
^
(1) Post real code;
(2) use alternative delimiters:
:my $cmd = qq|c:\\windows\\system32\\cmd.exe /c "cleartool descr -fmt %c$arg >$temp_output_filename"|;
or perhaps you meant
:my $cmd = qq|c:\\windows\\system32\\cmd.exe /c "cleartool descr -fmt %c $arg >$temp_output_filename"|;
>The code fails and generates "Cannot spawn cmd.exe" error when I try
>to execute it from a website. By trials and errors I concluded the
>reason for that is "-fmt %c". I tried some possible ways of escaping
>the percent sign, and it doesn't help.
I'm not really sure, but ISTR that doubling it would work, doesn't it?
:my $cmd = qq|c:\\windows\\system32\\cmd.exe /c "cleartool descr -fmt %%c $arg >$temp_output_filename"|;
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, 02 Apr 2007 16:22:13 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Apache, perl and WinXP cmd.exe - problem with percent sign in arg list
Message-Id: <V4aQh.4206$5x6.1218@trndny02>
Bartek Lakomiec wrote:
> On 2 Kwi, 17:06, Purl Gurl <purlg...@purlgurl.net> wrote:
Oh, it is back. It is back. Amazing! Haven't seen it in a long time.
>> variables as global variables. This is not a good practice.
Absolutely agree. Use of global variables usually indicate poor coding
style.
>> Should you be using the broken "strict" module, use "our"
>> for declaring global variables, which also serves no purpose
>> other than to place a band-aid on the broken strict module.
Which of course is utter nonsense. But what would you expect from it.
jue
------------------------------
Date: Mon, 02 Apr 2007 20:05:05 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Apache, perl and WinXP cmd.exe - problem with percent sign in arg list
Message-Id: <e8h213h09jvtq2ji125gtcahtk3kumgedu@4ax.com>
On 2 Apr 2007 09:01:12 -0700, "Bartek Lakomiec"
<barlak@poczta.onet.pl> wrote:
>The lines I enclosed are not a complete program, and are meant to
>illustrate the problem.
Yet they're syntactically wrong. Don't do that. It's rude and
disrespectful.
>I will be gratefull for any comments on invoking perl's system()
>function and Apache/perl/cmd.exe cooperation.
Weren't the other answers useful?
>Thanx
>--BL
>
>On 2 Kwi, 17:06, Purl Gurl <purlg...@purlgurl.net> wrote:
Please do not top-post. Don't do that. Not even when answering to our
resident troll. It's rude and disrespectful.
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, 02 Apr 2007 08:06:00 -0700
From: Purl Gurl <purlgurl@purlgurl.net>
Subject: Re: Apache, perl and WinXP cmd.exe - problem with percent sign in arg list
Message-Id: <XtKdnYq86spFhozbnZ2dnUVZ_t2tnZ2d@giganews.com>
Bartek Lakomiec wrote:
(snipped)
> I'm in a trouble with the following piece of code (let's call it
> my $arg = ...;
> my $temp_output_filename = ...;
> my $cmd = "c:\\windows\\system32\\cmd.exe /c \"cleartool descr -fmt %c" . $arg " >$temp_output_filename \"";
> ret = system($cmd);
String found where operator expected at test.pl line 5, near "$arg " >$temp_output_filename \"""
(Missing operator before " >$temp_output_filename \""?)
syntax error at test.pl line 3, near "= ..."
syntax error at test.pl line 4, near "= ..."
syntax error at test.pl line 5, near "$arg " >$temp_output_filename \"""
test.pl had compilation errors.
Declaring "my" lexical variables on a global basis serves
only to decrease script efficiency. Despite claims to the
contrary by the "learned" around here, avoid declaring "my"
variables as global variables. This is not a good practice.
Should you be using the broken "strict" module, use "our"
for declaring global variables, which also serves no purpose
other than to place a band-aid on the broken strict module.
Purl Gurl
------------------------------
Date: Mon, 02 Apr 2007 09:26:18 -0700
From: Purl Gurl <purlgurl@purlgurl.net>
Subject: Re: Apache, perl and WinXP cmd.exe - problem with percent sign in arg list
Message-Id: <apydnZY8s4o0s4zbnZ2dnUVZ_tKjnZ2d@giganews.com>
Bartek Lakomiec wrote:
(Top posting corrected)
(Purl Gurl wrote)
(snipped)
> The lines I enclosed are not a complete program, and are meant to
> illustrate the problem.
Rule in this group is to not post code
which will not compile. Upon posting
code which will compile, readers will
be more apt to assist you.
Readers need to know you are not making other
errors which prevent correction of your error
of concern.
#!perl
$cmd = "c:\\windows\\system32\\cmd.exe /c \"cleartool descr -fmt %c" . $arg " >$temp_output_filename \"";
c:\apache\users\test>perl -c test.pl
PRINTED RESULTS:
String found where operator expected at test.pl line 3, near "$arg " >$temp_output_filename \"""
(Missing operator before " >$temp_output_filename \""?)
syntax error at test.pl line 3, near "$arg " >$temp_output_filename \"""
test.pl had compilation errors.
---
You previously write this percentage sign is the source of your problem.
You also write,
"It works fine when I execute it...."
My testing suggests you are practicing deceit.
Purl Gurl
------------------------------
Date: Mon, 02 Apr 2007 09:35:22 -0700
From: Purl Gurl <purlgurl@purlgurl.net>
Subject: Re: Apache, perl and WinXP cmd.exe - problem with percent sign in arg list
Message-Id: <PpmdnR9Upe1RrYzbnZ2dnUVZ_s-rnZ2d@giganews.com>
Jürgen Exner wrote:
> Bartek Lakomiec wrote:
>> Purl Gurl wrote:
> Oh, it is back. It is back. Amazing! Haven't seen it in a long time.
> Which of course is utter nonsense. But what would you expect from it.
Your historical and frequent childish trolling of this discussion group
benefits none.
Purl Gurl
------------------------------
Date: Mon, 02 Apr 2007 09:38:59 -0700
From: Purl Gurl <purlgurl@purlgurl.net>
Subject: Re: Apache, perl and WinXP cmd.exe - problem with percent sign in arg list
Message-Id: <iKWdnSfUWJQ-rIzbnZ2dnUVZ_qmpnZ2d@giganews.com>
Bartek Lakomiec wrote:
> my $cmd = "c:\\windows\\system32\\cmd.exe /c \"cleartool descr -fmt %c
> " . $arg " >$temp_output_filename \"";
> to execute it from a website. By trials and errors I concluded the
> reason for that is "-fmt %c". I tried some possible ways of escaping
> the percent sign, and it doesn't help.
http://www.windowsitpro.com/Article/ArticleID/39047/39047.html
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx?mfr=true
http://commandwindows.com/tipsandtricks.htm
Purl Gurl
------------------------------
Date: Mon, 02 Apr 2007 18:18:21 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: comp.lang.perl.cgi?
Message-Id: <57coqhF2brqlpU1@mid.individual.net>
The group comp.infosystems.www.authoring.cgi has been down for several
months. As far as I can understand, it means that there is no longer an
appropriate Usenet group for those who use Perl for web applications to
discuss CGI and HTTP matters.
Maybe it's time to establish the group comp.lang.perl.cgi?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 02 Apr 2007 12:38:00 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: comp.lang.perl.cgi?
Message-Id: <87r6r2g2af.fsf@mithril.chromatico.net>
>>>>> "GH" == Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
GH> The group comp.infosystems.www.authoring.cgi has been down for
GH> several months. As far as I can understand, it means that
GH> there is no longer an appropriate Usenet group for those who
GH> use Perl for web applications to discuss CGI and HTTP matters.
On the contrary; it means that there is an appropriate Usenet group,
which nobody happens to be using.
GH> Maybe it's time to establish the group comp.lang.perl.cgi?
The procedure for creating a new newsgroup is well-established and
well-known. Have fun!
Charlton
--
Charlton Wilbur
cwilbur@chromatico.net
------------------------------
Date: Mon, 02 Apr 2007 15:43:25 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: How to put the command ls -l| awk '{print $1" "$5" "$9}' in a perl script?
Message-Id: <xw9Qh.31232$x9.8570@edtnps89>
Peter J. Holzer wrote:
> On 2007-04-02 04:56, John W. Krahn <someone@example.com> wrote:
>>robertchen117@gmail.com wrote:
>>>In a Unix server,
>>>#cd /tmp
>>># ls -l| awk '{print $1" "$5" "$9}'
>>>total
>>>-rw------- 159045 1IUPKPnHDb
>>>-rw------- 1287908 1Mbi68lSf3
>>>-rw------- 1475 1o3Bj5Dc1G
>>>...
> [...]
>>>How to put the command ls -l| awk '{print $1" "$5" "$9}' in a perl
>>>script?
>>use Fcntl ':mode';
>>
>>for my $file ( <*> ) {
>> my ( $mode, $size ) = ( stat $file )[ 2, 7 ];
>> print +
>> ($mode & S_IFDIR) ? 'd' : '-',
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Unix knows more file types than directories and regular files.
I know Peter. I just wanted to keep it simple for this example. :-)
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
------------------------------
Date: 2 Apr 2007 10:49:25 -0700
From: "Gauri" <himagauri@gmail.com>
Subject: TCP Server+perl
Message-Id: <1175536165.609515.48380@b75g2000hsg.googlegroups.com>
I'm trying to do socket communication between two machines Linux and
MVS.
On Linux side, the code is programmed in Perl and on the MVS side in
Rexx.
The Perl code I have is designed as a TCP Server which should process
several Clients at the same time.
I've used Forks for this. I close the Parent Server and make the child/
Client processes orphans because I want to to spawn of a new child/
Client each time a new connection is established at the Socket.
But here is what happens. Lets say in the beginning 4 connections are
established by the socket, 4 child processes are spawned off, When
each child completes processing it closes/ends. In the meanwhile 4
more connections are already established at the socket and are waiting
to be spawned off (and ideally each new child should be spawned off
immediately, irrespective if the previous children have finished
processing or not.).
However in my current scenario, if one of the child process takes more
time to complete, the 4 new established connections still wait, for
the slower child to finish. It's only when all 4 children spawned off
in the first go are completed, that the 4 new waiting processes are
spawned off.
I want each child to spawn off as soon as the connection is made.
I believe that perhaps my parent is not being closed properly. Here is
the piece of code.
Any suggestions are welcome.
-Thanks,
Gauri
# Main loop control variable
$time_to_die = 0;
# Set up signal handler, which just sets the global to exit the main
loop
$SIG{INT} = $SIG{TERM} = $SIG{HUP} = \&SIG_HANDLER;
# Build the socket: standard Perl boilerplate
socket(SERVER, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, 1);
$my_addr = sockaddr_in($PORT,INADDR_ANY);
bind(SERVER,$my_addr) or do {
$s="Couldn't bind to port $PORT";
mylog($s,"crit");
die "$s : $!\n";
};
listen(SERVER, SOMAXCONN) or do {
$s="Couldn't listen on port $PORT";
mylog($s,"crit");
die("$s : $!\n");
};
# Main listen/fork loop: straight-ahead forking server. You exit the
main
# loop by sending a signal to the program, which then sets the global
variable
# $time_to_die in the signal handler, and then the next time through
the
# loop, the program exits and shuts down.
until($time_to_die) {
$client = accept(CLIENT, SERVER);
select CLIENT; # By default, print to socket
$| = 1; # Turn on autoflush so prints happen
# immediately and there's no
buffering
next unless ($client);
($port,$packed_ip) = sockaddr_in($client);
$dq = inet_ntoa($packed_ip);
mylog("Connection from $dq : $port");
# Fork and exec main server loop
$pid = fork();
die "fork: $!" unless defined $pid;
if ($pid) {
# Parent
} else {
mylog("Child starting with connection from $dq : $port");
close(SERVER); # child doesn't need it
mainloop(); # Go do the actual work
mylog("Child exiting");
exit 0;
}
}
continue {
close(CLIENT); # Parent doesn't need it
}
mylog("End of main event loop reached (signal, most likely): Exiting
now.");
close (SERVER);
exit 0;
# End of mainline code
------------------------------
Date: Mon, 02 Apr 2007 11:27:11 -0400
From: nun <junk@yahoo.com>
Subject: Trailing whitespace question
Message-Id: <P8qdnW2uupdQvYzbnZ2dnUVZ_oKnnZ2d@megapath.net>
I'm reading data from a text file into an array like this:
push @AoA, [(
substr($_, 0, 4),
substr($_, 4, 20),
substr($_, 24, 30),
substr($_, 54, 8),
substr($_, 70, 8),
substr($_, 103, 20),
substr($_, 123, 1),
)];
I'd like to trim any trailing spaces from the substr($_, 24, 30) entry.
I see from Google that:
s/ *$//;
should do what I want, but I'm unsure how to modify my script to include
this. Can someone help?
DB
------------------------------
Date: Mon, 02 Apr 2007 09:06:43 -0700
From: Purl Gurl <purlgurl@purlgurl.net>
Subject: Re: Trailing whitespace question
Message-Id: <CYadnS8ijP-Pt4zbnZ2dnUVZ_uygnZ2d@giganews.com>
nun wrote:
> I'm reading data from a text file into an array like this:
> push @AoA, [(
> substr($_, 0, 4),
> substr($_, 4, 20),
> substr($_, 24, 30),
> substr($_, 54, 8),
> substr($_, 70, 8),
> substr($_, 103, 20),
> substr($_, 123, 1),
> )];
> I'd like to trim any trailing spaces from the substr($_, 24, 30) entry.
#!perl
$data = "Taha Is The Greatest Perl Programmer Ever";
push @AoA, [(
substr($data, 0, 4),
substr($data, 5, 2),
substr($data, 8, 3),
substr($data, 12, 12),
)];
print $AoA[0][3];
print "X";
print "\n\n";
$AoA[0][3] =~ s/ +$//;
print $AoA[0][3];
print "X";
PRINTED RESULTS:
Greatest X
GreatestX
Purl Gurl
------------------------------
Date: Mon, 02 Apr 2007 10:09:14 -0700
From: Purl Gurl <purlgurl@purlgurl.net>
Subject: Re: Trailing whitespace question
Message-Id: <34WdnQ-Zy8EkpYzbnZ2dnUVZ_uCinZ2d@giganews.com>
Purl Gurl wrote:
> nun wrote:
>> I'm reading data from a text file into an array like this:
>> push @AoA, [(
>> substr($_, 0, 4),
>> substr($_, 4, 20),
>> substr($_, 24, 30),
>> substr($_, 54, 8),
>> substr($_, 70, 8),
>> substr($_, 103, 20),
>> substr($_, 123, 1),
>> )];
>> I'd like to trim any trailing spaces from the substr($_, 24, 30) entry.
Here is another approach based upon an assumption your
data of interest contains no spaces, other than leading
or trailing spaces. This only works if one of your parameters
is no spaces in returned parsed data.
Be sure you understand this will not work if you expect
to have spaces in your parsed resulting data.
#!perl
$data = "Taha Is The Greatest Perl Programmer Ever";
push @AoA, [(split (/ +/, $data))];
print $AoA[0][3];
PRINTED RESULTS:
Greatest
Purl Gurl
------------------------------
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 293
**************************************