On Fri, Aug 17, 2012 at 1:29 PM, Dominik Danter <domi...@foop.at> wrote:
> Wow, that was fast; thank you!
> I did define it - here is the code that produced the output:

> #!/usr/bin/env perl
>
> use Rex::Commands::Iptables;

Oh, well, that wasn't in the snippet. 'task' is actually in Rex, not
Rex::Commands::Iptables - looking at the Rex samples
http://search.cpan.org/~jfried/Rex-0.31.5/lib/Rex.pm

You need to include Rex too, along w/ the specific commands module you
want to use

 use Rex;
 use Rex::Commands::Run;
 use Rex::Commands::Fs;

 Rex::connect(
    server      => "remotehost",
    user        => "root",
    password    => "f00b4r",
    private_key => "/path/to/private/key/file",
    public_key  => "/path/to/public/key/file",
 );

 if(is_file("/foo/bar")) {
    print "Do something...\n";
 }

 my $output = run("upime");


So try starting the test script w/.:
use Rex;
use Rex::Commands::Iptables;

-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to