Skip to content

Instantly share code, notes, and snippets.

@anazawa
anazawa / gist:2791286
Created May 25, 2012 23:53
tie() interface
tie my %header => 'Blosxom::Header', # isa
as => 'ro', # or 'rw'
to => $blosxom::header; # HashRef
tie my %header => 'Blosxom::Header', (
as => 'ro',
to => $blosxom::header
);
package Blosxom::Plugin;
use strict;
use warnings;
sub config {}
sub response {
require Blosxom::Header:
Blosxom::Header->instance;
}
@anazawa
anazawa / gist:3151287
Created July 20, 2012 15:19
規則性があるようなないような -> ない
anazawa@mini ~% perl -MCGI -e 'print CGI::header({ -aaa => 1, -bbb => 2, -ccc => 3, -ddd => 4, -eee => 5, -fff => 6 })'
Eee: 5
Bbb: 2
Aaa: 1
Fff: 6
Ccc: 3
Ddd: 4
Content-Type: text/html; charset=ISO-8859-1
@anazawa
anazawa / gist:3346759
Created August 14, 2012 05:56
as_arrayref
# as_arrayref
package as_arrayref;
use strict;
use warnings;
use Blosxom::Header;
sub start { !$blosxom::static_entries }
sub last {
my $header = Blosxom::Header->instance:
@anazawa
anazawa / 01_MRO.rb
Created September 1, 2012 12:45
Ruby の include の挙動を調べる
module DiamondA
def hello
"DiamondA hello"
end
end
module DiamondB
include DiamondA
end
@anazawa
anazawa / gist:3847087
Created October 7, 2012 04:14
make Blosxom CGI::Emulate::PSGI-safe
package destroy;
use strict;
use warnings;
sub start { !$blosxom::static_entries }
sub end { undef $blosxom::output }
# plugins should have an instance
# sub start : Hook { ... }
@anazawa
anazawa / Changes.md
Created October 10, 2012 10:01
Sylpheed RSS Fetcher

0.03 Nov 16th, 2012

  • rename sylpheed_rss to sylfeed
  • [Config] add 'log_file' which defaults to "~/.sylpheed-2.0/sylfeed.log"
  • use Log::Handler

0.02 Oct 11th, 2012

  • [Config] rename 'dir' to 'folder'
@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 { [] },
@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 / 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';