[28789] in Perl-Users-Digest
Perl-Users Digest, Issue: 33 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 15 18:06:02 2007
Date: Mon, 15 Jan 2007 15: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: 33
Today's topics:
Re: Any buddy looking for Job in software testing <dha@panix.com>
Re: Asynchronous alert <sun_tong_001@users.sourceforge.net>
CGI & LWP::UserAgent - forwarding cookies - how? <arifsaha@gmail.com>
Re: convert Vbscript to Perl code <news@lawshouse.org>
Re: convert Vbscript to Perl code <tadmc@augustmail.com>
Re: how to "see" DOS errorlevel codes? <mritty@gmail.com>
Re: how to "see" DOS errorlevel codes? <rvtol+news@isolution.nl>
Re: How to create a binary file from a perl pgm <news@lawshouse.org>
Re: 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>
How to insert or append new items into a perl hash ? <cooldudevamsee@gmail.com>
Re: How to insert or append new items into a perl hash <john@castleamber.com>
Re: How to insert or append new items into a perl hash <cooldudevamsee@gmail.com>
Re: How to insert or append new items into a perl hash <news@lawshouse.org>
Re: How to insert or append new items into a perl hash vamsee.2005@gmail.com
My program dies. krivenok.dmitry@gmail.com
Re: Parsing some input - easy to explain but lengthy to <tadmc@augustmail.com>
Re: Perl free e-books <tadmc@augustmail.com>
Problem with XMLin data structure. vamsee.2005@gmail.com
Re: Problem with XMLin data structure. <john@castleamber.com>
Re: Problem with XMLin data structure. vamsee.2005@gmail.com
Re: Runs Fine In Perl :: Not As Cron Job <yankeeinexile@gmail.com>
Re: Runs Fine In Perl :: Not As Cron Job <mritty@gmail.com>
substituting words and maintaining case? <art@example.com>
Re: substituting words and maintaining case? <someone@example.com>
Re: substituting words and maintaining case? <tadmc@augustmail.com>
the => operator fatwallet961@yahoo.com
Re: the => operator <abigail@abigail.be>
Re: variables in substitution <tadmc@augustmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 15 Jan 2007 20:25:52 +0000 (UTC)
From: "David H. Adler" <dha@panix.com>
Subject: Re: Any buddy looking for Job in software testing
Message-Id: <slrneqnoqh.hhj.dha@panix2.panix.com>
On 2007-01-15, fhk6431@gmail.com <fhk6431@gmail.com> wrote:
> Hey..
>
> My company is aggresively looking for people to hire in software
> testing..
You have posted a job posting or a resume in a technical group.
Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.
Had you read and understood the Usenet user manual posted frequently to
"news.announce.newusers", you might have already known this. :) (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)
Another good source of information on how Usenet functions is
news.newusers.questions (information from which is also available at
http://www.geocities.com/nnqweb/).
Please do not explain your posting by saying "but I saw other job
postings here". Just because one person jumps off a bridge, doesn't
mean everyone does. Those postings are also in error, and I've
probably already notified them as well.
If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.
http://jobs.perl.org may be of more use to you
Yours for a better usenet,
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"You're on dry land! Squeaky Whale can't save you now!"
- Stephen Cole
------------------------------
Date: 15 Jan 2007 21:42:01 GMT
From: * Tong * <sun_tong_001@users.sourceforge.net>
Subject: Re: Asynchronous alert
Message-Id: <45abf529$0$4849$88260bb3@free.teranews.com>
On Mon, 15 Jan 2007 01:39:30 -0600, Mumia W. (NOSPAM) wrote:
>>>> I'm trying to write an alert detection script.
>>>>
>>>> Generally, the script loops to detect if the alert criteria is met,
>>>> and if so, alert the user. Somewhat like this:
>>
>> my $alerted;
>> for(;;){
>> my $flag=detect_flag
>> if($flag){
>> alert_user unless $alerted;
>> $alerted=1
>> }
>> }
>>
>>>> The 'alert_user' can be as simple as a pop up window via Xdialog. Once the
>>>> alert goes off, it might take some time to resolve, but I don't want to
>>>> alert user again and again, hence the '$alerted' var. The problem is that
>>>> I need a way to clear the '$alerted' var. I think, to make it simple, the
>>>> best time is when the user confirm the alert pop up window.
>>>>
>>>> Now, what's the easiest way to do it? The reason I wanted to use Xdialog is
>>>> because it's extreme easy to code, but I can't think of a way to clear the
>>>> '$alerted' var.
>>
>> IMHO, as a *general purpose* *high-level* code snip, it is complete. What
>> only lacks is the way/mechanism to reset $alerted asynchronous, which I
>> don't know and is asking -- how to reset it determines how the alert_user()
>> is coded, and there is no need to dive into the detect_flag() at all.
>
> Under what conditions do you want to clear the $alerted flag?
I think, to make it simple, the best time is when the user confirm the
alert pop up window -- i.e., user click, pop up gone, $alerted cleared.
how is that?
--
Tong (remove underscore(s) to reply)
http://xpt.sf.net/techdocs/
http://xpt.sf.net/tools/
--
Posted via a free Usenet account from http://www.teranews.com
------------------------------
Date: 15 Jan 2007 12:25:53 -0800
From: "S P Arif Sahari Wibowo" <arifsaha@gmail.com>
Subject: CGI & LWP::UserAgent - forwarding cookies - how?
Message-Id: <1168892753.176785.207500@51g2000cwl.googlegroups.com>
Hi!
I am developing a CGI application (using CGI module), which upon
processing (when user submit) will contact a second httpd server using
LWP::UserAgent.
The issue is, I need to forward some cookies (authentication cookies) -
that the application receievd - to the second server. I know
LWP::UserAgent use HTTP::Cookies to represent it cookie jar, but I
cannot find out how I can inject a new cookie into the jar, especially
when the cookie came from a CGI application.
Any ideas how I can do this? Can I somehow inject "raw_cookie" from CGI
directly into LWP::UserAgent?
Thanks!
http://www.arifsaha.com/
------------------------------
Date: Mon, 15 Jan 2007 19:03:23 +0000
From: Henry Law <news@lawshouse.org>
Subject: Re: convert Vbscript to Perl code
Message-Id: <1168887797.21549.0@proxy02.news.clara.net>
Boris Skoblo wrote:
> Hi All,
>
> please help me convert following VBscript code to Perl code
> ...............................................................................................
> strLDAP = "LDAP://CN=test,OU=users,DC=tech,DC=com"
Boris, the people who hang out here do so because they know Perl. The
chances of finding one who knows VB-thing are very small. The chances
of finding one of those who is also prepared to do your work for you
from scratch is even smaller ... approaching zero.
Hint: have a go at getting some of this into Perl. Post with your
difficulties and people will be much more willing to help. Oh, and if
you're posting VB then make sure you tell us what it does.
Posting guidelines appear here very regularly; Google for them if you
need to. They are useful; my advice would be to follow them for your
next post here.
--
Henry Law Manchester, England
------------------------------
Date: Mon, 15 Jan 2007 14:37:55 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: convert Vbscript to Perl code
Message-Id: <slrneqnph3.764.tadmc@tadmc30.august.net>
Boris Skoblo <borsk@technion.ac.il> wrote:
> please help me convert following VBscript code to Perl code
^^^^^^^
[snip VB code ]
> Can anyone help?
Sure! What part are you stuck on?
Can anyone write it for you? No, only some people can write it for you.
Will anyone write it for you? Probably not.
Show us the Perl code you have so far, we cannot "help" with your
Perl code if you do not show us your Perl code.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 15 Jan 2007 14:21:28 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: how to "see" DOS errorlevel codes?
Message-Id: <1168899686.142990.228250@38g2000cwa.googlegroups.com>
J. Gleixner wrote:
> 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
perldoc -f system
is what J means, I'm sure.
Paul Lalli
------------------------------
Date: Mon, 15 Jan 2007 23:35:26 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: how to "see" DOS errorlevel codes?
Message-Id: <eoh347.168.1@news.isolution.nl>
J. Gleixner schreef:
> Rossman123:
>> 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
ITYM: perldoc -f system
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Mon, 15 Jan 2007 19:06:03 +0000
From: Henry Law <news@lawshouse.org>
Subject: Re: How to create a binary file from a perl pgm
Message-Id: <1168887957.21549.1@proxy02.news.clara.net>
ranrodrig wrote:
> I've already search about how to this
I don't think you have, really. Try this
http://www.google.com/search?q=compile+perl
--
Henry Law Manchester, England
------------------------------
Date: 15 Jan 2007 12:33:55 -0800
From: "ranrodrig" <ranrodrig@gmail.com>
Subject: Re: How to create a binary file from a perl pgm
Message-Id: <1168893235.124048.68470@11g2000cwr.googlegroups.com>
Henry, You are rigth I was dumb enough as not looking for the compile
word.
Thanks a lot for your quick answer John.
Henry Law ha escrito:
> ranrodrig wrote:
>
> > I've already search about how to this
>
> I don't think you have, really. Try this
>
> http://www.google.com/search?q=compile+perl
>
>
> --
>
> Henry Law Manchester, England
------------------------------
Date: 15 Jan 2007 21:05:14 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: How to create a binary file from a perl pgm
Message-Id: <Xns98B99979EAEDDcastleamber@130.133.1.4>
"ranrodrig" <ranrodrig@gmail.com> wrote:
> Henry,
If you don't top post you don't need to address Henry, because that
happens automatically when you quote. If you don't know what top posting
means, Google for it. Or look at how I reply, it's not that hard.
> You are rigth I was dumb enough as not looking for the compile
> word.
>
> Thanks a lot for your quick answer John.
I guessed you wanted to create binary files from Perl. As for compile, as
far as I know there are no good working compilers for Perl. There are
programs that pack perl.exe and everything your program needs in a binary
for distribution. Have a look at PAR.
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 15 Jan 2007 14:33:47 -0800
From: "Googy" <cooldudevamsee@gmail.com>
Subject: How to insert or append new items into a perl hash ?
Message-Id: <1168900427.027366.191460@11g2000cwr.googlegroups.com>
Hi,
I can't able to find answers for this basic question, I googled and did
everything possible to find an answer,
There are methods to delete and find the existence of an item in the
hash but not for inserting or appending a new item into perl hash.
Suggestions required.
------------------------------
Date: 15 Jan 2007 22:45:14 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: How to insert or append new items into a perl hash ?
Message-Id: <Xns98B9AA6DCA1B9castleamber@130.133.1.4>
"Googy" <cooldudevamsee@gmail.com> wrote:
>
> Hi,
>
> I can't able to find answers for this basic question, I googled and did
> everything possible to find an answer,
> There are methods to delete and find the existence of an item in the
> hash but not for inserting or appending a new item into perl hash.
my %hash;
$hash{ foo } = 'new item';
$hash{ bar } = 'another new item';
I just inserted two items.
If you want to "append", I guess you mean something like:
$hash{ bar } = ...
$hash{ bar } = ....
in that case the value of the hash needs to be something you can store
more values in than one.
You might want to read the following documentation that comes with perl
(if you don't know how to access it, type perldoc perldoc):
perlreftut
perldsc
perllol
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 15 Jan 2007 14:52:35 -0800
From: "Googy" <cooldudevamsee@gmail.com>
Subject: Re: How to insert or append new items into a perl hash ?
Message-Id: <1168901554.420966.14300@m58g2000cwm.googlegroups.com>
John Bokma wrote:
> "Googy" <cooldudevamsee@gmail.com> wrote:
>
> >
> > Hi,
> >
> > I can't able to find answers for this basic question, I googled and did
> > everything possible to find an answer,
> > There are methods to delete and find the existence of an item in the
> > hash but not for inserting or appending a new item into perl hash.
>
> my %hash;
>
> $hash{ foo } = 'new item';
> $hash{ bar } = 'another new item';
>
> I just inserted two items.
>
> If you want to "append", I guess you mean something like:
>
> $hash{ bar } = ...
> $hash{ bar } = ....
>
> in that case the value of the hash needs to be something you can store
> more values in than one.
>
> You might want to read the following documentation that comes with perl
> (if you don't know how to access it, type perldoc perldoc):
>
> perlreftut
> perldsc
> perllol
>
>
> --
> John Experienced Perl programmer: http://castleamber.com/
>
> Perl help, tutorials, and examples: http://johnbokma.com/perl/
But when I return this hash form a subroutine, its not maintaining its
structure. Why ?
------------------------------
Date: Mon, 15 Jan 2007 22:50:52 +0000
From: Henry Law <news@lawshouse.org>
Subject: Re: How to insert or append new items into a perl hash ?
Message-Id: <1168901445.11952.0@proxy02.news.clara.net>
Googy wrote:
> Hi,
>
> I can't able to find answers for this basic question, I googled and did
> everything possible to find an answer,
> There are methods to delete and find the existence of an item in the
> hash but not for inserting or appending a new item into perl hash.
It's in the part of the Perl documentation called "perldata"; you get
there by issuing perldoc perldata on a command line, or going to
the relevant part of the HTML documentation.
I looked on your behalf, though, and found it not particularly easy to
find the information you want, so here's a quick tutorial. There's more
to it than this (the really good Perl people in this group will be able
to tell you more).
To insert a new item into a hash just give it a value:
$myhash{"newkey"} = "newvalue";
$anotherhash{$the_new_key} = $some_other_variable;
If you already have one of those items in the hash then you'll
over-write it, so you may need to add "... unless exists
$myhash{newkey}" or whatever.
Note the dollar sign, not a "%": a single element of a hash is a scalar.
Maybe you knew that already but it is confusing if you don't.
"Append" has no meaning; hashes are not ordered. (And if you iterate
over them they won't come out in the order you expect, or any other
given order either).
--
Henry Law Manchester, England
------------------------------
Date: 15 Jan 2007 14:59:36 -0800
From: vamsee.2005@gmail.com
Subject: Re: How to insert or append new items into a perl hash ?
Message-Id: <1168901976.846008.145200@51g2000cwl.googlegroups.com>
Henry Law wrote:
> Googy wrote:
> > Hi,
> >
> > I can't able to find answers for this basic question, I googled and did
> > everything possible to find an answer,
> > There are methods to delete and find the existence of an item in the
> > hash but not for inserting or appending a new item into perl hash.
>
> It's in the part of the Perl documentation called "perldata"; you get
> there by issuing perldoc perldata on a command line, or going to
> the relevant part of the HTML documentation.
>
> I looked on your behalf, though, and found it not particularly easy to
> find the information you want, so here's a quick tutorial. There's more
> to it than this (the really good Perl people in this group will be able
> to tell you more).
>
> To insert a new item into a hash just give it a value:
>
> $myhash{"newkey"} = "newvalue";
> $anotherhash{$the_new_key} = $some_other_variable;
>
> If you already have one of those items in the hash then you'll
> over-write it, so you may need to add "... unless exists
> $myhash{newkey}" or whatever.
>
> Note the dollar sign, not a "%": a single element of a hash is a scalar.
> Maybe you knew that already but it is confusing if you don't.
>
> "Append" has no meaning; hashes are not ordered. (And if you iterate
> over them they won't come out in the order you expect, or any other
> given order either).
>
> --
>
> Henry Law Manchester, England
Sorry for my previous dump reply.
------------------------------
Date: 15 Jan 2007 12:52:23 -0800
From: krivenok.dmitry@gmail.com
Subject: My program dies.
Message-Id: <1168894342.779544.305480@v45g2000cwv.googlegroups.com>
Hello All!
Look at the following pseudo-code:
...
...
while(1)
{
while( $client = $server->accept )
{
next if fork;
# Child code here
print "New client\n";
# Arbitrary perl code (work with Oracle via DBI, logging,
request processing, etc)
exit;
}
}
...
...
As you can see this is a part of TCP server.
My server dies after some time :(
I see message about Oracle critical error in my log (this is the last
message).
It's very strange because all work with Oracle is performed in _child_
process!
I can't understand how can parent process die!
It may happen only if accept dies, since parent process calls only
accept and fork
in its main loop.
Any ideas?
------------------------------
Date: Mon, 15 Jan 2007 15:25:32 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Parsing some input - easy to explain but lengthy to code - suggestions?
Message-Id: <slrneqnsac.7fq.tadmc@tadmc30.august.net>
doolittle <spam.meplease@ntlworld.com> wrote:
> 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
It is bad netiquette to quote .sigs.
> 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.
A modifier means "something out the ordinary here!".
That causes a pause when reading the code, to go figure out what
is different...
... only to discover that nothing was different.
You "trick" yourself into spending more time on the code than
is necesary.
That is bad for maintenance.
You should only "use" modifiers when you "make use" of the modifications
that they trigger.
> Incidentally, I grok grok as 'understand partially or
> (in)sufficiently',
You do not grok grok.
> but if grok means 'understand deeply' (as a little
> delving suggests) do I grok grok anymore?
You didn't grok grok, but now you do grok grok.
> Guess thats one of those
> things you either know or you don't.
It is one of those things the you either grok or you don't.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 15 Jan 2007 14:26:14 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl free e-books
Message-Id: <slrneqnor6.764.tadmc@tadmc30.august.net>
Michele Dondi <bik.mido@tiscalinet.it> wrote:
> 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...
<aol>
Me too!
Message-Id: <slrnd8fql2.aso.tadmc@magna.augustmail.com>
</aol>
But they must have gone to rehab, because I moved the scoring
back to only -1000 some time ago.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 15 Jan 2007 13:24:13 -0800
From: vamsee.2005@gmail.com
Subject: Problem with XMLin data structure.
Message-Id: <1168896251.985134.194860@l53g2000cwa.googlegroups.com>
<response status="sucess">
<value type="hash">
<item key="asdfas" value="hello"/>
<item key="adfa" value="hi"/>
</value>
</response>
XMLin is producing following below data structure from the above xml.
$VAR1 = {
'value' => {
'item' => {
'adfa' => {
'value' => 'hi'
},
'asdfas' => {
'value' => 'hello'
}
},
'type' => 'hash'
},
'status' => 'sucess'
};
What to do inorder to XMLin to force create the below datastructure.
$VAR1 = {
'value' => {
'item' => [
{ 'key' =>'adfa'
'value' => 'hi'
},
{ 'key'=> 'asdfas'
'value' => 'hello'
}
],
'type' => 'hash'
},
'status' => 'sucess'
};
Thanks, waiting for reply.
------------------------------
Date: 15 Jan 2007 21:58:52 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Problem with XMLin data structure.
Message-Id: <Xns98B9A2918BC7castleamber@130.133.1.4>
vamsee.2005@gmail.com wrote:
> <response status="sucess">
> <value type="hash">
> <item key="asdfas" value="hello"/>
> <item key="adfa" value="hi"/>
> </value>
> </response>
>
> XMLin is producing following below data structure from the above xml.
[..]
> What to do inorder to XMLin to force create the below datastructure.
Name the module you use instead of a method of this module. Not everybody
is aware that it's part of XML::Simple.
As for your question, did you ever read the documentation of the module
you're using? I guess not, or not well enough. You probably copied the
example and thought that it was all.
Search for "folding" in the documentation of XML::Simple.
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 15 Jan 2007 14:13:56 -0800
From: vamsee.2005@gmail.com
Subject: Re: Problem with XMLin data structure.
Message-Id: <1168899235.972892.196710@38g2000cwa.googlegroups.com>
John Bokma wrote:
> vamsee.2005@gmail.com wrote:
>
> > <response status="sucess">
> > <value type="hash">
> > <item key="asdfas" value="hello"/>
> > <item key="adfa" value="hi"/>
> > </value>
> > </response>
> >
> > XMLin is producing following below data structure from the above xml.
>
> [..]
>
> > What to do inorder to XMLin to force create the below datastructure.
>
> Name the module you use instead of a method of this module. Not everybody
> is aware that it's part of XML::Simple.
>
> As for your question, did you ever read the documentation of the module
> you're using? I guess not, or not well enough. You probably copied the
> example and thought that it was all.
>
> Search for "folding" in the documentation of XML::Simple.
>
>
> --
> John Experienced Perl programmer: http://castleamber.com/
>
> Perl help, tutorials, and examples: http://johnbokma.com/perl/
Thanks for your reply, I didn't copied it, I am new to perl. I am
working on a php based web services kinda like RPC, Where as at client
side I am using perl script with AUTOLOADER, which will emulate missing
methods and post that info in the form of xml to php web service and
get the returned value in the form of xml and parse it and return it in
desired data structure to the calling sub routine.
I also have xml snippet
<response status="success">
<value type="array">
<item value="hello"/>
<item value="hi hi"/>
</value>
</response>
for this XMLin in XML::Simple giving the following data structure
$VAR1 = {
'value' => {
'item' => [
{
'value' => 'hello'
},
{
'value' => 'hi hi'
}
],
'type' => 'array'
},
'status' => 'sucess'
};
So I was curious about the differences, Now i know the problem, thanks
for replying.
------------------------------
Date: 15 Jan 2007 16:33:20 -0600
From: Lawrence Statton XE2/N1GAK <yankeeinexile@gmail.com>
Subject: Re: Runs Fine In Perl :: Not As Cron Job
Message-Id: <87y7o36hu7.fsf@gmail.com>
"Bucker" <beauchamp.jim@gmail.com> writes:
> 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.
>
> 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?
Because unzip cannot create any files in "/" which is where it is trying.
Try successfully changing directories before running unzip.
--
Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.
------------------------------
Date: 15 Jan 2007 14:19:24 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Runs Fine In Perl :: Not As Cron Job
Message-Id: <1168899561.784141.318260@v45g2000cwv.googlegroups.com>
Bucker wrote:
> 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/");
This is a no-op. It does absolutley nothing worth mentioning. It
creates a shell process, changes directory, and exits the shell. That
change of directory has no impact on anything else. Please see also
"perldoc -q 'changed directory''"
> 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?
You pretty clearly do not have a Perl problem. Your Perl program works
just fine. You have a cron problem. The most common cron problem is
that the cron script runs with different permissions and/or different
users and/or different environment variables than the logged-in user.
Have you checked any or all of these?
Have you checked the return value of the system() call from within your
Perl script?
Have you checked the value of $! to see if there was an operating
system error?
Paul Lalli
------------------------------
Date: 15 Jan 2007 19:26:03 -0000
From: Art Merkel <art@example.com>
Subject: substituting words and maintaining case?
Message-Id: <ZGI3QAYC39097.5597569444@anonymous.poster>
I'd appreciate any suggestions for writing a function for substituting
words in a string but keeping the case the same, so for example,
starting with
Cats are furry. I like cats. Do you like CATS?
and the substitution cats -> kittens I'd like to get
Kittens are furry. I like kittens. Do you like KITTENS?
the way the Emacs replace command works.
thanks
------------------------------
Date: Mon, 15 Jan 2007 21:14:33 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: substituting words and maintaining case?
Message-Id: <Z8Sqh.152061$YV4.120177@edtnps89>
Art Merkel wrote:
> I'd appreciate any suggestions for writing a function for substituting
> words in a string but keeping the case the same, so for example,
> starting with
>
> Cats are furry. I like cats. Do you like CATS?
>
> and the substitution cats -> kittens I'd like to get
>
> Kittens are furry. I like kittens. Do you like KITTENS?
perldoc -q "How do I substitute case insensitively on the LHS while preserving
case on the RHS"
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: Mon, 15 Jan 2007 16:45:56 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: substituting words and maintaining case?
Message-Id: <slrneqo114.7fq.tadmc@tadmc30.august.net>
Art Merkel <art@example.com> wrote:
> I'd appreciate any suggestions for writing a function for substituting
> words in a string but keeping the case the same, so for example,
> starting with
>
> Cats are furry. I like cats. Do you like CATS?
>
> and the substitution cats -> kittens I'd like to get
>
> Kittens are furry. I like kittens. Do you like KITTENS?
>
> the way the Emacs replace command works.
----------------------------
#!/usr/bin/perl
use warnings;
use strict;
$_ = "Cats are furry. I like cats. Do you like CATS?\n";
case_replace($_, 'caTS', 'kiTTens');
print;
sub case_replace {
my(undef, $pat, $rep) = map lc, @_;
$_[0] =~ s/\b($pat)\b/$rep/g;
s/(.)/\u$1/ for $pat, $rep;
$_[0] =~ s/\b($pat)\b/$rep/g;
s/(.+)/\U$1/ for $pat, $rep;
$_[0] =~ s/\b($pat)\b/$rep/g;
}
----------------------------
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 15 Jan 2007 13:58:23 -0800
From: fatwallet961@yahoo.com
Subject: the => operator
Message-Id: <l7unq2h7kj8flbbk01juqhcegnpaubmcg1@4ax.com>
in the following code
what's => means?
is it an operator in perl?
any document on this opeartor?
my $xml = get (ItemPriceSearch_url());
my $xp = XML::XPath->new(xml => $xml);
thanks
------------------------------
Date: 15 Jan 2007 22:05:36 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: the => operator
Message-Id: <slrneqnula.o8.abigail@alexandra.abigail.be>
fatwallet961@yahoo.com (fatwallet961@yahoo.com) wrote on MMMMDCCCLXXXV
September MCMXCIII in <URL:news:l7unq2h7kj8flbbk01juqhcegnpaubmcg1@4ax.com>:
-- in the following code
--
-- what's => means?
It's a comma which quotes a bareword on its left hand side.
-- is it an operator in perl?
Yes.
-- any document on this opeartor?
Of course. In the same document that documents all the other
operators: perlop.
Abigail
--
#!/opt/perl/bin/perl -w
$\ = $"; $; = $$; END {$: and print $:} $SIG {TERM} = sub {$ := $_}; kill 15 =>
fork and ($; == getppid and exit or wait) foreach qw /Just another Perl Hacker/
------------------------------
Date: Mon, 15 Jan 2007 15:18:33 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: variables in substitution
Message-Id: <slrneqnrt9.764.tadmc@tadmc30.august.net>
Wim <nelis@nlr.nl> 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/ ] ) ;
[ 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 ) ;
$a=~ s/$$_[0]/$$_[1]/ee foreach ( @NameMap ) ;
> printf "$a\n" ;
> }
> How
> can one take both substitute parameters from an array and use local
> variables $1 at the same time?
By realizing that the 2nd part of an s/// is a string, and then
checking the Perl FAQ:
perldoc -q string
How can I expand variables in text strings?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 33
*************************************