Skip to content

Instantly share code, notes, and snippets.

use strict;
use utf8;
use warnings;
use JSON;
use Mojolicious::Lite;
use Test::More;
use Test::Mojo;
app->log->level('error');
use strict;
use AnyEvent::Impl::Perl;
use AnyEvent;
use AnyEvent::HTTP;
use Plack::Handler::Twiggy;
use Test::TCP;
test_tcp(
client => sub {
my $port = shift;
use strict;
use warnings;
use AnyEvent;
use AnyEvent::IRC::Client;
use AnyEvent::HTTP;
use AnyEvent::Util qw(run_cmd);
use Data::Dumper;
use Encode;
use Encode::Guess qw(euc-jp shiftjis 7bit-jis);
use HTML::ContentExtractor;
use strict;
use Mojolicious::Lite;
get '/test1' => 'test1';
get '/test2' => 'test2';
app->start;
__DATA__
# env PLACK_STACKTRACE_LEXICALS=1 plackup -MPlack::App::WrapCGI -e 'Plack::App::WrapCGI->new(script => "crash.cgi")'
use UNIVERSAL::require;
sub main {
my $mod = 'Encode';
$mod->require;
print "Content-Type: text/plain\n\nok";
}
package Plack::Middleware::UpperCase;
use strict;
use warnings;
use parent qw(Plack::Middleware);
sub call {
my ($self, $env) = @_;
my $res = $self->app->($env);
#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket::INET;
main(@ARGV);
sub main {
my $port = shift || 5000;
// ==UserScript==
// @name TwitterAutoReloader
// @namespace http://hazisarashi.com/
// @description Twetterの差分更新を自動的に実行
// @include http://twitter.com/
// @include http://twitter.com/#/list/*
// @include http://twitter.com/#list/*
// @include http://twitter.com/#replies
// ==/UserScript==
@hidekiy
hidekiy / gist:261812
Created December 22, 2009 15:59
File::Tee
use File::Tee qw(tee);
open(my $log_fh, '>>', 'output.log');
tee(STDOUT, $log_fh);
tee(STDERR, $log_fh);
print STDERR "stderr\n";
print "stdout\n";
warn "warning";
system("echo system stdout");
@hidekiy
hidekiy / gist:261809
Created December 22, 2009 15:52
Danga::Socket::Callback
use strict;
use warnings;
use Danga::Socket::Callback;
use IO::Socket::INET;
my $LISTENING_PORT = shift || 17000;
my $sock_server = IO::Socket::INET->new(
Proto => 'tcp',
LocalPort => $LISTENING_PORT,