Result:
found more than 1074 distributions - search limited to the first 2001 files matching your query ( run in 0.543 )


DBIx-Class-Storage-DBI-MariaDB

 view release on metacpan or  search on metacpan

t/01-operations.t  view on Meta::CPAN


use Test::More;
use Test::Exception;
use Test::Warn;

use Scalar::Util qw/weaken/;

use lib qw(t/lib);
use MyApp::Schema;

my ( $dsn, $user, $pass ) =

t/01-operations.t  view on Meta::CPAN

    );

    my $schema_autorecon = MyApp::Schema->connect( $dsn, $user, $pass,
        { mariadb_auto_reconnect => 1 } );
    my $orig_dbh = $schema_autorecon->storage->_get_dbh;
    weaken $orig_dbh;

    ok( $orig_dbh, 'Got weak $dbh ref' );
    ok( $orig_dbh->{mariadb_auto_reconnect},
        'mariadb_auto_reconnect is properly set if explicitly requested' );

 view all matches for this distribution


DBIx-Class-TableNames

 view release on metacpan or  search on metacpan

inc/Spiffy.pm  view on Meta::CPAN

      "  return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" .
      "    unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    weak_init =>
      "  return do {\n" .
      "    \$_[0]->{%s} = do { my \$self = \$_[0]; %s };\n" .
      "    Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n" .
      "    \$_[0]->{%s};\n" .
      "  } unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    return_if_get => 
      "  return \$_[0]->{%s} unless \$#_ > 0;\n",
    set => 
      "  \$_[0]->{%s} = \$_[1];\n",
    weaken => 
      "  Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n",
    sub_end => 
      "  return \$_[0]->{%s};\n}\n",
);

sub field {

inc/Spiffy.pm  view on Meta::CPAN

        local *paired_arguments = sub { (qw(-package -init)) };
        Spiffy->parse_arguments(@_);
    };
    my ($field, $default) = @values;
    $package = $args->{-package} if defined $args->{-package};
    die "Cannot have a default for a weakened field ($field)"
        if defined $default && $args->{-weak};
    return if defined &{"${package}::$field"};
    require Scalar::Util if $args->{-weak};
    my $default_string =
        ( ref($default) eq 'ARRAY' and not @$default )

inc/Spiffy.pm  view on Meta::CPAN

    }
    $code .= sprintf $code{set_default}, $field, $default_string, $field
      if defined $default;
    $code .= sprintf $code{return_if_get}, $field;
    $code .= sprintf $code{set}, $field;
    $code .= sprintf $code{weaken}, $field, $field 
      if $args->{-weak};
    $code .= sprintf $code{sub_end}, $field;

    my $sub = eval $code;
    die $@ if $@;

 view all matches for this distribution


DBIx-Connector-Retry-MySQL

 view release on metacpan or  search on metacpan

lib/DBIx/Connector/Retry/MySQL.pm  view on Meta::CPAN


use Moo;

extends 'DBIx::Connector::Retry';

use Scalar::Util           qw( weaken );
use Storable               qw( dclone );
use Types::Standard        qw( Bool HashRef InstanceOf ClassName );
use Types::Common::Numeric qw( PositiveOrZeroNum PositiveOrZeroInt );
use Time::HiRes            qw( sleep );

 view all matches for this distribution


DBIx-Connector-Retry

 view release on metacpan or  search on metacpan

lib/DBIx/Connector/Retry.pm  view on Meta::CPAN


use Moo;

extends 'DBIx::Connector', 'Moo::Object';

use Scalar::Util           qw( weaken );
use Types::Standard        qw( Str Bool HashRef CodeRef Dict Tuple Optional Maybe );
use Types::Common::Numeric qw( PositiveInt );

use namespace::clean;  # don't export the above

lib/DBIx/Connector/Retry.pm  view on Meta::CPAN


    # DBIx::Connector stores connection details in a coderef (for some reason).  Instead
    # of just dumping the same arguments as another copy, we'll tie it directly to the
    # attr.  If connect_info ever changes, it will grab the latest version.
    $self->{_args} = sub { @{ $self->connect_info } };
    weaken $self;  # circular closure ref
}

