This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Demo; | |
sub omg is export { say "omgwtf!" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[sweeks@kweh ~]$ perl slasho.pl | |
Rate without with | |
without 1468429/s -- -4% | |
with 1536098/s 5% -- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use feature ':5.10'; | |
use strict; | |
sub act { | |
my $action = shift; | |
no strict 'refs'; | |
&{"Actions::$action"}(); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub use_skill { | |
my $id = gen_new_answer_id(); | |
$answers->{$id} = sub { | |
my ($response) = @_; | |
my $skill = choose($response->{skills}); | |
send('use_skill',$skill); | |
} | |
send('get', $id, 'skills'); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub use_skill { | |
my $id = gen_new_answer_id(); | |
$answers->{$id} = sub { | |
my ($response) = @_; | |
my $skill = choose($response->{skills}); | |
send('use_skill',$skill); | |
} | |
send('get', $id, 'skills'); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Store a map, minus all the players | |
Load a map in preference to reading from ascii | |
save the map on shutdown | |
Store regular and scheduled events in the map itself. Pull them out and schedule them after loading. | |
Add some commands to modify the map, see how it works out. | |
-------------------------------- | |
copy client.pl to admin.pl | |
abstract out common code | |
choose some reasonable commands | |
toggle between wall and open tile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use Coro::State; | |
use Test::More tests => 2; | |
my $input; | |
my $main = new Coro::State; | |
our $tests = new Coro::State sub { | |
our $tests; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.sub main :main | |
.local int redux | |
.local pmc cont | |
redux = 0 | |
print "calling test\n" | |
cont = test() | |
print "back from test\n" | |
if redux goto done | |
redux = 1 | |
print "calling cont\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[sweeks@kweh rakudo]$ ./perl6 | |
> multi bar (@a where [*,2,3]) { say "by jove" } | |
> multi bar (@a) { say "bad luck" } | |
> bar([1,1,1]) | |
bad luck | |
> bar([1,2,3]) | |
by jove |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATE=$(date +%F) | |
YESTERDAY=$(date -d yesterday +%F) | |
DIR=/mnt/backups/$DATE | |
PREVDIR=/mnt/backups/$YESTERDAY | |
mkdir -p $DIR | |
backup() { | |
rsync -a --link-dest=$PREVDIR$1 $1/ $DIR$1 | |
} | |
OlderNewer