Re: Windoze Woez

2009-12-12 Thread Erez Schatz
2009/12/12 Philip Potter : > 2009/12/12 Shawn H Corey : >> Alan Haggai Alavi wrote: >>> Hi, >>> >>> Windows requires you to use double quotes in place of single quotes. Saving >>> to >>> a file and executing it is the only way that is cross-platform, I suppose. >> >> Doesn't Windows respond to her

Re: being smart about script structure

2009-12-12 Thread Robert Wohlfarth
On Fri, Dec 11, 2009 at 12:06 PM, Philip Potter wrote: > The point is that in the first version, you are constantly bouncing > from the big-picture ideas to the low-level messy details. By > abstracting code out into subroutines populate_x(), populate_y() and > process_xy(), you have the main scri

Re: $Sql{mydata} fails?

2009-12-12 Thread Jim Gibson
On 12/12/09 Sat Dec 12, 2009 12:26 PM, "Grant" scribbled: > I have a perl script which creates a PDF file from data in a table. > This morning I was making some modifications to it, and it stopped > working with a "Couldn't get mydata handle" error. I restored the > original file, but it still

$Sql{mydata} fails?

2009-12-12 Thread Grant
I have a perl script which creates a PDF file from data in a table. This morning I was making some modifications to it, and it stopped working with a "Couldn't get mydata handle" error. I restored the original file, but it still fails with that error, even after rebooting the machine. Here is the

Re: Closing all filehandles associated with a filedescriptor...

2009-12-12 Thread James Olin Oden
> The forked process could exec itself to close fd's higher > than $^F (ordinarily 2) for the initial leak. But I suspect > there's no easy way to close fd's more selectively. > Yeah I had thought about the exec(), but being its a library I would have no idea what to exec...they could tell me but

Re: Windoze Woez

2009-12-12 Thread Philip Potter
2009/12/12 Shawn H Corey : > Alan Haggai Alavi wrote: >> Hi, >> >> Windows requires you to use double quotes in place of single quotes. Saving >> to >> a file and executing it is the only way that is cross-platform, I suppose. > > Doesn't Windows respond to here redirects? > > perl <> print "Hello

Re: Windoze Woez

2009-12-12 Thread Shawn H Corey
Alan Haggai Alavi wrote: > Hi, > > Windows requires you to use double quotes in place of single quotes. Saving > to > a file and executing it is the only way that is cross-platform, I suppose. Doesn't Windows respond to here redirects? perl < print "Hello world\n"; > EOD -- Just my 0.00

Re: Closing all filehandles associated with a filedescriptor...

2009-12-12 Thread C.DeRykus
On Dec 11, 3:10 pm, james.o...@gmail.com (James Olin Oden) wrote: > On Fri, Dec 11, 2009 at 4:36 PM, Shawn H Corey wrote: > > > James Olin Oden wrote: > >> Hi All, > > >> This is really not a beginner question but I'm not sure what list to post > >> it on. > > >> I've created a daemon library for

Re: Windoze Woez

2009-12-12 Thread Alan Haggai Alavi
Hi, Windows requires you to use double quotes in place of single quotes. Saving to a file and executing it is the only way that is cross-platform, I suppose. Regards, Alan Haggai Alavi. -- The difference makes the difference. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For addit

DBD::mysql::st execute failed: MySQL server has gone away

2009-12-12 Thread Ryan Chan
Hello, Sometimes, my sql is running for a quite long time, e.g. 1 hour The perl script will warn "DBD::mysql::st execute failed: MySQL server has gone away at ..." and my script failed. I have already set the auto reconnect, e.g. $dbh->{mysql_auto_reconnect} = 1; But problem still occur, any

RE: being smart about script structure

2009-12-12 Thread Wagner, David --- Senior Programmer Analyst --- CFS
> -Original Message- > From: Bryan R Harris [mailto:bryan_r_har...@raytheon.com] > Sent: Friday, December 11, 2009 15:10 > To: Beginners Perl > Subject: Re: being smart about script structure > > > > > >> Seems like a waste to do step 2 in a subroutine since we > only do it once, > >>

Re: assign operator

2009-12-12 Thread Dr.Ruud
Irfan Sayed wrote: Can somebody please tell me what is the difference between "=" and ":=" sign in case of perl?? I still prefer Data::Alias; ;) -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Eval scoping question

2009-12-12 Thread Dr.Ruud
C.DeRykus wrote: Dr.Ruud: C.DeRykus: eval { asub() }; die $@ if $@; You need to test the return of eval itself to be sure. Example: perl -wle ' die "An error: ", $@ || "whoopy" if !eval{ asub(); 1 }; sub asub{ my $x = bless {}, "main"; 1 / 0 } sub DESTROY{ $@ =