#pod =head1 MODIFIED METHODS
#pod
#pod =head2 run / txn

 view all matches for this distribution


DBIx-Custom

 view release on metacpan or  search on metacpan

lib/DBIx/Custom.pm  view on Meta::CPAN

use DBIx::Custom::NotExists;
use DBIx::Custom::Query;
use DBIx::Connector;

use Encode qw/encode encode_utf8 decode_utf8/;
use Scalar::Util qw/weaken/;

has [qw/dsn password quote user exclude_table user_table_info
     user_column_info safety_character/];
has connector => 1;
has option => sub { {} };

lib/DBIx/Custom.pm  view on Meta::CPAN

  $model_name ||= $model_table;
  my $column_name_lc = delete $opt->{column_name_lc};
  
  # Create model
  my $model = $model_class->new($opt);
  weaken $model->{dbi};
  $model->table($model_table) unless $model->table;
  $model->name($model_name);

  if (!$model->columns || !@{$model->columns}) {
    $model->columns($self->get_columns_from_db($model->table, {column_name_lc => $column_name_lc}));

 view all matches for this distribution


DBIx-DBHResolver

 view release on metacpan or  search on metacpan

inc/Spiffy.pm  view on Meta::CPAN

      "  return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" .
      "    unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    weak_init =>
      "  return do {\n" .
      "    \$_[0]->{%s} = do { my \$self = \$_[0]; %s };\n" .
      "    Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n" .
      "    \$_[0]->{%s};\n" .
      "  } unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    return_if_get => 
      "  return \$_[0]->{%s} unless \$#_ > 0;\n",
    set => 
      "  \$_[0]->{%s} = \$_[1];\n",
    weaken => 
      "  Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n",
    sub_end => 
      "  return \$_[0]->{%s};\n}\n",
);

sub field {

inc/Spiffy.pm  view on Meta::CPAN

        local *paired_arguments = sub { (qw(-package -init)) };
        Spiffy->parse_arguments(@_);
    };
    my ($field, $default) = @values;
    $package = $args->{-package} if defined $args->{-package};
    die "Cannot have a default for a weakened field ($field)"
        if defined $default && $args->{-weak};
    return if defined &{"${package}::$field"};
    require Scalar::Util if $args->{-weak};
    my $default_string =
        ( ref($default) eq 'ARRAY' and not @$default )

inc/Spiffy.pm  view on Meta::CPAN

    }
    $code .= sprintf $code{set_default}, $field, $default_string, $field
      if defined $default;
    $code .= sprintf $code{return_if_get}, $field;
    $code .= sprintf $code{set}, $field;
    $code .= sprintf $code{weaken}, $field, $field 
      if $args->{-weak};
    $code .= sprintf $code{sub_end}, $field;

    my $sub = eval $code;
    die $@ if $@;

 view all matches for this distribution


DBIx-DBO

 view release on metacpan or  search on metacpan

lib/DBIx/DBO/Query.pm  view on Meta::CPAN

use DBIx::DBO;

use Carp 'croak';
use Devel::Peek 'SvREFCNT';
use Hash::Util 'hv_store';
use Scalar::Util 'weaken';

use overload '**' => \&column, fallback => 1;

sub table_class { $_[0]{DBO}->table_class }
sub row_class { $_[0]{DBO}->row_class }

lib/DBIx/DBO/Query.pm  view on Meta::CPAN


    $me->_recursion_check($upquery);

    my $uq = $me->{up_queries} //= [];
    push @$uq, $upquery;
    weaken $uq->[-1];
}

sub sql {
    my $me = shift;
    return $me->{DBO}{dbd_class}->_build_sql_select($me);

 view all matches for this distribution


DBIx-DR

 view release on metacpan or  search on metacpan

lib/DBIx/DR/Iterator.pm  view on Meta::CPAN

use utf8;
use strict;
use warnings;

package DBIx::DR::Iterator;
use Scalar::Util qw(blessed weaken);
use DBIx::DR::Util;
use Carp;


# Perl 5.18 refuses smartmatch

lib/DBIx/DR/Iterator.pm  view on Meta::CPAN

    return unless defined $object;
    Carp::croak "Usage: DBIx::DR::Iterator::Item->new(HASHREF [, iterator ])"
        unless 'HASH' eq ref $object;
    my $self = bless $object => ref($class) || $class;
    $self->{iterator} = $iterator;
    Scalar::Util::weaken($self->{iterator});
    $self->{is_changed} = 0;
    return $self;
}

