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 strict; | |
use warnings; | |
use FindBin qw/$Bin/; | |
use lib "$Bin/../.."; | |
use POSIX qw/setsid/; | |
use File::Basename qw/basename/; | |
use AnyEvent; |
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/env perl | |
use Modern::Perl; | |
use Benchmark qw/cmpthese/; | |
my (@arr1, $arr_ref1, %hash1, $hash_ref1); | |
say "Read access: "; | |
my $x; | |
cmpthese(-2, { |
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/env perl | |
use Modern::Perl; | |
use Test::More; | |
use Test::Fatal qw/dies_ok/; | |
use Try::Tiny; | |
dies_ok { wrong_try_catch() } "First is dies"; | |
dies_ok { wrong_try_catch2() } "Second should die too"; |
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/env perl | |
use common::sense; | |
use AnyEvent; | |
use AnyEvent::XMPP::Client; | |
my $cv = AE::cv; | |
my $client = AnyEvent::XMPP::Client->new(debug => 1); | |
$client->add_account('[email protected]', 'password'); |
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/env perl | |
use Modern::Perl; | |
# launch: bin.pl <service_name> [memory_limit in %] | |
my $service_name = shift @ARGV; | |
my $mem_limit = @ARGV ? shift @ARGV : 20; | |
my $pid = get_pid($service_name); | |
my $mem_size = get_memory($pid); |
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/env perl | |
use common::sense; | |
my $module = $ARGV[0]; | |
$| = 1; | |
die "wrong module name: $module" if $module !~ /^[A-Za-z0-9:]+$/; | |
my @parts = split "::", $module; | |
$parts[$#parts] .= ".pm"; |
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 common::sense; | |
use AnyEvent::HTTP; | |
my $app = sub { | |
my $env = shift; | |
return sub { | |
my $respond = shift; | |
fetch_content(sub { |
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/env perl | |
use strict; | |
use warnings; | |
use DB::Local; | |
use AnyEvent::HTTP::Socks; | |
use constant CHECK_TIME => 15 * 60; | |
use constant TIMEOUT => 10; | |
use constant MAX_GETS => 60; |
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/env perl | |
use strict; | |
use warnings; | |
use 5.12.3; | |
use FindBin qw($Bin); | |
use lib "$Bin/../lib"; | |
use DB::Connect; | |
use HTML::Template; | |
use Plack::Request; |
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/env perl | |
use common::sense; | |
use AnyEvent::Filesys::Notify; | |
use AnyEvent; | |
my $src = "/my/proj/path/htdocs"; | |
my $dst = "/var/www/html"; | |
my $cv = AnyEvent->condvar; |
NewerOlder