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/Class/Async/Storage.pm view on Meta::CPAN
use version;
our $VERSION = qv('v1.0.4');
our $AUTHORITY = 'cpan:MANWAR';
use Scalar::Util qw(weaken);
=head1 NAME
DBIx::Class::Async::Storage - Storage Layer for DBIx::Class::Async
lib/DBIx/Class/Async/Storage.pm view on Meta::CPAN
);
B<async_db> is the internal engine (the 'bridge') that handles
communication with the worker processes.
This constructor automatically weakens the reference to the parent L<schema>
to prevent circular reference leaks, ensuring that worker processes are
correctly reaped when the schema object goes out of scope.
=cut
lib/DBIx/Class/Async/Storage.pm view on Meta::CPAN
_async_db => $args{async_db}, # The worker pool engine
}, $class;
# WEAKEN the schema reference to prevent circular memory leaks
# that caused your "5 vs 2 processes" test failure.
weaken($self->{_schema}) if $self->{_schema};
return $self;
}
=head1 METHODS
lib/DBIx/Class/Async/Storage.pm view on Meta::CPAN
This provides a back-reference from the storage to its parent schema,
allowing storage components to access schema-level information and other
ResultSources when needed.
Note: The schema reference is weakened internally to prevent circular
reference memory leaks between the schema and storage objects.
my $storage = $schema->storage;
my $parent_schema = $storage->schema;
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/Class/Graph/Role/ResultSet.pm view on Meta::CPAN
use strict;
use warnings;
use Moose::Role;
use DBIx::Class::Graph::Wrapper;
use Scalar::Util qw(weaken);
has _graph => (
is => 'rw',
isa => 'DBIx::Class::Graph::Wrapper',
lazy_build => 1,
lib/DBIx/Class/Graph/Role/ResultSet.pm view on Meta::CPAN
my $g = DBIx::Class::Graph::Wrapper->new( refvertexed => 1 );
for (@obj) {
$g->add_vertex($_);
$_->_graph($g);
weaken( $_->{_graph} );
}
$g->[99] = 1;
foreach my $row (@obj) {
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
t_dbic/lib/DBICTest/Util.pm view on Meta::CPAN
use warnings;
use strict;
use Carp;
use Scalar::Util qw/isweak weaken blessed reftype refaddr/;
use Config;
use base 'Exporter';
our @EXPORT_OK = qw/local_umask stacktrace populate_weakregistry assert_empty_weakregistry/;
t_dbic/lib/DBICTest/Util.pm view on Meta::CPAN
exit 255;
}
}
else {
$refs_traced++;
weaken( $reg->{$slot}{weakref} = $target );
$reg->{$slot}{stacktrace} = stacktrace(1);
}
$target;
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/dbixcsl_test_dir.pm view on Meta::CPAN
use strict;
use warnings;
use File::Path 'rmtree';
use File::Temp 'tempdir';
use Scalar::Util 'weaken';
use namespace::clean;
use DBI ();
use base qw/Exporter/;
our @EXPORT_OK = '$tdir';
t/lib/dbixcsl_test_dir.pm view on Meta::CPAN
my @handles;
*DBI::connect = sub {
my $dbh = $connect->(@_);
push @handles, $dbh;
weaken $handles[-1];
return $dbh;
};
END {
if (not $ENV{SCHEMA_LOADER_TESTS_NOCLEANUP}) {
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/dbixcsl_test_dir.pm view on Meta::CPAN
use strict;
use warnings;
use File::Path 'rmtree';
use File::Temp 'tempdir';
use Scalar::Util 'weaken';
use namespace::clean;
use DBI ();
use base qw/Exporter/;
our @EXPORT_OK = '$tdir';
t/lib/dbixcsl_test_dir.pm view on Meta::CPAN
my @handles;
*DBI::connect = sub {
my $dbh = $connect->(@_);
push @handles, $dbh;
weaken $handles[-1];
return $dbh;
};
END {
if (not $ENV{SCHEMA_LOADER_TESTS_NOCLEANUP}) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/Schema/Loader.pm view on Meta::CPAN
use warnings;
use base qw/DBIx::Class::Schema Class::Accessor::Grouped/;
use MRO::Compat;
use mro 'c3';
use Carp::Clan qw/^DBIx::Class/;
use Scalar::Util 'weaken';
use Sub::Util 'set_subname';
use DBIx::Class::Schema::Loader::Utils qw/array_eq sigwarn_silencer/;
use Try::Tiny;
use curry;
use namespace::clean;
lib/DBIx/Class/Schema/Loader.pm view on Meta::CPAN
my $clone = $self->next::method(@_);
if($clone->_loader_args) {
$clone->_loader_args->{schema} = $clone;
weaken($clone->_loader_args->{schema});
}
$clone;
}
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
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
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
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/Class/AccessorGroup.pm view on Meta::CPAN
use strict;
use warnings;
use base qw/Class::Accessor::Grouped/;
use Scalar::Util qw/weaken blessed/;
use namespace::clean;
my $successfully_loaded_components;
sub get_component_class {
lib/DBIx/Class/AccessorGroup.pm view on Meta::CPAN
no strict 'refs';
$successfully_loaded_components->{$class}
= ${"${class}::__LOADED__BY__DBIC__CAG__COMPONENT_CLASS__"}
= do { \(my $anon = 'loaded') };
weaken($successfully_loaded_components->{$class});
}
$class;
};
view all matches for this distribution
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
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
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
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