Re: [OT] Can't redirect before fork().

2006-06-30 Thread Mumia W.
dzhuo wrote: open files are attributes of a process. after you fork, you have 2 processes, files locks, open handles, as well as pending signals and such are not shared. ie, when you print to STDOUT in child, it's not the same STDOUT you expect in parent. why not use a pipe? #!/usr/bin/perl u

Re: [OT] Can't redirect before fork().

2006-06-30 Thread Mumia W.
Mumia W. wrote: I can't seem to redirect STDOUT to a file before forking in my perl program. [...] Forgive me for sending this three times. I was dealing with MUA braindamage. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: "Misses" in a loop

2006-06-30 Thread Tom Phoenix
On 6/30/06, Jean-Charles Ripault <[EMAIL PROTECTED]> wrote: I fork all the network "clients" and they all individually log their results in a global log file opened before the fork. It looks as if your code has no protection against two clients writing simultaneously to the global log file. Ch

Re: [OT] Can't redirect before fork().

2006-06-30 Thread Tom Phoenix
On 6/30/06, Mumia W. <[EMAIL PROTECTED]> wrote: In the parent, I want to redirect STDOUT to 'logfile' then fork. In the child, I want to print something. That something should end up in the log file, but it's not working. my $child = fork(); exit ($child ? parent() : child() ); It's good to

Re: Stingy matching

2006-06-30 Thread Rob Dixon
Filip Jursik wrote: Hi, this $text = "first first second third"; $text =~ /(first.*?third)/; print $1; gives me "first first second third" as a result instead of expected "first second third" What am I doing wrong? I've expected the .*? to limit the wildcard only to the string " second ".

Re: Stingy matching

2006-06-30 Thread John W. Krahn
Filip Jursik wrote: > Hi, Hello, > this > > $text = "first first second third"; > $text =~ /(first.*?third)/; > print $1; > > gives me > > "first first second third" > > as a result instead of expected > > "first second third" > > What am I doing wrong? I've expected the .*? to limit the wi

Re: Stingy matching

2006-06-30 Thread Mr. Shawn H. Corey
On Fri, 2006-30-06 at 23:04 +0200, Filip Jursik wrote: > Hi, > > this > > $text = "first first second third"; > $text =~ /(first.*?third)/; > print $1; > > gives me > > "first first second third" > > as a result instead of expected > > "first second third" > > What am I doing wrong? I've exp

Re: Stingy matching

2006-06-30 Thread Joshua Colson
On Fri, 2006-06-30 at 23:04 +0200, Filip Jursik wrote: > Hi, > > this > > $text = "first first second third"; > $text =~ /(first.*?third)/; > print $1; > > gives me > > "first first second third" > > as a result instead of expected > > "first second third" > > What am I doing wrong? I've exp

Stingy matching

2006-06-30 Thread Filip Jursik
Hi, this $text = "first first second third"; $text =~ /(first.*?third)/; print $1; gives me "first first second third" as a result instead of expected "first second third" What am I doing wrong? I've expected the .*? to limit the wildcard only to the string " second ". Thanx, F. -- To

Re: regexp pattern matching

2006-06-30 Thread M. Kristall
Mr. Shawn H. Corey wrote: m/The satchel contains the following items? \((\d+)\): (.*)/ my $count_of_items = $1; my $item_list = $2; And don't forget to check if it matched (otherwise you have the old $1 and $2): if (m/The satchel contains the following items? \((\d+)\): (.*)/) {

[OT] Can't redirect before fork().

2006-06-30 Thread Mumia W.
I can't seem to redirect STDOUT to a file before forking in my perl program. In the parent, I want to redirect STDOUT to 'logfile' then fork. In the child, I want to print something. That something should end up in the log file, but it's not working. Here is my code: use strict; use warnings; u

Re: Perl Binary to Perl Code

2006-06-30 Thread JupiterHost.Net
I BioKid wrote: Dear All, I have a dozen perl and perl-cgi program that converted in to binary files. Is there any code / prggram available to get the source code out of it ? The answer is still the same as last week when you asked this :) It depends how the binary was made and if that syst

Re: Perl Binary to Perl Code

