X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FTak.pm;h=7258b73829809aba832a6e1ca68154a9ee2dc13e;hb=4a66f5286d8acbc7cf2b8aafcc9cebd474a30614;hp=92cc7dd8287876c5510940742614bbef89d8a251;hpb=51c8325b5e4c5b68d3f823df3f0f04d9f05ed6d9;p=scpubgit%2FTak.git diff --git a/lib/Tak.pm b/lib/Tak.pm index 92cc7dd..7258b73 100644 --- a/lib/Tak.pm +++ b/lib/Tak.pm @@ -3,17 +3,25 @@ package Tak; use Tak::Loop; use strictures 1; -our $VERSION = '0.001001'; # 0.1.1 +our $VERSION = '0.001003'; # 0.1.3 -our $loop; +our ($loop, $did_upgrade); sub loop { $loop ||= Tak::Loop->new } +sub loop_upgrade { + return if $did_upgrade; + require IO::Async::Loop; + my $new_loop = IO::Async::Loop->new; + $loop->pass_watches_to($new_loop) if $loop; + $loop = $new_loop; + $did_upgrade = 1; +} + sub loop_until { my ($class, $done) = @_; return if $done; - my $loop = $class->loop; - $loop->loop_once until $_[1]; + $class->loop->loop_once until $_[1]; } sub await_all { @@ -37,7 +45,7 @@ sub await_all { return; } -"for lexie"; +1; =head1 NAME @@ -73,8 +81,46 @@ then =head1 WHERE'S THE REST? -A drink leaked in my bag on the way back from LPW. You'll get more once I -get my laptop's drive into an enclosure and decant the slides. +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 @@ -86,7 +132,7 @@ None required yet. Maybe this module is perfect (hahahahaha ...). =head1 COPYRIGHT -Copyright (c) 2011 the strictures L and L +Copyright (c) 2011 the Tak L and L as listed above. =head1 LICENSE