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
#!perl | |
=pod | |
Original rc file is https://gist.github.com/3fb14d60757e29f8ef13. | |
ttakezawa++ | |
=cut | |
use strict; | |
use warnings; | |
use Term::ANSIColor; |
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
package A; | |
use strict; | |
use warnings; | |
package B; | |
use lib '.'; | |
use parent qw(C); | |
1; |
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 | |
# Usage: | |
# $ perl fork.pl 'ssh XXX@XXXX "some_heavy_command"' | |
use strict; | |
use warnings; | |
use Capture::Tiny; | |
my $cmd = shift || die 'no command.'; |
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 | |
# Usage: $ show-method.pl Module::Name::method | |
use strict; | |
use warnings; | |
use Sub::Inspector; | |
use Class::Load qw(load_class); | |
my ($module, $method) = shift =~ /^(.+)::(.+)$/ | |
or die "Usage:\n\tshow-method.pl Module::Name::method\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
#!/usr/bin/env perl | |
=head1 Examples | |
$ tail -f access_log | perl colorize.pl | |
$ plackup app.psgi 2>&1 | perl colorize.pl | |
=cut | |
use strict; |
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
package Plack::Middleware::Debug::StackTrace; | |
use strict; | |
use parent qw/Plack::Middleware::Debug::Base/; | |
use Devel::StackTrace; | |
use Data::Dump::Streamer; | |
our $VERSION = '0.01'; | |
our $StackTraceClass = "Devel::StackTrace"; | |
# Optional since it needs PadWalker | |
eval { |
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; | |
my $runner = Plack::Runner::WithoutDefaultMiddleware->new; | |
$runner->parse_options(@ARGV); | |
$runner->run; | |
package Plack::Runner::WithoutDefaultMiddleware; | |
use base 'Plack::Runner'; |
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
#!perl | |
# Usage: my @uniq_array = uniq_by { $_->{key} } @array; | |
use strict; | |
use warnings; | |
use List::Util q(first); | |
use List::MoreUtils qw(uniq); | |
sub uniq_by (&@) { | |
my ($code, @array) = @_; |
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; | |
my ($repo_url, $to) = @ARGV; | |
#my $repo_url = 'git://github.com/gmarik/vundle.git'; | |
$repo_url || exit; | |
$repo_url =~ s/^git/https/; | |
$repo_url .= '.git' unless $repo_url =~ /\.git$/; | |
use File::Basename qw(basename); |
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 Data::Dumper; | |
local $Data::Dumper::Indent = 1; | |
local $Data::Dumper::Terse = 1; | |
sub p ($) { print Dumper shift } | |
use Coro; | |
use Coro::LWP; | |
use Web::Query; |