2006-06-30 Thread JupiterHost.Net
I BioKid wrote: Dear All, I have a dozen perl and perl-cgi program that converted in to binary files. Is there any code / prggram available to get the source code out of it ? Why do you keep posting this email, is your client in a loop or something? -- To unsubscribe, e-mail: [EMAIL PROTECT

Re: perlcc executable to perl code ?

2006-06-30 Thread JupiterHost.Net
I BioKid wrote: Dear All, One quick question: Is ther any way to get the source code out of a perlcc executable ? same as any other compiled C code. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: renaming files

2006-06-30 Thread Rob Dixon
Adriano Allora wrote: hi to all, does exists a way to rename automatically files? I mean: I've got directories with this content: EN0.tmp EN1.tmp EN2.tmp EN3.tmp EN4.tmp ... IT0.tmp IT1.tmp IT2.tmp IT3.tmp IT4.tmp ... Now, some couples of files were deleted (you can imagine the EN1.tmp/IT1.t

Re: How to Post/How to Respond (WAS: A string & a list)

2006-06-30 Thread Mr. Shawn H. Corey
On Fri, 2006-30-06 at 18:52 +0100, Rob Dixon wrote: > Well maybe Randal's right, but I reckon homework counts as a Perl beginner's > problem, it's just that the form of the response should have less of a 'lets > get > this thing going' slant. How to Respond: Whether this is homework or not is

Re: renaming files

2006-06-30 Thread Dr.Ruud
"Mr. Shawn H. Corey" schreef: > Adriano Allora: >> does exists a way to rename automatically files? > > No. > > See: > perldoc -f rename > perldoc -f glob > perldoc File::Find > perldoc File::Copy (and search for "move") And of course: IO::All. http://search.cpan.org/search?module=IO::All

Re: Crypt::GPG won't decrypt file...rewrote it to use system, but only partially works

2006-06-30 Thread Mumia W.
RICHARD FERNANDEZ wrote: [...] It decrypts my file successfully. But if I break up the arguments like it says in the doco, like so: my @gpg_command = ("/usr/bin/gpg", "--decrypt", $encrypted, ">", $decrypted, "2> /dev/null"); AFAIK, you can't use "2> file" to do output redirection when

Re: A string & a list

2006-06-30 Thread Rob Dixon
(Randal L. Schwartz) wrote: "Monomachus" == "Monomachus" <[EMAIL PROTECTED]> writes: Monomachus> A problem in Perl Monomachus> You have a string & a list And it looks like a homework problem. Monomachus> And one more thing could u show me variants without using RegEx Especially with that.

Re: A string & a list

2006-06-30 Thread Rob Dixon
Monomachus wrote: A problem in Perl You have a string & a list For ex.: $s = "ADbDCdBabc"; @N=("A","D","C") You should exclude those elements from the string : first by 1 element, after that by 2 & by 3 ... (If @N would have 5 elements and by 4 and by 5([$#N+1] elements)), and creating a new

Perl Binary to Perl Code

2006-06-30 Thread I BioKid
Dear All, I have a dozen perl and perl-cgi program that converted in to binary files. Is there any code / prggram available to get the source code out of it ? This is my out put when am giving file command $ file alignscr.p alignscr.p: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for

perlcc executable to perl code ?

2006-06-30 Thread I BioKid
Dear All, One quick question: Is ther any way to get the source code out of a perlcc executable ? thanks a bunch to all, ibiokid !!!

Re: A string & a list

2006-06-30 Thread Randal L. Schwartz
> "Monomachus" == "Monomachus" <[EMAIL PROTECTED]> writes: Monomachus> A problem in Perl Monomachus> You have a string & a list And it looks like a homework problem. Monomachus> And one more thing could u show me variants without using RegEx Especially with that. PLEASE DON'T ASK OR ANSW

Re: using MS Excel generated .xml files

2006-06-30 Thread Mr. Shawn H. Corey
On Fri, 2006-30-06 at 17:07 +0100, Gary Stainburn wrote: > Hi folks > > I'm just about to look into writing a perl prog to read in an excel > spreadsheet and us that to populate a SQL database. > > The idea is to save the spreadsheet as a .xml file (using Office XP), use a > perl module to read

RE: Crypt::GPG won't decrypt file...rewrote it to use system, but only partially works

2006-06-30 Thread RICHARD FERNANDEZ
> I would suggest giving GnuPG::Interface a go because it > handled calling out to 'gpg' most "correctly". Meaning it > uses the status-fd, logger-fd options properly which is the > preferred way to call gpg in an automated fashion. > > Good luck, > > http://danconia.org > Thank you! I will

Re: Crypt::GPG won't decrypt file...rewrote it to use system, but only partially works

2006-06-30 Thread Wiggins d'Anconia
RICHARD FERNANDEZ wrote: > I re-wrote the decryption routine to use system instead of Crypt::GPG, > and came across another puzzle: > > my @gpg_command = ("/usr/bin/gpg --decrypt $encrypted > > $decrypted 2> /dev/null"); > system(@gpg_command) == 0 or warn "system @gpg_command failed:

using MS Excel generated .xml files

2006-06-30 Thread Gary Stainburn
Hi folks I'm just about to look into writing a perl prog to read in an excel spreadsheet and us that to populate a SQL database. The idea is to save the spreadsheet as a .xml file (using Office XP), use a perl module to read in the file, and using the parsed data update the database. Would an

RE: renaming files

2006-06-30 Thread Jeff Peng
Hello. Instead of `mv..` system call,you could use perl's inner function 'rename()' to do the things you wanted. Also use 'File::Find' to do the searching for files. From: Adriano Allora <[EMAIL PROTECTED]> To: beginners@perl.org Subject: renaming files Date: Fri, 30 Jun 2006 16:48:09 +0200

Re: "Misses" in a loop

2006-06-30 Thread Mumia W.
Mumia W. unfortunately, wrote: The "&" in the 'system' command allows of asynchronous [...] s/allows of/allows for/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Crypt::GPG won't decrypt file...rewrote it to use system, but only partially works

2006-06-30 Thread RICHARD FERNANDEZ
I re-wrote the decryption routine to use system instead of Crypt::GPG, and came across another puzzle: my @gpg_command = ("/usr/bin/gpg --decrypt $encrypted > $decrypted 2> /dev/null"); system(@gpg_command) == 0 or warn "system @gpg_command failed: $!"; works. It decrypts my file

Re: "Misses" in a loop

2006-06-30 Thread Mumia W.
Jean-Charles Ripault wrote: Hi all, For a customer project I'm writing a "firewall proof" script. This script, between two systems tries systematically all tcp ports (up to a given parameter) of all target network. Now, I've made a double loop (one for the IP addresses, one for the ports) to

Re: renaming files

2006-06-30 Thread Mr. Shawn H. Corey
On Fri, 2006-30-06 at 16:48 +0200, Adriano Allora wrote: > hi to all, > > does exists a way to rename automatically files? No. See: perldoc -f rename perldoc -f glob perldoc File::Find perldoc File::Copy (and search for "move") -- __END__ Just my 0.0002 million dollars worth, -

renaming files

2006-06-30 Thread Adriano Allora
hi to all, does exists a way to rename automatically files? I mean: I've got directories with this content: EN0.tmp EN1.tmp EN2.tmp EN3.tmp EN4.tmp ... IT0.tmp IT1.tmp IT2.tmp IT3.tmp IT4.tmp ... Now, some couples of files were deleted (you can imagine the EN1.tmp/IT1.tmp) but I need no holes

RE: Removing print statements from cgi script

2006-06-30 Thread Charles K. Clarkson
Mike Martin wrote: : Does anyone know if its possible to remove data printed from a : web-page created from cgi.pm depnding on the effect of a : sub-routine. Not from the server. It may be possible to do this with javascript or with AJAX. Search Google for details on AJAX. : : ie: : : I pr

Removing print statements from cgi script

2006-06-30 Thread Mike Martin
Does anyone know if its possible to remove data printed from a web-page created from cgi.pm depnding on the effect of a sub-routine. ie: I print the header and a selection form which then runs a sub - is it posible to replace the contents without loading a new web-page Thanks -- To unsubscribe

Re: A string & a list

2006-06-30 Thread Mr. Shawn H. Corey
On Fri, 2006-30-06 at 12:59 +, Monomachus wrote: > And one more thing could u show me variants without using RegEx See `perldoc -f index` -- __END__ Just my 0.0002 million dollars worth, --- Shawn "For the things we have to learn before we can do them, we learn by doing them." Ar

A string & a list

2006-06-30 Thread Monomachus
A problem in Perl You have a string & a list For ex.: $s = "ADbDCdBabc"; @N=("A","D","C") You should exclude those elements from the string : first by 1 element, after that by 2 & by 3 ... (If @N would have 5 elements and by 4 and by 5([$#N+1] elements)), and creating a new list: by 1: DbDCdB

perlcc executable to perl code ?

2006-06-30 Thread I BioKid
Dear All, One quick question: Is ther any way to get the source code out of a perlcc executable ? thanks a bunch to all, ibiokid !!!

Re: CGI Script to pass a file to different servers

2006-06-30 Thread I BioKid
Hi all - I woder why am always having some trivial problems to solve ??? I can explain what am lloking for in detail. Say, We have 3 inhouse web servers and 2 remote web servers. All of this web server accept same type of files as input : say foo.txt (these file contain some data and the 5 web se

"Misses" in a loop

2006-06-30 Thread Jean-Charles Ripault
Hi all, For a customer project I'm writing a "firewall proof" script. This script, between two systems tries systematically all tcp ports (up to a given parameter) of all target network. Now, I've made a double loop (one for the IP addresses, one for the ports) to browse this). For speed reas

Perl Binary to Perl Code

2006-06-30 Thread I BioKid
Dear All, I have a dozen perl and perl-cgi program that converted in to binary files. Is there any code / prggram available to get the source code out of it ? This is my out put when am giving file command $ file alignscr.p alignscr.p: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for

Re: Detecting line terminators in a CSV file

2006-06-30 Thread John W. Krahn
Daniel Kasak wrote: > John W. Krahn wrote: >> >>Are you sure that you want to "fix" this? > > Certain. I need to find the correct line terminator, and then tell MySQL > what it is. > >>perldoc -f binmode > > binmode is what I was after - thanks :) Then don't forget to use the correct characte