using Net::SSH::Expect within a thread fails

2008-10-21 Thread Andy Greenwood
Hello, I'm having problems with the following code. It is supposed to get a list of IP addresses from the IAD module and then create a few threads to each log into those devices and make changes in the config. The only device that is allowed to access the devices I'm configuring is the 'manage.exa

Re: help me die verbosely

2008-01-18 Thread Andy Greenwood
Chas. Owens wrote: On Jan 17, 2008 9:54 AM, Jonathan Mast <[EMAIL PROTECTED]> wrote: I want to write the errors caught by a 'die' clause into a file. snip Try #!/usr/bin/perl use strict; use warnings; $SIG{__DIE__} = sub { open my $fh, ">>", "something.log" or die @_, "c

Re: "premature end of header" script error

2007-11-29 Thread Andy Greenwood
Ankur wrote: Hi, I am receiving the following error : "Premature end of script headers" when running my CGI script using a web browser. Instead if I execute the script manually at the shell, it executes successfully. Actually, the script needs to fetch a lot of data from the database. When

Re: Comparing Regular Expression in Perl vs Python

2007-11-29 Thread Andy Greenwood
Michael Gale wrote: Hey, I have done some scripts in python, I found it easy to use and quick. I found I could recreate some apps faster in python however I found that the regular expression usage in python does not match perl's. I agree, regexp usage in python is quite clunky compared t

Re: AFAIK

2007-09-25 Thread Andy Greenwood
Somu wrote: What does it mean? AFAIK? I have seeing it a lot.. Earlier i've been seeing the HTH, and a guess gave the answer.. But this one, AFAIK... Are there any more such short forms? As far as I know Hope that helps! http://www.ucandoit.org.uk/knowledgebase/webacronyms.html -- To unsu

Re: library (random numberS)

2007-07-27 Thread Andy Greenwood
On 7/27/07, yitzle <[EMAIL PROTECTED]> wrote: > I was under the impression that "average" meant mean. correct. Average is the common term for mean. In fact, reading the pages linked above, they do imply (without stating explicitly) that the three terms describe different calculations. I can't thi

Re: Unable to store the output of a command

2007-05-18 Thread Andy Greenwood
On 5/18/07, divya <[EMAIL PROTECTED]> wrote: Hi, I want to store the output of following command: "vcover merge outfile in1 in2" I tried : 1) @result = `vcover merge outfile in1 in2`; 2) system("vcover merge outfile in1 in2 > @result"); I can see some error displays on the screen. But these ar

Re: pass variable to another program

2007-05-17 Thread Andy Greenwood
On 5/17/07, Brian Volk <[EMAIL PROTECTED]> wrote: Hello, Is there a way to pass a variable from one program to another? I have a web site that allows the user to set the time they would like to download a file... The program uses the Linux "at" command and launches another perl program that d

Re: Bandwidth Generated

2007-04-13 Thread Andy Greenwood
On 4/13/07, oryann9 <[EMAIL PROTECTED]> wrote: > > It works fine with 5.8.8 on my Fedora Core 5: > > $ perl -e 'for ("","abc\n","def","hij\n"){print; > warn tell STDOUT,"\n"}' > 0 > abc > 4 > 7 > defhij > 11 > $ > Does not seem to be accurate on this platform??? $ uname -a CYGWIN_NT-5.1 dubmds

Re: cannot determine peer address with Unix domain sockets

2007-03-23 Thread Andy Greenwood
On 3/23/07, John W. Krahn <[EMAIL PROTECTED]> wrote: Andy Greenwood wrote: > On 3/22/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: >> On 3/22/07, Andy Greenwood <[EMAIL PROTECTED]> wrote: >> >> > $Select = new IO::Select(); >> >> Is $Se

Re: cannot determine peer address with Unix domain sockets

2007-03-23 Thread Andy Greenwood
On 3/22/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: On 3/22/07, Andy Greenwood <[EMAIL PROTECTED]> wrote: > $Select = new IO::Select(); Is $Select a global variable? Is that why it's got a capital letter? I suspect that you're not coding under the rules of '

Re: cannot determine peer address with Unix domain sockets

2007-03-22 Thread Andy Greenwood
On 3/22/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: On 3/22/07, Andy Greenwood <[EMAIL PROTECTED]> wrote: > I am getting the following error whenever I try to send data to a unix > domain socket. PHP sends the command just fine, but perl dies as soon > as it reads from the s

cannot determine peer address with Unix domain sockets

2007-03-22 Thread Andy Greenwood
I am getting the following error whenever I try to send data to a unix domain socket. PHP sends the command just fine, but perl dies as soon as it reads from the socket. send: Cannot determine peer address at myscript.pl line 1256 I found the following page which discusses a fix for this on Open

Re: unix date for perl time calculation

2007-03-21 Thread Andy Greenwood
On 3/21/07, Kevin Viel <[EMAIL PROTECTED]> wrote: I want to determine the amount of time one of my scripts and figured collecting the beginning and ending date might suffice, if I could feed it to, say, perl for the calculation: d0=`date` d1=`date` perl -e $d1 - $d0 > log Is this worth ex