Re: pid file issues...? HUH???

2009-12-12 Thread cerr
On Dec 10, 11:31 pm, jimsgib...@gmail.com (Jim Gibson) wrote: > At 11:43 AM -0800 12/9/09, cerr wrote: > > > > >Hi There, > > >I use below code to make sure i have only one instance of my script > >running at a time. But weirdly enough i sometimes seem to have running > >two instances. This script

Re: pid file issues...? HUH???

2009-12-12 Thread cerr
Since I can't really rely on a fix time run time basis, this doesn't make too much sense either, Instead of that i thought i'd rather execute a littler bash script from the crontab that's like: #!/bin/bash if [ -e /var/run/myPIDfile ] then echo "script still running"; else execute my perl scri

Re: Windoze Woez

2009-12-12 Thread Parag Kalra
VOV...I was not knowing this...Thanks There is so much still left to learn in Perl. :) Cheers, Parag On Sat, Dec 12, 2009 at 3:20 AM, John W. Krahn wrote: > Parag Kalra wrote: > >> >> On Sat, Dec 12, 2009 at 1:55 AM, John W. Krahn wrote: >> >> Parag Kalra wrote: >>> >>> This works on L

Re: Windoze Woez

2009-12-12 Thread John W. Krahn
Parag Kalra wrote: On Sat, Dec 12, 2009 at 1:55 AM, John W. Krahn wrote: Parag Kalra wrote: This works on Linux - perl -e 'foreach (Sugar,Sex,Simplicity,Sleep,Success,Smoking) { print "I am only addicted to - 'Shekels' \n" if ($_ =~ /^s.*/i) }' This works on Windoze - perl -e "foreach (Su

Re: Windoze Woez

2009-12-12 Thread Philip Potter
2009/12/12 Parag Kalra : > How is it going to new line without a new line character - '\n'. If I am not > wrong - 'q/ /' signifies quoted context thus - a replacement for double > quotes but still you should need a new line character to go to next line. q// is single quotes, qq// is double quotes.

Re: Windoze Woez

2009-12-12 Thread Parag Kalra
Thanks Philip for the wonderful explanation. And thanks John, your code worked like a breeze both on Windoze & *Nix :) And good thing is it provided the solution to insert a new-line character which was not present in my Windoze code. One question though in following code - >>perl -le "/^s/i &&

Re: Perl script to Diff 2 Excel sheets

2009-12-12 Thread Shlomi Fish
Hi Parag! On Saturday 12 Dec 2009 07:05:02 Parag Kalra wrote: > Hello All, > > I am planning to write a small Perl script to diff 2 excel sheets > (workbooks) using the module - Spreadsheet::ParseExcel. > > I am planning to implement following algorithm. > > What we can do is to pick up a works

Re: Windoze Woez

2009-12-12 Thread Owen
> 2009/12/12 Parag Kalra : > > > In the end though, I fail to see the utility of writing one-liners > which execute on both linux and windows. I may never have been on linux if that had been the case. Back in Perl 4 days, I had W3.1, and read c.l.p.m. All the big guns in those days had one lin

Re: Windoze Woez

2009-12-12 Thread John W. Krahn
Parag Kalra wrote: Hello All, Hello, This works on Linux - perl -e 'foreach (Sugar,Sex,Simplicity,Sleep,Success,Smoking) { print "I am only addicted to - 'Shekels' \n" if ($_ =~ /^s.*/i) }' This works on Windoze - perl -e "foreach (Sugar,Sex,Simplicity,Sleep,Success,Smoking) { print 'I am on

Re: Windoze Woez

2009-12-12 Thread Philip Potter
2009/12/12 Parag Kalra : > Hello All, > > This works on Linux - > perl -e 'foreach (Sugar,Sex,Simplicity,Sleep,Success,Smoking) { print "I am > only addicted to - 'Shekels' \n" if ($_ =~ /^s.*/i) }' > > This works on Windoze - perl -e "foreach (Sugar,Sex,Simplicity,Sleep,Success,Smoking) { print '

Re: being smart about script structure

2009-12-12 Thread Philip Potter
2009/12/11 Bryan R Harris : >>> Seems like a waste to do step 2 in a subroutine since we only do it once, >>> but it does fill the main body of the script with code-noise that makes it >>> harder to debug overall logic problems...  Not much logic here, but >>> certainly in more complex scripts. >>