sub is_changed {

lib/DBIx/DR/Iterator.pm  view on Meta::CPAN

    $row = DBIx::DR::Iterator::Item->new({ id => 1 }, $iterator); }

=head2 iterator

Returns (or set) iterator object. The link is created by constructor.
This is a L<weaken|Scalar::Util/weaken> link.

=head2 is_changed

Returns (or set) flag if the row has been changed. If You change any of
row's fields the flag will be set. Also iterator's flag will be set.

 view all matches for this distribution


DBIx-DataModel

 view release on metacpan or  search on metacpan

lib/DBIx/DataModel/Meta/Association.pm  view on Meta::CPAN




use Params::Validate qw/validate_with SCALAR ARRAYREF HASHREF OBJECT UNDEF/;
use List::MoreUtils  qw/pairwise/;
use Scalar::Util     qw/weaken dualvar looks_like_number/;
use Module::Load     qw/load/;
use POSIX            qw/LONG_MAX/;
use namespace::clean;


lib/DBIx/DataModel/Meta/Association.pm  view on Meta::CPAN


  # EXPERIMENTAL : no longer need association ends; all info is stored in Paths
  delete@{$self}{qw/A B/};

  # avoid circular reference
  weaken $self->{schema};

  return $self;
}


 view all matches for this distribution


DBIx-FlexibleBinding

 view release on metacpan or  search on metacpan

lib/DBIx/FlexibleBinding.pm  view on Meta::CPAN

our $VERSION = '2.0.4'; # VERSION
# ABSTRACT: Greater statement placeholder and data-binding flexibility.
use DBI             ();
use Exporter        ();
use Message::String ();
use Scalar::Util    ( 'reftype', 'blessed', 'weaken' );
use Sub::Util       ( 'set_subname' );
use namespace::clean;
use Params::Callbacks ( 'callback' );
use message << 'EOF';
CRIT_EXP_AREF_AFTER Expected a reference to an ARRAY after argument (%s)

lib/DBIx/FlexibleBinding.pm  view on Meta::CPAN

            undef $proxies{$fqpi};
            return $proxies{$fqpi};
        }
        if ( blessed( $args[0] ) ) {
            if ( $args[0]->isa( "$package\::db" ) ) {
                weaken( $proxies{$fqpi} = $args[0] );
            }
            elsif ( $args[0]->isa( "$package\::st" ) ) {
                weaken( $proxies{$fqpi} = $args[0] );
            }
            else {
                CRIT_EXP_HANDLE( $package );
            }
            return $proxies{$fqpi};

 view all matches for this distribution


DBIx-MoCo

 view release on metacpan or  search on metacpan

lib/DBIx/MoCo.pm  view on Meta::CPAN

    return unless $class->cache_object;

    my $rm = $class->cache_object->can('remove') ? 'remove' : 'delete';
    for (@{$self->object_ids}) {
        # warn "flush $_";
        #weaken($class->cache($_));
        $class->cache_object->$rm($_);
    }
}

