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/perl | |
use utf8; | |
use strict; | |
use warnings; | |
use AnyEvent; | |
use Protocol::WebSocket::Frame; | |
use Protocol::WebSocket::Handshake::Client; | |
use IO::Socket; | |
use constant {READ => 0, WRITE => 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
use Text::Xslate; | |
my $t = Text::Xslate->new(syntax => 'TTerse'); | |
print $t->render_string(<<__END__); | |
[% | |
# | |
# | |
# | |
# | |
# | |
# |
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
sub search { | |
my ($self, $table_name, $where, $opt) = @_; | |
my $table = $self->schema->get_table( $table_name ); | |
if (! $table) { | |
Carp::croak("No such table $table_name"); | |
} | |
my $sql_maker = $self->sql_builder; | |
my $stmt = $sql_maker->new_select(select => $opt->{columns} || $table->columns); |
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
# 問題では、add_to_items($value, \@array); でしたので、書き換わりません。 | |
# と、指摘いただきました。 | |
{ | |
my ($value, $array_ref) = (1, [1,2,3,4]); | |
add_to_items($value, $array_ref); | |
print join ",", @$array_ref; | |
# 2,3,4,5 | |
} |
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 Teng::Plugin::Pager::MySQLFoundRows::WithSQL; | |
use strict; | |
use warnings; | |
use utf8; | |
use Carp (); | |
use Teng::Iterator; | |
use Data::Page; | |
our @EXPORT = qw/search_by_sql_with_pager/; |
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 Teng::Plugin::SearchBySQLAbstractMore; | |
use strict; | |
use warnings; | |
use utf8; | |
use Carp (); | |
use Teng::Iterator; | |
use Data::Page; | |
use SQL::Abstract::More; | |
our @EXPORT = qw/search_by_sql_abstract_more search_by_sql_abstract_more_with_pager/; |
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/perl | |
use strict; | |
use warnings; | |
use SQL::Maker; | |
use SQL::Abstract; | |
use SQL::Abstract::More; | |
use Benchmark qw/cmpthese/; | |
my $sql_abstract_more = new SQL::Abstract::More(); |
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 Hoge::PSGIErrors; | |
use strict; | |
use IO::Handle; | |
sub new { | |
my $class = shift; | |
my $env = shift; | |
my %self; | |
$self{io} = IO::Handle->new; |
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
diff --git a/lib/DBIx/QueryLog.pm b/lib/DBIx/QueryLog.pm | |
index 747cdd5..cf5e379 100644 | |
--- a/lib/DBIx/QueryLog.pm | |
+++ b/lib/DBIx/QueryLog.pm | |
@@ -8,6 +8,7 @@ use DBI; | |
use Time::HiRes qw(gettimeofday tv_interval); | |
use Term::ANSIColor qw(colored); | |
use Data::Dumper (); | |
+use Module::Find (); | |
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
diff --git a/lib/Teng.pm b/lib/Teng.pm | |
index de2f878..a2b3207 100644 | |
--- a/lib/Teng.pm | |
+++ b/lib/Teng.pm | |
@@ -33,14 +33,10 @@ sub load_plugin { | |
$class = ref($class) if ref($class); | |
- my $alias = delete $opt->{alias}; | |
+ my $alias = delete $opt->{alias} || {}; |