Skip to content

Instantly share code, notes, and snippets.

@anazawa
anazawa / cgi_can.pl
Last active December 14, 2015 18:59
CGI->can
use strict;
use warnings;
use Benchmark 'cmpthese';
use CGI;
package Cat;
sub walk {}
package main;
@anazawa
anazawa / pitfall.pl
Created February 28, 2013 18:36
amazing behaviour of CGI::Header
use CGI::Header;
my $h = CGI::Header->new;
$h->expires('now');
warn $h->get('Expires'); # => "Thu, 28 Feb 2013 18:34:22 GMT"
sleep 5;
warn $h->get('Expires'); # => "Thu, 28 Feb 2013 18:34:27 GMT"
@anazawa
anazawa / content_type.rss
Last active December 12, 2015 03:08
Blosxom flavour: rss
application/rss+xml; charset=utf-8
@anazawa
anazawa / mp3_to_wav.pl
Last active December 11, 2015 23:08
『基本から学ぶフランス語』語研、音声教材のダウンロード http://www.goken-net.co.jp/audio/420/420_index.htm
curl -O "http://www.goken-net.co.jp/audio/audio_data/420-[001-115]-115.mp3"
1〜59 が disc 1、60~115 が disc 2 にあたる。
しかしながら、書籍に記載されているトラックとファイルの番号が対応していない。
@anazawa
anazawa / mt.pl
Created December 1, 2012 03:20
Blosxom plugin: mt
package mt;
use strict;
use warnings;
use parent 'Blosxom::Plugin';
use Text::MicroTemplate qw/encoded_string/;
__PACKAGE__->load_components( 'DataSection' );
sub start {
my $pkg = shift;
@anazawa
anazawa / gist:4134722
Created November 23, 2012 09:25
Blosxom::Plugin 0.03
package Blosxom::Plugin::DataSection;
use Blosxom::Plugin; # => imports init()
package Blosxom::Plugin;
sub import {
# exports init()
}
# Blosxom::Plugin::Web* will be removed
@anazawa
anazawa / conditional_get.pl
Created November 22, 2012 13:45
Blosxom plugin: conditional_get
package conditional_get;
use strict;
use warnings;
use CGI::Header;
our $VERSION = '0.02';
sub start { $ENV{REQUEST_METHOD} =~ /^GET|HEAD$/ }
sub last {
@anazawa
anazawa / js.pl
Created November 21, 2012 09:06
Blosxom plugin: json
package js;
use strict;
use warnings;
use parent 'Blosxom::Plugin::Web';
use Carp qw/croak/;
use Encode;
use HTTP::Date qw/time2isoz/;
our $VERSION = '0.01';
@anazawa
anazawa / PSGI.pm
Created November 8, 2012 20:10
Yet another implementation of CGI::PSGI::psgi_header()
package CGI::PSGI;
use strict;
use warnings;
use parent 'CGI';
use CGI::Util;
use CGI::Header;
sub psgi_header {
my ( $self, @args ) = @_;
@anazawa
anazawa / gist:4008041
Created November 3, 2012 17:32
last_modified plugin
package last_modified;
use strict;
use warnings;
use parent 'Blosxom::Plugin';
use CGI::Header;
use HTTP::Date;
use List::Util qw/max/;
__PACKAGE__->mk_accessors(
last_modified => sub { [] },