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
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
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
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
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
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
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
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
view release on metacpan or search on metacpan
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
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
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
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
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
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
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
view release on metacpan or search on metacpan
lib/DBIx/QuickDB/Watcher.pm view on Meta::CPAN
our $VERSION = '0.000041';
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
view release on metacpan or search on metacpan
lib/DBIx/QuickORM/Connection.pm view on Meta::CPAN
use feature qw/state/;
our $VERSION = '0.000019';
use Carp qw/confess croak cluck/;
use Scalar::Util qw/blessed weaken/;
use DBIx::QuickORM::Util qw/load_class/;
use DBIx::QuickORM::Handle;
use DBIx::QuickORM::Connection::Transaction;
lib/DBIx/QuickORM/Connection.pm view on Meta::CPAN
my ($async) = @_;
croak "There is already an async query in progress" if $self->{+IN_ASYNC} && !$self->{+IN_ASYNC}->done;
$self->{+IN_ASYNC} = $async;
weaken($self->{+IN_ASYNC});
return $async;
}
sub add_aside {
my $self = shift;
my ($aside) = @_;
$self->{+ASIDES}->{$aside} = $aside;
weaken($self->{+ASIDES}->{$aside});
return $aside;
}
sub add_fork {
my $self = shift;
my ($fork) = @_;
$self->{+FORKS}->{$fork} = $fork;
weaken($self->{+FORKS}->{$fork});
return $fork;
}
sub clear_async {
lib/DBIx/QuickORM/Connection.pm view on Meta::CPAN
$root->add_fail_callback($params{'on_root_fail'}) if $params{on_root_fail};
$root->add_success_callback($params{'on_root_success'}) if $params{on_root_success};
$root->add_completion_callback($params{'on_root_completion'}) if $params{on_root_completion};
push @{$txns} => $txn;
weaken($txns->[-1]);
my $ran = 0;
my $finalize = sub {
my ($txnx, $ok, @errors) = @_;
view all matches for this distribution
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
view release on metacpan or search on metacpan
# $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;
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
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
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
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
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
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
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
view release on metacpan or search on metacpan
lib/DBIx/TransactionManager/Distributed.pm view on Meta::CPAN
release_dbh(category2 => $dbh2);
release_dbh(category3 => $dbh3);
=cut
use Scalar::Util qw(weaken refaddr);
use List::UtilsBy qw(extract_by);
our @EXPORT_OK = qw(register_dbh release_dbh dbh_is_registered txn register_cached_dbh);
# List of all retained handles by category. Since we don't expect to update
lib/DBIx/TransactionManager/Distributed.pm view on Meta::CPAN
if (dbh_is_registered($category, $dbh)) {
warn "already registered this database handle at " . $DBH_SOURCE{$category}{$addr};
return;
}
push @{$DBH{$category}}, $dbh;
weaken($DBH{$category}[-1]);
# filename:line (package::sub)
$DBH_SOURCE{$category}{$addr} = sprintf "%s:%d (%s::%s)", (caller 1)[1, 2, 0, 3];
# We may be connecting partway through a transaction - if so, we want to join this handle onto the list of
# active transactions
$dbh->begin_work if $IN_TRANSACTION && $dbh->{AutoCommit};
view all matches for this distribution
view release on metacpan or search on metacpan
sv_reftype|||
sv_release_COW|||
sv_replace|||
sv_report_used|||
sv_reset|||
sv_rvweaken||5.006000|
sv_setiv_mg|5.004050||p
sv_setiv|||
sv_setnv_mg|5.006000||p
sv_setnv|||
sv_setpv_mg|5.004050||p
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBM/Deep.pm view on Meta::CPAN
if( $self->{engine}->{external_refs}
and my $sector = $self->{engine}->load_sector( $self->{base_offset} )
) {
$sector->increment_refcount;
Scalar::Util::weaken( my $feeble_ref = $self );
$obj_cache{ $self } = \$feeble_ref;
# Make sure this cache is not a memory hog
if(!HAVE_HUFH) {
for(keys %obj_cache) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBR/ResultSet.pm view on Meta::CPAN
use strict;
use base 'DBR::Common';
use DBR::Misc::Dummy;
use Carp;
use Scalar::Util 'weaken';
use constant ({
f_next => 0,
f_state => 1,
f_rowcache => 2,
f_query => 3,
lib/DBR/ResultSet.pm view on Meta::CPAN
}
# IMPORTANT NOTE: circular reference hazard
weaken ($self); # Weaken the refcount
my $endsub = sub {
defined($self) or return DUMMY; # technically this could be out of scope because it's a weak ref
$self->[f_count] ||= $sth->rows || 0;
lib/DBR/ResultSet.pm view on Meta::CPAN
my $commonref;
my $getchunk = sub {
$rows = $sth->fetchall_arrayref(undef,1000) || return undef; # if cache is empty, fetch more
$commonref = [ @$rows ];
map {weaken $_} @$commonref;
$buddy = [ $commonref, $record ]; # buddy ref must contain the record object just to keep it in scope.
return shift @$rows;
};
# use a closure to reduce hash lookups
view all matches for this distribution
view release on metacpan or search on metacpan
SvROK_off|5.003007|5.003007|
SvROK_on|5.003007|5.003007|
SvRV|5.003007|5.003007|
SvRV_const|5.010001||Viu
SvRV_set|5.009003|5.003007|p
sv_rvunweaken|5.027004|5.027004|
sv_rvweaken|5.006000|5.006000|
SvRVx|5.003007||Viu
SvRX|5.009005|5.003007|p
SvRXOK|5.009005|5.003007|p
SV_SAVED_COPY|5.009005||Viu
SvSCREAM|5.003007||Viu
view all matches for this distribution