From: Mark Olliver Date: Fri, 24 Feb 2012 21:00:35 +0000 (+0000) Subject: added example on Tak Use X-Git-Tag: v0.001004~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4a66f5286d8acbc7cf2b8aafcc9cebd474a30614;p=scpubgit%2FTak.git added example on Tak Use --- diff --git a/Changes b/Changes index 04b7eb8..5b8625e 100644 --- a/Changes +++ b/Changes @@ -1,4 +1,5 @@ - fix Ssyshere to Shere after re-reading UUCP protocol docs + - Added example on use - pixie79 0.001003 - 2011-12-23 - fix mk-fat to not miss anything else diff --git a/lib/Tak.pm b/lib/Tak.pm index b77a770..7258b73 100644 --- a/lib/Tak.pm +++ b/lib/Tak.pm @@ -85,6 +85,43 @@ A drink leaked in my bag on the way back from LPW. My laptop is finally alive again though so I'll try and turn my slides into a vague attempt at documentation while I'm traveling to/from christmas things. +=head1 Example + +$ cat Takfile +package Tak::MyScript; + +use strict; +use warnings; + +use Tak::Takfile; +use Tak::ObjectClient; +use lib "./lib"; + +sub each_host { + my ($self, $remote) = @_; + + my $oc = Tak::ObjectClient->new(remote => $remote); + my $name = $oc->new_object('My::Hostname'); + print "Connected to hostname: " . $name . "\n"; + } + +1; + +----- + +$cat ./lib/My/Hostname +package My::Hostname; + +use Sys::Hostname; + +sub new { + my ($self) = @_; + my $name = hostname; + return $name; + } + +1; + =head1 AUTHOR mst - Matt S. Trout (cpan:MSTROUT)