Re: Safely updating a file

2011-11-23 Thread tshtatland
On Nov 22, 4:27 pm, carni...@gmail.com (Mark Wagner) wrote: I want to update a status file, similar to this: open OUTFILE, , status.txt; print OUTFILE $last_date\n; close OUTFILE; However, if something goes wrong (e.g. the disk is full), this code will replace status.txt with an empty

string into a unique index

2011-11-23 Thread Arvind
I have to write a perl script that keeps track of tcp connections. I plan to keep track of this in an array of the form tcp_connection[source address][dest address] To do this I want to convert an IP address of the form A.B.C.D into a number that will serve as an index of the array. I want to

Re: string into a unique index

2011-11-23 Thread Petite Abeille
On Nov 23, 2011, at 4:24 AM, Arvind wrote: To do this I want to convert an IP address of the form A.B.C.D into a number that will serve as an index of the array. Well, IP4 addresses can simply be represented as a decimal. So, 127.0.0.1 is 2130706433. Example on how to calculate it:

Re: Safely updating a file

2011-11-23 Thread Uri Guttman
On 11/22/2011 06:33 PM, tshtatland wrote: Have you considered appending? he seems to want a single timestamp in the file. appending would add one timestamp for each call. how would this do what the OP wanted? and File::Slurp has an append_file sub which also makes appending much easier

Re: string into a unique index

2011-11-23 Thread Uri Guttman
On 11/22/2011 10:24 PM, Arvind wrote: I have to write a perl script that keeps track of tcp connections. I plan to keep track of this in an array of the form tcp_connection[source address][dest address] To do this I want to convert an IP address of the form A.B.C.D into a number that will

Re: Safely updating a file

2011-11-23 Thread Mark Wagner
On Tue, Nov 22, 2011 at 15:33, tshtatland tshtatl...@gmail.com wrote: On Nov 22, 4:27 pm, carni...@gmail.com (Mark Wagner) wrote: I want to update a status file, similar to this: open OUTFILE, , status.txt; print OUTFILE $last_date\n; close OUTFILE; However, if something goes wrong (e.g.

Re: Safely updating a file

2011-11-23 Thread Shawn H Corey
On 11-11-23 03:31 PM, Mark Wagner wrote: That would work, but it would introduce the need to periodically prune the file, and would make reading the file much more complicated: if the disk fills up, the final line could well be a fractional timestamp, so I'd need to verify that what I'd just

Re: using WWW::Mechanize why am i getting this proxy issue?

2011-11-23 Thread Rajeev Prasad
In my WWW:Mechanize script below, can someone please advice why am i getting proxy issue. when the same proxy is working fine with LWP::UserAgent in a different script. (both scripts are given below) thank you. Rajeev From: Rajeev Prasad rp.ne...@yahoo.com

Re: string into a unique index

2011-11-23 Thread John W. Krahn
Petite Abeille wrote: On Nov 23, 2011, at 4:24 AM, Arvind wrote: To do this I want to convert an IP address of the form A.B.C.D into a number that will serve as an index of the array. Well, IP4 addresses can simply be represented as a decimal. So, 127.0.0.1 is 2130706433. Or as a four

Re: string into a unique index

2011-11-23 Thread shawn wilson
On Nov 23, 2011 4:50 AM, Arvind arvind@gmail.com wrote: I have to write a perl script that keeps track of tcp connections. I plan to keep track of this in an array of the form tcp_connection[source address][dest address] I would just use a db for this if not only for the audit trail. I

Re: Chromatics - Why is funding Perl So Hard

2011-11-23 Thread Randal L. Schwartz
Octavian == Octavian Rasnita orasn...@gmail.com writes: Octavian It would be nice to have a Perl with strict and warnings Octavian enabled by default that could be disabled on request This way Octavian the maintained old projects could be easily modified to Octavian continue to work but the

Re: Chromatics - Why is funding Perl So Hard

2011-11-23 Thread Octavian Rasnita
From: Randal L. Schwartz mer...@stonehenge.com Octavian == Octavian Rasnita orasn...@gmail.com writes: Octavian It would be nice to have a Perl with strict and warnings Octavian enabled by default that could be disabled on request This way Octavian the maintained old projects could be easily