Permalink
Browse files

version++ and some refactoring.

  • Loading branch information...
1 parent 8256154 commit 235d7249131ecfb5e0dc726d056ffcec28e872ce @nekokak committed Jul 21, 2012
Showing with 21 additions and 19 deletions.
  1. +6 −0 Changes
  2. +15 −19 lib/Teng.pm
View
@@ -1,5 +1,11 @@
Revision history for Perl extension Teng
+0.15
+ - stop mode:fixup support. (thanks nihen)
+ - refactoring load_plugin. (thanks ktat)
+ - fixed some document. (thanks issm, bokutin, ktat)
+ - pass hash ref as option to plugin init method. (thaks ktat)
+
0.14_05
- FIXED: plugin global export bug. (tahnks takuji31)
- FIXED: set_column(s) un deflate bug. (thanks tsucchi)
View
@@ -24,7 +24,7 @@ use Class::Accessor::Lite
)]
;
-our $VERSION = '0.14_05';
+our $VERSION = '0.15';
sub load_plugin {
my ($class, $pkg, $opt) = @_;
@@ -33,10 +33,12 @@ sub load_plugin {
$class = ref($class) if ref($class);
- my $alias = delete $opt->{alias} || {};
- no strict 'refs';
- for my $method ( @{"${pkg}::EXPORT"} ){
- *{$class . '::' . ($alias->{$method} || $method)} = $pkg->can($method);
+ my $alias = delete $opt->{alias} || +{};
+ {
+ no strict 'refs';
+ for my $method ( @{"${pkg}::EXPORT"} ){
+ *{$class . '::' . ($alias->{$method} || $method)} = $pkg->can($method);
+ }
}
$pkg->init($class, $opt) if $pkg->can('init');
@@ -225,7 +227,14 @@ sub _execute {
}
my $sth;
- eval { $sth = $self->__execute($sql, $binds) };
+ eval {
+ $sth = $self->dbh->prepare($sql);
+ my $i = 1;
+ for my $v ( @{ $binds || [] } ) {
+ $sth->bind_param( $i++, ref($v) ? @$v : $v );
+ }
+ $sth->execute();
+ };
if ($@) {
$self->handle_error($sql, $binds, $@);
@@ -234,19 +243,6 @@ sub _execute {
return $sth;
}
-sub __execute {
- my ($self, $sql, $binds) = @_;
-
- my $sth = $self->dbh->prepare($sql);
- my $i = 1;
- for my $v ( @{ $binds || [] } ) {
- $sth->bind_param( $i++, ref($v) ? @$v : $v );
- }
- $sth->execute();
-
- return $sth;
-}
-
sub _last_insert_id {
my ($self, $table_name) = @_;

0 comments on commit 235d724

Please sign in to comment.