Re-exec in perl

2016-10-03 Thread Unknown User
I am trying to re-exec my script after a delay. I expect that the code below would go on re-execing indefinitely, however that does not happen. It exits after one reexec. What should be done to make the code re-exec forever? $ cat exec.pl #!/usr/bin/perl -w use strict; alarm(5); $SIG{"ALRM"} =

Re: Script to fork, send data to parent via a tcp conn

2016-05-16 Thread Unknown User
ied >telnet 127.0 0.1 8989 > > Can you connect? > > On May 14, 2016, at 3:56 PM, Unknown User <knowsuperunkn...@gmail.com> > wrote: > >>I wrote this scrpt to fork off a few child processes, then the child >>processes process some data, and s

Script to fork, send data to parent via a tcp conn

2016-05-14 Thread Unknown User
I wrote this scrpt to fork off a few child processes, then the child processes process some data, and send the data back to the parent through a tcp socket. This is not working as i expected it would. Why not? How can it be corrected? #!/usr/bin/perl -w use strict; use IO::Socket::INET; print

Fire and forget subs

2015-07-06 Thread Unknown User
What is a good way to fire and forget a sub from a module in perl, in a non blocking mode, preferably without forking or using threads. I may have to run the sub a few times to determine the approx delay for it to run, so i suppose i need a blocking mode for it too. But afterwards, it can run in

Reading a libconfig config

2015-06-22 Thread Unknown User
I am using Conf::Libconfig to read a libconfig config file. - are there any better modules to read it? - If not, is it possible with Conf::Libconfig to print out all the entries in the config file in a JSON/YAML format? I dont see any option that will allow me to refer to more than one key at

curl support

2014-05-28 Thread Unknown User
I see a lot of modules for curl, like LWP::Curl, Net::Curl, WWW::Curl etc. I wonder which of these will most closely mimic the functions provided by the curl command? For example, this curl command: curl -o mysite.com.out -A Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101

Re: curl support

2014-05-28 Thread Unknown User
Well actually, it does not need to be a curl module. Anything that can provide the breakup of where the time is spent (curl time_connect, time_namelookup, time_starttransfer, speed_download and similar) is sufficient. ~Unknown On Wed, May 28, 2014 at 10:32 PM, Unknown User knowsuperunkn

Using a function in a variable

2013-11-09 Thread Unknown User
Hi, I have a variable that has a function in it, eg: my $newtime = time() + 30; How can i use it in code so that it always returns time() + 30 when it is called?

Sleep

2013-09-15 Thread Unknown User
If my perl script has a sleep for say 300 seconds, when the sleep is being run is there any way i can find the time remaining in the sleep say by sending a signal? Thanks,

comparing all the elements of an array

2013-09-15 Thread Unknown User
I have an array of numbers, and i want to find the percentage difference between all the elements. Say my @a = ($a,$b,$c); I need to calculate the percentage difference of element a with b, b with c and c with a. The 3 items above are an example, it can be hundreds of numbers. Is there an

Array iterator count

2013-08-08 Thread Unknown User
Hello, If i am iterating through the elements in an array, at any point is it possible to say which element i am handling without using a counter? Are there any builtins that i can use for it? ie foreach my $element (a..z) { ... if ( i am the 5th element ) { handle me special } }

parsing html

2013-08-08 Thread Unknown User
What would be the best module available for parsing html in your opinion? My intention is to parse html that contains a table of 5 columns and any number of rows, and have a hash ref like $html-{1}-{col1}=data11, $html-{1}-{col2}=data12 ... $html-{2}-{col1}=data21, $html-{2}-{col2}=data22 ... etc

Using alarm

2012-10-26 Thread Unknown User
I have code that goes something like this: my $start = time(); my $delay = 60; ... while (my $line = $fh) { my $err; ... ... my $timenow = time(); if ( $timenow - $start = $delay ) { $start = $t; dumpstats($err); $err = {};

Re: Using alarm

2012-10-26 Thread Unknown User
On Fri, Oct 26, 2012 at 8:16 PM, Unknown User knowsuperunkn...@gmail.com wrote: I have code that goes something like this: my $start = time(); my $delay = 60; ... while (my $line = $fh) { my $err; ... ... my $timenow = time(); if ( $timenow - $start = $delay

SVN::Client examples

2012-03-23 Thread Unknown User
I am writing a script that has to check out an svn location to a directory, perform some operations on the checked out files, present the user with a diff and commit it on an acknowledgement from the user. I used SVN::Client for this. I am able to check out the location, modify the files etc.

batching and threads

2011-03-12 Thread Unknown User
I am looking for a module that will enable easy batching with perl threads, somewhat like Parallel::ForkManager for forking in batches. Does anybody know of such a module? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org

perldiver

2010-07-24 Thread Unknown User
Anybody know where i can get perldiver from? The main site does not seem to be working. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: perldiver

2010-07-24 Thread Unknown User
Ah it is working now. On Sat, Jul 24, 2010 at 12:24 PM, Unknown User knowsuperunkn...@gmail.com wrote: Anybody know where i can get perldiver from? The main site does not seem to be working. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners

File::Find usage

2010-07-23 Thread Unknown User
I have this script to find out where a perl module is on my machine: [unkn...@knowme:~/bin]$ cat findmodule #!/usr/bin/perl -w use File::Find; use strict; if ($ENV{INC} ) { # INC=PATH1:PATH2 ./getmodule module1 module2 module3 ... for my $toadd (split(/:/,$ENV{INC}))

getopt::long

2010-07-06 Thread Unknown User
um, I am pretty sure getopt::long keeps all input data in a hash, does anybody know whether i can use that hash itself in my code, and if so, how? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

ipc::run

2010-07-06 Thread Unknown User
Hi all, I have written a script that uses ipc::run on an array, like this, based on a previous post here: m...@host101: cat ipc #!/usr/bin/perl -w use strict; use IPC::Run qw/run/; my (@hosts,@cmd,$task); @hosts = qw/localhost localhost host101/; foreach my $host (@hosts) { $task = sub

Getopt::Long

2010-06-17 Thread Unknown User
I have the following code: GetOptions( n|name=s = \$name, a|age=i = \$age, s|sex=s = \$sex, ) || die Bad options\n;; What i expected this code to do is to die if a bad option was given, say -s without an arguement, as in ./myprog -n name -s -a 20 However, it does not do

Fork ssh

2010-06-16 Thread Unknown User
Hi I wrote the following script to fork ssh processes with perl and Parallel::ForkManager: #!/usr/local/bin/perl -w use strict; my @cmd = @ARGV; use Parallel::ForkManager; my @nodes; open(NODE,list) || die !$\n; while(NODE) { chomp; push(@nodes,$_); } my $pm = new