sub store_self_cache {

 view all matches for this distribution


DBIx-Model

 view release on metacpan or  search on metacpan

lib/DBIx/Model/Column.pm  view on Meta::CPAN

        isa => Int,
    },
    table => {
        is       => 'ro',
        required => 1,
        weaken   => 1,
    },
    name => {
        is       => 'ro',
        isa      => Str,
        required => 1,

lib/DBIx/Model/Column.pm  view on Meta::CPAN

  grep {not exists$INLINE->{$_ }}keys %$self}else {@ATTRS_UNEX=map {delete
  $self->{$_ };$_}grep {not exists$INLINE->{$_ }}keys %$self}bless$self,ref
  $class || $class;map {$self->{$_ }=eval {$INLINE->{$_ }->{'isa'}->($self->{
  $_ })};Carp::croak(qq{DBIx::Model::Column::$_ value invalid ($@)})if $@}grep
  {exists$self->{$_ }}'chain','name','nullable','primary','ref_count','size',
  'target_count','type';map {Scalar::Util::weaken($self->{$_ })}grep {exists(
  $self->{$_})&& defined$self->{$_ }}'table';my@check=('DBIx::Model::Column');
  my@parents;while (@check){no strict 'refs';my$c=shift@check;push@parents,@{
  $c .'::ISA'};push@check,@{$c .'::ISA'}}map {$_->BUILD()if exists &{$_.
  '::BUILD'}}reverse@parents;$self->BUILD()if exists &{'BUILD'};$self}sub __ro
  {my (undef,undef,undef,$sub)=caller(1);local$Carp::CarpLevel=

 view all matches for this distribution


DBIx-Mojo-Template

 view release on metacpan or  search on metacpan

lib/DBIx/Mojo/Model.pm  view on Meta::CPAN

package DBIx::Mojo::Model;
use Mojo::Base -base;
use Carp 'croak';
use DBIx::Mojo::Template;
use Hash::Merge qw( merge );
use Scalar::Util 'weaken';

my %DICT_CACHE = ();# для каждого пакета/модуля

has [qw(dbh dict)], undef, weak=>1;
has [qw(template_vars mt)];

lib/DBIx/Mojo/Model.pm  view on Meta::CPAN

  my $self = ref $_[0] ? shift : shift->SUPER::new(@_);
  my $singleton = $self->singleton;
  
  $self->dbh($singleton->dbh)
    unless $self->dbh;
  #~ weaken $self->{dbh};
    
  $self->template_vars(merge($self->template_vars || {}, $singleton->template_vars))
    #~ and weaken $self->{template_vars}
    if $singleton->template_vars && %{$singleton->template_vars};
  
  $self->mt(merge($self->mt || {}, $singleton->mt))
    #~ and weaken $self->{mt}
    if $singleton->mt && %{$singleton->mt};
  
  my $class = ref $self;
  
  # pass extra class files (inside the class): our $DATA=['foo.txt', 'bar.txt'];
  my $data_files = do {   no strict 'refs'; ${"$class\::DATA"} };
  
  $self->dict( $DICT_CACHE{$class} ||= DBIx::Mojo::Template->new($class, mt => $self->mt, vars => $self->template_vars, $data_files ? (data => $data_files) : (), ) )
    unless $self->dict;
  #~ weaken $self->{dict};
  
  $self->debug
    && say STDERR "[DEBUG $PKG new] parsed dict keys [@{[keys %{$self->dict}]}] for class [$class]";
  
  $self;

 view all matches for this distribution


DBIx-MyParse

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

sv_release_COW|||
sv_release_IVX|||
sv_replace|||
sv_report_used|||
sv_reset|||
sv_rvweaken||5.006000|
sv_setiv_mg|5.006000||p
sv_setiv|||
sv_setnv_mg|5.006000||p
sv_setnv|||
sv_setpv_mg|5.006000||p

 view all matches for this distribution


DBIx-OO

 view release on metacpan or  search on metacpan

lib/DBIx/OO.pm  view on Meta::CPAN


BEGIN {
    $HAS_WEAKEN = 1;
    eval {
        require Scalar::Util;
        import Scalar::Util qw(weaken);
    };
    if ($@) {
        $HAS_WEAKEN = 0;
    }
}

 view all matches for this distribution


DBIx-ObjectMapper

 view release on metacpan or  search on metacpan

inc/Spiffy.pm  view on Meta::CPAN

      "  return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" .
      "    unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    weak_init =>
      "  return do {\n" .
      "    \$_[0]->{%s} = do { my \$self = \$_[0]; %s };\n" .
      "    Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n" .
      "    \$_[0]->{%s};\n" .
      "  } unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    return_if_get => 
      "  return \$_[0]->{%s} unless \$#_ > 0;\n",
    set => 
      "  \$_[0]->{%s} = \$_[1];\n",
    weaken => 
      "  Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n",
    sub_end => 
      "  return \$_[0]->{%s};\n}\n",
);

