This is how I do it for mason. Remember, I am a newb, and dunno jack yet ;):
It is probably the WAY wrong way to do it, but I honestly don't understand
mason enough yet to maybe do it a better way

<%args>
$pingserver
</%args>


<%perl>
use strict;
use warnings;
use Net::SSH qw(sshopen2);
#my $pingserver='172.16.33.61';
my $command = "ping -c1 $pingserver\;exit";
my @testData;
sshopen2('root@<my_ip>', *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 "\n</b>\n";
close(READER);
close(WRITER);
</%perl>


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

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of BenRifkah
Bergsten-Buret
Sent: Tuesday, May 13, 2008 10:13 AM
To: mason-users@lists.sourceforge.net
Subject: Re: [Mason] Script not returning result within the mason
environment

On Tue, May 13, 2008 at 9:55 AM, Greg Evans <[EMAIL PROTECTED]> wrote:

... snip ...


>  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.


Its not clear whether you're calling the stand alone script from
within your Mason component or whether you're pasting the contents of
the script into the mason component above.  Post the exact contents of
the Mason component so we can see which you're doing.

-- Ben

-------------------------------------------------------------------------
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


-------------------------------------------------------------------------
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