Permalink
Browse files

rover extension

  • Loading branch information...
1 parent ccc5ed6 commit 2c78aefb97e819956bb665b04056763f8df1b242 @h4ck3rm1k3 committed Aug 15, 2012
Showing with 36 additions and 0 deletions.
  1. +2 −0 lib/Rover.pm
  2. +26 −0 lib/Rover/CoreExtension.pm
  3. +8 −0 t/example2.t
View
@@ -85,6 +85,8 @@ sub new {
clear($self);
register_module($self, "Rover::Core");
+ register_module($self, "Rover::CoreExtension");
@h4ck3rm1k3

h4ck3rm1k3 Aug 20, 2012

Owner

you need to register the module to use it.

+
return bless $self, $class;
}
View
@@ -0,0 +1,26 @@
+package Rover::CoreExtension;
+use Exporter;
+use Rover;
+use Rover::Core;
+
+@Pager::ISA = qw( Exporter );
+@Pager::EXPORT = qw( put_file_from_home );
+
+BEGIN {
+ Rover::register_module("Rover::CoreExtension");
+}
+
+sub put_file_from_home {
+# Put a local file onto the remote server
+#
+ my ($self, $host, $args) = @_;
+ my ($local_file,$remote_file) = split(",",$args.",");
+ my $home = $ENV{HOME};
+ warn "Local was $local_file and home was $home";
+ $local_file =~ s/^\$\{HOME\}/${home}/ ;
+ $local_file =~ s/^~\//${home}\// ;
+ warn "Local now $local_file";
+ Rover::Core::put_file($self,$host,join(",",$local_file,$remote_file)); # send to original
+
+ return($result);
+}
View
@@ -0,0 +1,8 @@
+
+use Rover::CoreExtension;
+use Rover::Core;
+use Rover::Host;
+my $host = new Rover::Host("localhost", "Linux", "mdupont","test");
+my $r = new Rover;
+Rover::CoreExtension::put_file_from_home ( $r, $host, "~/find2.sh", "/tmp/");
+Rover::CoreExtension::put_file_from_home ( $r, $host, "\$\{HOME\}/find3.sh", "/tmp/");

0 comments on commit 2c78aef

Please sign in to comment.