sub field {

inc/Spiffy.pm  view on Meta::CPAN

        local *paired_arguments = sub { (qw(-package -init)) };
        Spiffy->parse_arguments(@_);
    };
    my ($field, $default) = @values;
    $package = $args->{-package} if defined $args->{-package};
    die "Cannot have a default for a weakened field ($field)"
        if defined $default && $args->{-weak};
    return if defined &{"${package}::$field"};
    require Scalar::Util if $args->{-weak};
    my $default_string =
        ( ref($default) eq 'ARRAY' and not @$default )

inc/Spiffy.pm  view on Meta::CPAN

    }
    $code .= sprintf $code{set_default}, $field, $default_string, $field
      if defined $default;
    $code .= sprintf $code{return_if_get}, $field;
    $code .= sprintf $code{set}, $field;
    $code .= sprintf $code{weaken}, $field, $field 
      if $args->{-weak};
    $code .= sprintf $code{sub_end}, $field;

    my $sub = eval $code;
    die $@ if $@;

 view all matches for this distribution


DBIx-PgLink

 view release on metacpan or  search on metacpan

lib/DBIx/PgLink/Connector.pm  view on Meta::CPAN

use Moose;
use MooseX::Method;
use DBIx::PgLink::Logger qw/trace_msg trace_level/;
use DBIx::PgLink::Local;
use DBIx::PgLink::Types;
use Scalar::Util qw/weaken/;
use Data::Dumper;

extends 'Moose::Object';

our $VERSION = '0.01';

lib/DBIx/PgLink/Connector.pm  view on Meta::CPAN

  # load attributes
  my $attr_href = $self->load_attributes;

  # pass weak reference to self
  $attr_href->{connector} = $self;
  weaken $attr_href->{connector};

  # create adapter
  trace_msg('INFO', "Creating adapter '$adapter_class' for connection " . $self->conn_name) 
    if trace_level>=2;
  $self->adapter( $adapter_class->new($attr_href) );

 view all matches for this distribution


DBIx-Poggy

 view release on metacpan or  search on metacpan

lib/DBIx/Poggy.pm  view on Meta::CPAN

use v5.14;

package DBIx::Poggy;
our $VERSION = '0.08';

use Scalar::Util qw(weaken refaddr);

=head1 NAME

DBIx::Poggy - async Pg with AnyEvent and Promises

lib/DBIx/Poggy.pm  view on Meta::CPAN

        last;
    }

    if ( $args{auto} ) {
        $dbh->{private_poggy_state}{release_to} = $self;
        weaken $dbh->{private_poggy_state}{release_to};
        return $dbh;
    }
    return $dbh unless wantarray;
    return ( $dbh, guard { $self->release($dbh) } );
}

 view all matches for this distribution


DBIx-ProfileManager

 view release on metacpan or  search on metacpan

inc/Spiffy.pm  view on Meta::CPAN

      "  return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" .
      "    unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    weak_init =>
      "  return do {\n" .
      "    \$_[0]->{%s} = do { my \$self = \$_[0]; %s };\n" .
      "    Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n" .
      "    \$_[0]->{%s};\n" .
      "  } unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    return_if_get => 
      "  return \$_[0]->{%s} unless \$#_ > 0;\n",
    set => 
      "  \$_[0]->{%s} = \$_[1];\n",
    weaken => 
      "  Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n",
    sub_end => 
      "  return \$_[0]->{%s};\n}\n",
);

sub field {

inc/Spiffy.pm  view on Meta::CPAN

        local *paired_arguments = sub { (qw(-package -init)) };
        Spiffy->parse_arguments(@_);
    };
    my ($field, $default) = @values;
    $package = $args->{-package} if defined $args->{-package};
    die "Cannot have a default for a weakened field ($field)"
        if defined $default && $args->{-weak};
    return if defined &{"${package}::$field"};
    require Scalar::Util if $args->{-weak};
    my $default_string =
        ( ref($default) eq 'ARRAY' and not @$default )

