This file contains hidden or 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
| curl -L http://www.frexx.de/xterm-256-notes/data/256colors2.pl | perl |
This file contains hidden or 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/env perl | |
| use strict; | |
| use warnings; | |
| my $struct = { | |
| bb => [qw(gg hh jj)], | |
| }; | |
| if (@{$struct->{bb1}}) {print "works"} | |
| for (@{$struct->{bb1}}) {print} |
This file contains hidden or 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 Mojolicious::Lite; | |
| any '/' => sub { | |
| my $self = shift; | |
| my $name = $self->param("name"); | |
| #cookie with value | |
| $self->cookie(baz => 'bar'); | |
This file contains hidden or 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/env perl | |
| use strict; | |
| use warnings; | |
| use Benchmark qw/cmpthese/; | |
| sub hash { | |
| my $self = shift; | |
| my %params = @_; | |
| return; |
This file contains hidden or 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/env perl | |
| use AnyEvent; | |
| if (open my $fh, "|-", "tailf -n 10 ./file") { | |
| 1; | |
| } else { | |
| my $cv = AnyEvent->condvar; | |
| my $body; | |
| my $handle; $handle = AnyEvent::Handle->new( |
This file contains hidden or 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/env perl | |
| use common::sense; | |
| use Data::Dumper; | |
| use MojoX::Run; | |
| use Mojolicious; | |
| say $Mojolicious::VERSION; | |
| my $sub = sub { | |
| return "hello", "world"; |
This file contains hidden or 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
| my $count = scalar keys %$all; | |
| my (@shas, $i); | |
| for my $disk (keys %$all) { | |
| my $part = $all->{$disk}->{partition}; | |
| my $pid = $run->spawn( | |
| cmd => sub { | |
| # my @shas = | |
| # map {/^([0-9a-f]+)/} | |
| # qx(find $dest/$part -type f | grep -Fv "lost+found" | sort | xargs shasum) | |
| # ; |
This file contains hidden or 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/env perl | |
| use common::sense; | |
| use lib qw(./lib); | |
| use MojoX::Run; | |
| use Data::Dumper; | |
| my $run = MojoX::Run->new; | |
| my $all = { sda => 11, sdb => 22, sdc => 11, sdd => 22, sde => 11, sdf => 22, sdg => 33 }; |
This file contains hidden or 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
| [sugar@comp mojoxrun]$ PERL5LIB="lib" prove | |
| t/00-load.t ................. 1/1 # Testing MojoX::Run 0.15, Perl 5.012004, /usr/bin/perl5.12.4 | |
| t/00-load.t ................. ok | |
| t/boilerplate.t ............. ok | |
| t/manifest.t ................ skipped: Author tests not required for installation | |
| t/mojox-run-complexsub.t .... [Wed Oct 5 00:17:45 2011] [debug] Not installig any signal handler, because IOWatcher implementation Mojo::IOWatcher::EV implements better CHLD signal handling. | |
| t/mojox-run-complexsub.t .... 1/5 Write failed: Can't call method "_connecting" on an undefined value at /usr/local/share/perl/5.12/Mojo/IOLoop/Client.pm line 129. | |
| t/mojox-run-complexsub.t .... 2/5 Write failed: Can't call method "_connecting" on an undefined value at /usr/local/share/perl/5.12/Mojo/IOLoop/Client.pm line 129. | |
| t/mojox-run-complexsub.t .... ok | |
| t/mojox-run-long-running.t .. [Wed Oct 5 00:17:46 2011] [debug] Not installig any signal handler, because IOWatcher implementation Mojo::IOWatcher::EV implements better CHLD |
This file contains hidden or 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/env perl | |
| use Mojolicious::Lite; | |
| # create file for testing | |
| my $file = "yet_another_file"; | |
| qx(touch $file; echo "hello" > $file); | |
| any '/' => sub { | |
| my $self = shift; |