This file contains hidden or 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
<?php | |
# 安全なウェブアプリケーションの作り方 P156のリファラチェックには若干の脆弱性あり | |
$http_referer ='http://example.jp/45/45-002ch.php'; | |
# もちろんこれはOK | |
if ( preg_match('#\Ahttp://example.jp/45/45-002ch.php#', $http_referer) ) { |
This file contains hidden or 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 5.12.0; | |
use Benchmark qw/cmpthese/; | |
say alloc_once_lval() eq alloc_each() ? 'ok' : 'ng'; | |
say alloc_once_replace() eq alloc_each() ? 'ok' : 'ng'; | |
sub alloc_once_lval { | |
my $str = ' ' x 50000; | |
my $pos = 0; | |
for ( 0..9999 ) { |
This file contains hidden or 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 Hoge::Model::MyModel; | |
use base 'Catalyst::Model::Factory'; | |
#use base 'Catalyst::Model::Factory::PerRequest'; | |
#use base 'Catalyst::Model::Adaptor'; | |
__PACKAGE__->config( class => 'Hoge::MyModel' ); | |
1; | |
This file contains hidden or 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 DBI; | |
use Data::Dumper; | |
my $dbh = DBI->connect( | |
"dbi:mysql:database=sandbox", | |
'', | |
'', | |
{AutoInactiveDestroy => 1, RaiseError => 1} | |
); |
This file contains hidden or 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
diff --git a/lib/DBIx/Skinny.pm b/lib/DBIx/Skinny.pm | |
index c974aea..954050b 100644 | |
--- a/lib/DBIx/Skinny.pm | |
+++ b/lib/DBIx/Skinny.pm | |
@@ -805,6 +805,12 @@ sub _close_sth { | |
undef $sth; | |
} | |
+sub DESTROY { | |
+ my $class = shift; |
This file contains hidden or 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 t::Utils; | |
use Mock::Basic; | |
use Test::More; | |
my $dbh = t::Utils->setup_dbh; | |
Mock::Basic->set_dbh($dbh); | |
Mock::Basic->setup_test_db; | |
Mock::Basic->do(q{ | |
create view mock_basic_view as select * from mock_basic |
This file contains hidden or 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 utf8; | |
use Test::More; | |
use Encode; | |
use Crypt::TripleDES; | |
my $plaintext = 'ぴーえすぴー2'; | |
my $passphrase = 'Next Generation Portable'; | |
my $des = new Crypt::TripleDES; | |
my $cyphertext = $des->encrypt3( Encode::encode('utf-8', $plaintext), $passphrase ); |
This file contains hidden or 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
sub add_where_simple { | |
my $self = shift; | |
my($term, @bind) = @_; | |
push @{ $self->{where} }, "($term)"; | |
push @{ $self->{bind} }, @bind; | |
} |
This file contains hidden or 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
Template---- | |
1-122 | |
2- | |
3-123 | |
Xslate/TTerse---- | |
Text::Xslate: Can't locate object method "moge" via package "Hash::MultiValue" at test.pl line 25. | |
(/home/chiba/tmp/tmpl/test.tt:1:&main[3]) at test.pl line 25 | |
eval {...} called at test.pl line 25 | |
---------------------------------------------------------------------------- | |
1-[% req.moge %] |
This file contains hidden or 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 benchmark/x-poor-env.pl | |
Perl/5.12.1 i686-linux | |
Text::Xslate/0.1056 | |
Template/2.22 | |
HTML::Template/2.9 | |
Text::MicroTemplate/0.15 | |
Text::MicroTemplate::Extended/0.11 | |
1..4 | |
ok 1 - TTerse: Text::Xslate::Syntax::TTerse | |
ok 2 - TT: Template-Toolkit |