inc/Spiffy.pm  view on Meta::CPAN

    }
    $code .= sprintf $code{set_default}, $field, $default_string, $field
      if defined $default;
    $code .= sprintf $code{return_if_get}, $field;
    $code .= sprintf $code{set}, $field;
    $code .= sprintf $code{weaken}, $field, $field 
      if $args->{-weak};
    $code .= sprintf $code{sub_end}, $field;

    my $sub = eval $code;
    die $@ if $@;

 view all matches for this distribution


DBIx-QueryByName

 view release on metacpan or  search on metacpan

lib/DBIx/QueryByName/DbhPool.pm  view on Meta::CPAN

use strict;
use warnings;

use DBI;
use DBIx::QueryByName::Logger qw(get_logger debug);
use Scalar::Util qw(weaken);

sub new {
    return bless( { connections => {}, config => {} }, $_[0] );
}

sub parent {
    my ($self, $parent) = @_;
    $self->{sthpool} = $parent->_sth_pool;
    weaken $self->{sthpool};
}

sub add_credentials {
    my ($self, $session, @params) = @_;
	my $log = get_logger();

 view all matches for this distribution


DBIx-QuickDB

 view release on metacpan or  search on metacpan

lib/DBIx/QuickDB/Watcher.pm  view on Meta::CPAN

our $VERSION = '0.000038';

use Carp qw/croak/;
use POSIX qw/:sys_wait_h/;
use Time::HiRes qw/sleep time/;
use Scalar::Util qw/weaken/;
use File::Path qw/remove_tree/;

use DBIx::QuickDB::Util::HashBase qw{
    <db <args
    <server_pid

lib/DBIx/QuickDB/Watcher.pm  view on Meta::CPAN


    $self->{+LOG_FILE} = $self->{+DB}->gen_log;

    $self->start();

    weaken($self->{+DB}) if $self->{+MASTER_PID} == $$;
}

sub start {
    my $self = shift;
    return if $self->{+SERVER_PID};

 view all matches for this distribution


DBIx-QuickORM

 view release on metacpan or  search on metacpan

lib/DBIx/QuickORM/BuilderState.pm  view on Meta::CPAN

use warnings;

our $VERSION = '0.000004';

use Carp qw/croak confess/;
use Scalar::Util qw/blessed weaken/;
use DBIx::QuickORM::Util qw/mesh_accessors update_subname mod2file/;

use Importer Importer => 'import';

$Carp::Internal{(__PACKAGE__)}++;

 view all matches for this distribution


DBIx-RewriteDSN

 view release on metacpan or  search on metacpan

inc/Spiffy.pm  view on Meta::CPAN

      "  return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" .
      "    unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    weak_init =>
      "  return do {\n" .
      "    \$_[0]->{%s} = do { my \$self = \$_[0]; %s };\n" .
      "    Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n" .
      "    \$_[0]->{%s};\n" .
      "  } unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    return_if_get => 
      "  return \$_[0]->{%s} unless \$#_ > 0;\n",
    set => 
      "  \$_[0]->{%s} = \$_[1];\n",
    weaken => 
      "  Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n",
    sub_end => 
      "  return \$_[0]->{%s};\n}\n",
);

sub field {

inc/Spiffy.pm  view on Meta::CPAN

        local *paired_arguments = sub { (qw(-package -init)) };
        Spiffy->parse_arguments(@_);
    };
    my ($field, $default) = @values;
    $package = $args->{-package} if defined $args->{-package};
    die "Cannot have a default for a weakened field ($field)"
        if defined $default && $args->{-weak};
    return if defined &{"${package}::$field"};
    require Scalar::Util if $args->{-weak};
    my $default_string =
        ( ref($default) eq 'ARRAY' and not @$default )

inc/Spiffy.pm  view on Meta::CPAN

    }
    $code .= sprintf $code{set_default}, $field, $default_string, $field
      if defined $default;
    $code .= sprintf $code{return_if_get}, $field;
    $code .= sprintf $code{set}, $field;
    $code .= sprintf $code{weaken}, $field, $field 
      if $args->{-weak};
    $code .= sprintf $code{sub_end}, $field;

    my $sub = eval $code;
    die $@ if $@;

 view all matches for this distribution