Re: confusion with splitting columns using [-n, -n] (e.g; my ( $country, $bytes ) = ( split )[ -2, -1 ])

2007-01-30 Thread Andy Greenwood
On 1/30/07, Michael Alipio <[EMAIL PROTECTED]> wrote: Hi, I have a file that look like this: 1668 | 172.194.177.182 | US12679172 10396 | 64.237.148.157 | PR 12679172 9318 | 211.187.212.242 | KR1279172 22291 | 66.215.254.186 | US 1269172 22291 |

Re: Net::BitTorrent::File problems

2007-01-12 Thread Andy Greenwood
Never mind. I got it straightened out. I just had to ... my $pieces = $info->{'pieces'}; $pieces =~ s/(.)/sprintf("%02x",ord($1))/egs; ... On 1/11/07, Andy Greenwood <[EMAIL PROTECTED]> wrote: I'm trying to extract the SHA1 hashes out of a .torrent file using

Net::BitTorrent::File problems

2007-01-11 Thread Andy Greenwood
I'm trying to extract the SHA1 hashes out of a .torrent file using Net::BitTorrent::File, among other information, but can't seem to figure out how to get them. I keep getting binary data, not the ascii hash. Can anyone tell me what I'm doing wrong here? #!/usr/bin/perl use strict; use warnings;

Re: Hi,, Regarding perl modules

2007-01-10 Thread Andy Greenwood
On 10 Jan 2007 09:21:55 -, Vikas Kumar Choudhary <[EMAIL PROTECTED]> wrote: Hi I am vikas here, just getting in perl.. can anybody told me to create modules and how to use these in our scripts.. $ perldoc perlmod should get you started. To use modules you've created, just put this at the

Re: subroutine call makes foreach exit?

2006-11-16 Thread Andy Greenwood
On 11/16/06, Jay Savage <[EMAIL PROTECTED]> wrote: On 11/16/06, Andy Greenwood <[EMAIL PROTECTED]> wrote: > I'm writing a script for work that will dig for DNS records for a > given domain name and put the entries into an array. At the end of the > digging, it outputs

subroutine call makes foreach exit?

2006-11-16 Thread Andy Greenwood
I'm writing a script for work that will dig for DNS records for a given domain name and put the entries into an array. At the end of the digging, it outputs the array elements to the screen, asks if everything looks good, and if so, writes them out to the shell and builds a zone file. However, I'v

foreach question

2006-10-31 Thread Andy Greenwood
I have a reference to an annonymous array, which I am looping through with foreach(@$servref) { if ( checkServer($_, $dn) ) { push(@$goodservref, $_); } else { # server wasn't good. Add another item to the list push(@$servref, newitem);

Re: Analize Java source file with perl?

2006-10-26 Thread Andy Greenwood
I'm sure there's a better way to do this, but it really isn't too hard. -start--- #!/usr/bin/perl use warnings; use strict; my $file = shift || die "Please provide a java file to check.\n"; my @lines = `cat $file`; foreach

Re: Bad scoping? Bad prototyping?

2006-10-09 Thread Andy Greenwood
On 10/9/06, Helliwell, Kim <[EMAIL PROTECTED]> wrote: The following test script fails to compile, complaining that there are not enough arguments in the call to sub2. #!/bin/perl sub1("Hello, "); sub1("world\n"); Are you sure you want sub1 prototyped twice? sub sub2($str) { pr

Re: Where to change @INC in perl

2006-10-04 Thread Andy Greenwood
How did you install the module? you should be able to just # cd /usr/ports/databases/p5-DBI/ && make install clean and it'll work like a charm. That's all I did. For modules that exist in the ports tree, I find that installing them this way is cleaner than perl -MCPAN -e "install foo::bar" becau

socket question

2006-09-29 Thread Andy Greenwood
I'm having some trouble with my perl script which uses IO::Select and IO::Socket to multiplex incoming connections as described here http://www.perlfect.com/articles/select.shtml Now, I am able to connect to the script using telnet, but when I try to connect to it with my php script which will b

Re: perl scalar

2006-09-20 Thread Andy Greenwood
if you use strict; then you'll need to declare it with my. If you don't (and you should think about that decision again) then you can leave off the my. my $variable = somevalue; $ means it's a scalar variable @ is for arrays % is for hashes On 9/20/06, elite elite <[EMAIL PROTECTED]> wrote:

Re: Extract digits from string

2006-09-08 Thread Andy Greenwood
start with the regex. It's going to look in $data for items that match and return the elements caught by the ()'s into @array. the regex will catch anything that: 1) starts with a ( 2) is made up of at least 1 digit character 3) ends with a ) On 9/8/06, J. Alejandro Noli <[EMAIL PROTECTED]> wro

accessing an array of hashes from another namespace

2006-08-21 Thread Andy Greenwood
I have a program which I am working on which has several different packages. One of these packages, FluxDB.pm, creates an array of hashes called @users. Each element is a hash containing (among other things) username and uid (primary key from the DB this is generated out of). In another package,