I am trying to get this working in a mason environment (RT to be specific).
I have tried as much as I know and have failed so far. I will be passing in
the '$pingserver' from a web form and can do this easily enough with
<%args>$pingserver</%args> and it works. In the code you see below the 'my
$pingserver' is only defined for CLI testing purposes and will be removed in
the mason version.

THE CODE:

#!/usr/bin/perl
use strict;
use warnings;
use Net::SSH qw(sshopen2);
my $pingserver='172.16.33.61';
my $command = "ping -c1 $pingserver\;exit";
sshopen2('[EMAIL PROTECTED]', *READER, *WRITER, $command) ||die
"UNABLE TO ESTABLISH CONNECTION!: $!";
print "Ping Results:\n<p><b>\n";
while (<READER>){
push @testData, $_;
}
foreach my $sshdata (@testData){
        print "$sshdata";
}
print "</b>\n";
close(READER);
close(WRITER);


In the CLI, this works fine and returns the result I am expecting. In this
case:


Ping Results:
<p><b>
PING 172.16.33.61 (172.16.33.61) 56(84) bytes of data.
64 bytes from 172.16.33.61: icmp_seq=1 ttl=62 time=18.7 ms

--- 172.16.33.61 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 18.765/18.765/18.765/0.000 ms
</b>

Unfortunately for me, when I attempt to do it within mason by means of a
simple <%perl> block, all I see on the returned web page is:   

"Ping Results:
<p><b>

</b>"

I am guessing that this has something to do with the way that the data is
being returned from the remote machine, but since I am a perl newb, AND a
mason newb, I am at this time, completely perplexed as to how I might go
about implementing this in my mason environment.

I have tried running the script as both root, and as my webserver user and
it works fine under both users, so I'm lost.  Any help would be greatly
appreciated.

Thanks in advance,

Greg Evans
Hood Canal Communications
(360) 898-2481 ext.212 



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to