DBIx-Roles

 view release on metacpan or  search on metacpan

Roles.pm  view on Meta::CPAN

# $Id: Roles.pm,v 1.18 2006/01/30 10:58:51 dk Exp $

package DBIx::Roles;

use DBI;
use Scalar::Util qw(weaken);
use strict;
use vars qw($VERSION %loaded_packages $DBI_connect %DBI_select_methods $debug $ExportDepth);

$VERSION = '1.04';
$ExportDepth = 0;

Roles.pm  view on Meta::CPAN

	tie %{$self}, 'DBIx::Roles::Instance', $instance;
	bless $self, $class;

	# use this trick for cheap self-referencing ( otherwise the object is never destroyed )
	$instance->{self} = $self;
	weaken( $instance->{self});

	return $self;
}

# connect to DB

 view all matches for this distribution


DBIx-Simple-DataSection

 view release on metacpan or  search on metacpan

inc/Spiffy.pm  view on Meta::CPAN

      "  return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" .
      "    unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    weak_init =>
      "  return do {\n" .
      "    \$_[0]->{%s} = do { my \$self = \$_[0]; %s };\n" .
      "    Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n" .
      "    \$_[0]->{%s};\n" .
      "  } unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    return_if_get => 
      "  return \$_[0]->{%s} unless \$#_ > 0;\n",
    set => 
      "  \$_[0]->{%s} = \$_[1];\n",
    weaken => 
      "  Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n",
    sub_end => 
      "  return \$_[0]->{%s};\n}\n",
);

sub field {

inc/Spiffy.pm  view on Meta::CPAN

        local *paired_arguments = sub { (qw(-package -init)) };
        Spiffy->parse_arguments(@_);
    };
    my ($field, $default) = @values;
    $package = $args->{-package} if defined $args->{-package};
    die "Cannot have a default for a weakened field ($field)"
        if defined $default && $args->{-weak};
    return if defined &{"${package}::$field"};
    require Scalar::Util if $args->{-weak};
    my $default_string =
        ( ref($default) eq 'ARRAY' and not @$default )

inc/Spiffy.pm  view on Meta::CPAN

    }
    $code .= sprintf $code{set_default}, $field, $default_string, $field
      if defined $default;
    $code .= sprintf $code{return_if_get}, $field;
    $code .= sprintf $code{set}, $field;
    $code .= sprintf $code{weaken}, $field, $field 
      if $args->{-weak};
    $code .= sprintf $code{sub_end}, $field;

    my $sub = eval $code;
    die $@ if $@;

 view all matches for this distribution


DBIx-Simple-Inject

 view release on metacpan or  search on metacpan

lib/DBIx/Simple/Inject.pm  view on Meta::CPAN

use strict;
our @ISA = qw(DBI::db);

use Class::Load;
use DBIx::Simple;
use Scalar::Util qw/weaken/;

sub simple {
    my ($dbh) = @_;
    $dbh->{private_dbixsimple_object} ||= do {
        my $dbis = DBIx::Simple->connect($dbh);
        weaken($dbis->{dbh});
        
        for my $k (keys %{ $dbh->{private_dbixsimple} || {} }) {
            my $v = $dbh->{private_dbixsimple}{$k};
            # lvalue method
            $dbis->$k = ref $v eq 'CODE' ? $v->($dbh)

 view all matches for this distribution


DBIx-Skinny-InflateColumn-DateTime

 view release on metacpan or  search on metacpan

inc/Spiffy.pm  view on Meta::CPAN

      "  return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" .
      "    unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    weak_init =>
      "  return do {\n" .
      "    \$_[0]->{%s} = do { my \$self = \$_[0]; %s };\n" .
      "    Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n" .
      "    \$_[0]->{%s};\n" .
      "  } unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    return_if_get => 
      "  return \$_[0]->{%s} unless \$#_ > 0;\n",
    set => 
      "  \$_[0]->{%s} = \$_[1];\n",
    weaken => 
      "  Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n",
    sub_end => 
      "  return \$_[0]->{%s};\n}\n",
);

sub field {

inc/Spiffy.pm  view on Meta::CPAN

        local *paired_arguments = sub { (qw(-package -init)) };
        Spiffy->parse_arguments(@_);
    };
    my ($field, $default) = @values;
    $package = $args->{-package} if defined $args->{-package};
    die "Cannot have a default for a weakened field ($field)"
        if defined $default && $args->{-weak};
    return if defined &{"${package}::$field"};
    require Scalar::Util if $args->{-weak};
    my $default_string =
        ( ref($default) eq 'ARRAY' and not @$default )

inc/Spiffy.pm  view on Meta::CPAN

    }
    $code .= sprintf $code{set_default}, $field, $default_string, $field
      if defined $default;
    $code .= sprintf $code{return_if_get}, $field;
    $code .= sprintf $code{set}, $field;
    $code .= sprintf $code{weaken}, $field, $field 
      if $args->{-weak};
    $code .= sprintf $code{sub_end}, $field;

    my $sub = eval $code;
    die $@ if $@;

 view all matches for this distribution


DBIx-Skinny-Mixin-BulkInsertWithTrigger

 view release on metacpan or  search on metacpan

inc/Spiffy.pm  view on Meta::CPAN

      "  return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" .
      "    unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    weak_init =>
      "  return do {\n" .
      "    \$_[0]->{%s} = do { my \$self = \$_[0]; %s };\n" .
      "    Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n" .
      "    \$_[0]->{%s};\n" .
      "  } unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    return_if_get => 
      "  return \$_[0]->{%s} unless \$#_ > 0;\n",
    set => 
      "  \$_[0]->{%s} = \$_[1];\n",
    weaken => 
      "  Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n",
    sub_end => 
      "  return \$_[0]->{%s};\n}\n",
);

sub field {

inc/Spiffy.pm  view on Meta::CPAN

        local *paired_arguments = sub { (qw(-package -init)) };
        Spiffy->parse_arguments(@_);
    };
    my ($field, $default) = @values;
    $package = $args->{-package} if defined $args->{-package};
    die "Cannot have a default for a weakened field ($field)"
        if defined $default && $args->{-weak};
    return if defined &{"${package}::$field"};
    require Scalar::Util if $args->{-weak};
    my $default_string =
        ( ref($default) eq 'ARRAY' and not @$default )

inc/Spiffy.pm  view on Meta::CPAN

    }
    $code .= sprintf $code{set_default}, $field, $default_string, $field
      if defined $default;
    $code .= sprintf $code{return_if_get}, $field;
    $code .= sprintf $code{set}, $field;
    $code .= sprintf $code{weaken}, $field, $field 
      if $args->{-weak};
    $code .= sprintf $code{sub_end}, $field;

    my $sub = eval $code;
    die $@ if $@;

 view all matches for this distribution


DBIx-Squirrel

 view release on metacpan or  search on metacpan

lib/DBIx/Squirrel/it.pm  view on Meta::CPAN

=cut

use Exporter     ();
use Scalar::Util qw(
    looks_like_number
    weaken
);
use Sub::Name 'subname';
use DBIx::Squirrel::util qw(
    cluckf
    confessf

 view all matches for this distribution


DBIx-Sunny

 view release on metacpan or  search on metacpan

lib/DBIx/Sunny.pm  view on Meta::CPAN

package DBIx::Sunny::db;
our @ISA = qw(DBI::db);

use DBIx::Sunny::Util qw/bind_and_execute expand_placeholder/;
use DBIx::TransactionManager 0.13;
use Scalar::Util qw/weaken/;

sub connected {
    my $dbh = shift;
    my ($dsn, $user, $pass, $attr) = @_;
    $dbh->{RaiseError} = 1;

lib/DBIx/Sunny.pm  view on Meta::CPAN


sub txn_scope {
    my $self = shift;
    if ( ! $self->{private_txt_manager} ) {
        $self->{private_txt_manager} = DBIx::TransactionManager->new($self);
        weaken($self->{private_txt_manager}->{dbh});
    }
    $self->{private_txt_manager}->txn_scope(
        caller => [caller(0)]
    );
}

 view all matches for this distribution


( run in 0.543 second using v1.01-cache-2.11-cpan-65fba6d93b7 )