view release on metacpan or search on metacpan
lib/Data/Random/Contact/Language/EN.pm view on Meta::CPAN
we'd
we'll
we're
we've
weak
weaken
weakened
weakening
weakens
weaker
weakest
weakfish
weakfish's
weakfishes
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Rebuilder.pm view on Meta::CPAN
my $lazy = $self->_lazy->{ refaddr $v } ||= [];
push( @$lazy ,
sprintf('%s->[%s] = %s;',
$var, $i, $self->freeze($v)));
push( @$lazy ,
sprintf('Scalar::Util::weaken(%s->[%s]);',
$var, $i))
if isweak($ref->[$i]);
}
elsif( $self->poly->type($v) eq 'RefRef' and
lib/Data/Rebuilder.pm view on Meta::CPAN
push @{$lazy}, sprintf('%s->[%s] = %s;',
$var,
$i,
$self->poly->apply( $v => 'freeze'));
push( @$lazy ,
sprintf('Scalar::Util::weaken(%s->[%s]);',
$var, $i))
if isweak($ref->[$i]);
}
else {
lib/Data/Rebuilder.pm view on Meta::CPAN
" "._indent( join "\n",
map{ $self->tier('$__tmp->['.$_->[0].']',
'TIESCALAR',
$_->[1]) } @tied ),
" "._indent( join "\n",
map{ sprintf(' Scalar::Util::weaken('.
' $__tmp->[%s] );' ,
$_) } @weak ),
' $__tmp;',
"}"
);
lib/Data/Rebuilder.pm view on Meta::CPAN
$var,
$self->freeze($key),
$self->freeze($v)));
push( @$lazy ,
sprintf('Scalar::Util::weaken(%s->{%s});',
$var,
$self->freeze($key)
)) if isweak($ref->{$key});
}
lib/Data/Rebuilder.pm view on Meta::CPAN
$var,
$self->freeze($key),
$self->freeze($v));
push( @$lazy ,
sprintf('Scalar::Util::weaken(%s->{%s});',
$var,
$self->freeze($key),
)) if isweak($ref->{$key});
}
lib/Data/Rebuilder.pm view on Meta::CPAN
@body ,
" };",
( map{ $self->tier('$__tmp->{'.$self->freeze($_->[0]).'}',
'TIESCALAR',
$_->[1]) } @tied ),
( map{ sprintf(' Scalar::Util::weaken( \ $__tmp->{%s} );' ,
$self->freeze($_)) }
@weak ),
' $__tmp;',
"}"
);
view all matches for this distribution
view release on metacpan or search on metacpan
src/xs/clone.cc view on Meta::CPAN
auto end = data.map.end();
for (const auto& row : data.weakrefs) { // post process weak refs that appeared before their strong refs
auto it = data.map.find(row.key);
if (it == end) continue;
SvSetSV_nosteal(row.dest, it->second);
sv_rvweaken(row.dest);
}
}
else _clone(aTHX_ ret, source, crossdata, 0);
return ret;
src/xs/clone.cc view on Meta::CPAN
SV* source_val = SvRV(source);
svtype val_type = SvTYPE(source_val);
if (val_type == SVt_PVCV || val_type == SVt_PVIO) { // CV and IO cannot be copied - just set reference to the same SV
SvSetSV_nosteal(dest, source);
if (SvWEAKREF(source)) sv_rvweaken(dest);
return;
}
uint64_t id = PTR2UV(source_val);
if (xdata) {
auto it = xdata->map.find(id);
if (it != xdata->map.end()) {
SvSetSV_nosteal(dest, it->second);
if (SvWEAKREF(source)) sv_rvweaken(dest);
return;
}
if (SvWEAKREF(source)) {
// we can't clone object weakref points to right now, because no strong refs for the object cloned so far, we must wait until the end
xdata->weakrefs.push_back({dest, id});
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Memory/Cycle.pm view on Meta::CPAN
our $VERSION = '1.04';
#line 46
use Devel::Cycle qw( find_cycle find_weakened_cycle );
use Test::Builder;
my $Test = Test::Builder->new;
sub import {
inc/Test/Memory/Cycle.pm view on Meta::CPAN
my $caller = caller;
no strict 'refs';
*{$caller.'::memory_cycle_ok'} = \&memory_cycle_ok;
*{$caller.'::memory_cycle_exists'} = \&memory_cycle_exists;
*{$caller.'::weakened_memory_cycle_ok'} = \&weakened_memory_cycle_ok;
*{$caller.'::weakened_memory_cycle_exists'} = \&weakened_memory_cycle_exists;
*{$caller.'::memory_cycle_exists'} = \&memory_cycle_exists;
*{$caller.'::weakened_memory_cycle_ok'} = \&weakened_memory_cycle_ok;
*{$caller.'::weakened_memory_cycle_exists'} = \&weakened_memory_cycle_exists;
$Test->exported_to($caller);
$Test->plan(@_);
return;
inc/Test/Memory/Cycle.pm view on Meta::CPAN
return $ok;
} # memory_cycle_exists
#line 145
sub weakened_memory_cycle_ok {
my $ref = shift;
my $msg = shift;
my $cycle_no = 0;
my @diags;
inc/Test/Memory/Cycle.pm view on Meta::CPAN
my $callback = sub {
my $path = shift;
$cycle_no++;
push( @diags, "Cycle #$cycle_no" );
foreach (@$path) {
my ($type,$index,$ref,$value,$is_weakened) = @$_;
my $str = "Unknown! This should never happen!";
my $refdisp = _ref_shortname( $ref );
my $valuedisp = _ref_shortname( $value );
my $weak = $is_weakened ? 'w->' : '';
$str = sprintf( ' %s%s => %s', $weak, $refdisp, $valuedisp ) if $type eq 'SCALAR';
$str = sprintf( ' %s%s => %s', $weak, "${refdisp}->[$index]", $valuedisp ) if $type eq 'ARRAY';
$str = sprintf( ' %s%s => %s', $weak, "${refdisp}->{$index}", $valuedisp ) if $type eq 'HASH';
push( @diags, $str );
}
};
find_weakened_cycle( $ref, $callback );
my $ok = !$cycle_no;
$Test->ok( $ok, $msg );
$Test->diag( join( "\n", @diags, "" ) ) unless $ok;
return $ok;
} # weakened_memory_cycle_ok
#line 189
sub weakened_memory_cycle_exists {
my $ref = shift;
my $msg = shift;
my $cycle_no = 0;
# Callback function that is called once for each memory cycle found.
my $callback = sub { $cycle_no++ };
find_weakened_cycle( $ref, $callback );
my $ok = $cycle_no;
$Test->ok( $ok, $msg );
return $ok;
} # weakened_memory_cycle_exists
my %shortnames;
my $new_shortname = "A";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/SExpression/Parser.pm view on Meta::CPAN
#line 9 "lib/Data/SExpression/Parser.yp"
use Data::SExpression::Cons;
use Scalar::Util qw(weaken);
sub new {
my($class)=shift;
ref($class)
lib/Data/SExpression/Parser.pm view on Meta::CPAN
sub set_handler {
my $self = shift;
my $handler = shift or die(__PACKAGE__ . "::set_handler called with 0 arguments");
$self->YYData->{HANDLER} = $handler;
weaken $self->YYData->{HANDLER};
}
sub handler {
my $self = shift;
return $self->YYData->{HANDLER};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/STUID/Generator.pm view on Meta::CPAN
$self->mutex( $mutex );
$self->shared_mem( $shm );
push @RESOURCE_GUARDS, (sub {
my $SELF = shift;
Scalar::Util::weaken($SELF);
_guard {
eval { $SELF->cleanup };
};
})->($self);
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
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/Data/Structure/Util.pm view on Meta::CPAN
false value.
If the version of perl that you are using supports weak references then
any weak references found within the data structure will not be
traversed, meaning that circular references that have had links
successfully weakened will not be returned by this function.
=item circular_off($ref)
Detects circular references in $ref (as above) and weakens a link in
each so that they can be properly garbage collected when no external
references to the data structure are left.
This means that one (or more) of the references in the data structure
will be told that the should not count towards reference counting. You
should be aware that if you later modify the data structure and leave
parts of it only 'accessible' via weakened references that those parts
of the data structure will be immediately garbage collected as the
weakened references will not be strong enough to maintain the connection
on their own.
The number of references weakened is returned.
=item get_refs($ref)
Examine the data structure and return a reference to flat array that
contains one copy of every reference in the data structure you passed.
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Test/More.pm view on Meta::CPAN
use Test::More tests => $Num_Tests;
There are rare cases when you will not know beforehand how many tests
your script is going to run. In this case, you can declare that you
have no plan. (Try to avoid using this as it weakens your test.)
use Test::More qw(no_plan);
In some cases, you'll want to completely skip an entire testing script.
view all matches for this distribution
view release on metacpan or search on metacpan
t/35-record-iterator.t view on Meta::CPAN
fields => ['a','b','c'],
log => $log
], 'TableReader' );
ok( $re->find_table, 'find_table' ) or die "Can't continue without table";
ok( my $i= $re->iterator, 'create iterator' );
Scalar::Util::weaken( my $wref= $i );
undef $i;
is( $wref, undef, 'first iterator garbage collected' );
ok( my $i2= $re->iterator, 'second interator' );
ok( my $i3= $re->iterator, 'third iterator' );
is( $i2->row, 1, 'i2 row=1' );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/TagDB.pm view on Meta::CPAN
use v5.10;
use strict;
use warnings;
use Scalar::Util qw(weaken blessed);
use Carp;
use DBI;
use Data::TagDB::Tag;
lib/Data/TagDB.pm view on Meta::CPAN
$self->_cache_maintain;
$done = 0;
}
$cache->{$dbid} = $tag;
weaken($cache->{$dbid});
return $tag;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Tie/Watch.pm view on Meta::CPAN
use 5.006;
use strict;
use warnings;
use Carp;
use Scalar::Util qw( reftype weaken );
our $VERSION = '1.302.2';
our %METHODS;
=head1 SYNOPSIS
lib/Data/Tie/Watch.pm view on Meta::CPAN
}
$watch_obj->{id} = "$watch_obj";
$watch_obj->{type} = $type;
# weaken $watch_obj->{-variable};
$watch_obj;
}
=head2 DESTROY
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
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
view release on metacpan or search on metacpan
lib/Data/URIID/Barcode.pm view on Meta::CPAN
use v5.16;
use strict;
use warnings;
use Carp;
use Scalar::Util qw(weaken);
our $VERSION = v0.17;
use parent 'Data::URIID::Base';
lib/Data/URIID/Barcode.pm view on Meta::CPAN
}
croak 'No type given' unless defined $opts{type};
croak 'No data given' unless defined $opts{data};
weaken($opts{extractor});
$self = bless \%opts, $pkg;
return $self;
}
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/Data/UUID/MT.pm view on Meta::CPAN
use Math::Random::MT::Auto;
use Scalar::Util 1.10 ();
use Time::HiRes ();
# track objects across threads for reseeding
my ($can_weaken, @objects);
$can_weaken = Scalar::Util->can('weaken');
sub CLONE { defined($_) && $_->reseed for @objects }
# HoH: $builders{$Config{uvsize}}{$version}
my %builders = (
'8' => {
lib/Data/UUID/MT.pm view on Meta::CPAN
bless $self, $class;
$self->{_iterator} = $self->_build_iterator;
if ($can_weaken) {
push @objects, $self;
Scalar::Util::weaken($objects[-1]);
}
return $self;
}
lib/Data/UUID/MT.pm view on Meta::CPAN
=head2 reseed
$ug->reseed;
Reseeds the internal pseudo-random number generator. This happens
automatically after a fork or thread creation (assuming Scalar::Util::weaken),
but may be called manually if desired for some reason.
Any arguments provided are passed to Math::Random::MT::Auto::srand() for
custom seeding.
lib/Data/UUID/MT.pm view on Meta::CPAN
Pseudo-random number generators used in generating UUIDs should be reseeded if
the process forks or if threads are created.
Data::UUID::MT checks if the process ID has changed before generating a UUID
and reseeds if necessary. If L<Scalar::Util> is installed and provides
C<weaken()>, Data::UUID::MT will also reseed its objects on thread creation.
Data::UUID::LibUUID will reseed on fork on Mac OSX.
I have not explored further whether other UUID generators are fork/thread safe.
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/Data/Validate/CSV/Cell.pm view on Meta::CPAN
requires '_chunk_for_key_string';
has raw_value => ( is => 'ro', isa => Str );
has row_number => ( is => 'ro', isa => Maybe[PositiveInt] );
has col_number => ( is => 'ro', isa => Maybe[PositiveInt] );
has row => ( is => 'ro', isa => Object, weaken => !!1 );
has col => ( is => 'ro', isa => Object, weaken => !!1, handles => ['datatype'] );
has _errors => (
is => 'lazy',
builder => sub { [] },
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Visitor.pm view on Meta::CPAN
package Data::Visitor; # git description: v0.31-4-g7498abb
use Moose;
# ABSTRACT: Visitor style traversal of Perl data structures
our $VERSION = '0.32';
use Scalar::Util qw/blessed refaddr reftype weaken isweak/;
use overload ();
use Symbol ();
use Tie::ToObject;
lib/Data/Visitor.pm view on Meta::CPAN
isa => "Bool",
is => "rw",
);
# currently broken
has weaken => (
isa => "Bool",
is => "rw",
default => 0,
);
lib/Data/Visitor.pm view on Meta::CPAN
foreach my $data ( @_ ) {
$self->trace( flow => visit => $data ) if DEBUG;
if ( my $refaddr = ref($data) && refaddr($data) ) { # only references need recursion checks
$seen_hash->{weak} ||= isweak($data) if $self->weaken;
if ( exists $seen_hash->{$refaddr} ) {
$self->trace( mapping => found_mapping => from => $data, to => $seen_hash->{$refaddr} ) if DEBUG;
push @ret, $self->visit_seen( $data, $seen_hash->{$refaddr} );
next;
lib/Data/Visitor.pm view on Meta::CPAN
if ( @weak_refs ) {
my %targets = map { refaddr($_) => 1 } @{ $self->{_seen} }{@weak_refs};
foreach my $value ( Data::Alias::deref($new) ) {
if ( ref $value and $targets{refaddr($value)}) {
push @{ $seen_hash->{weakened} ||= [] }, $value; # keep a ref around
weaken($value);
}
}
}
}
else {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/WeakMap/Key/Tie.pm view on Meta::CPAN
package Data::WeakMap::Key::Tie;
use 5.014;
use warnings FATAL => 'all';
use Scalar::Util 'weaken';
use Carp 'croak';
our $VERSION = "v0.0.4";
sub TIESCALAR {
my ($class, $weakmap, $key) = @_;
my $self = { weakmap => $weakmap, prop => "$key", key => $key };
weaken($self->{$_}) foreach qw/ weakmap key /;
bless $self, $class;
}
sub FETCH {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/XHash.pm view on Meta::CPAN
use Scalar::Util qw/blessed/;
our @EXPORT_OK = (qw/&xhash &xhashref &xh &xhn &xhr &xhrn/);
# XHash values are stored internally using a ring doubly-linked with
# unweakened references:
# {hash}{$key} => [$previous_link, $next_link, $value, $key]
=head1 NAME
Data::XHash - Extended, ordered hash (commonly known as an associative array
lib/Data/XHash.pm view on Meta::CPAN
sub CLEAR {
my ($this) = @_;
my $self = tied(%$this) || $this;
if ($self->{hash}) {
# Blow away unweakened refs before tossing the hash.
@$_ = () foreach (values %{$self->{hash}});
}
$self->{hash} = {};
delete $self->{tail};
delete $self->{iter};
view all matches for this distribution
view release on metacpan or search on metacpan
t/cache-clear-all.t view on Meta::CPAN
use DataLoader::Test qw(await);
use AnyEvent;
use Data::Dump qw(dump);
use Mojo::Promise;
use Scalar::Util qw(weaken);
use DataLoader;
subtest 'Complex cache behaviour via clear_all()', sub {
# The loader clears its cache as soon as the batch function is
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DataStore/CAS/FS.pm view on Meta::CPAN
# See if the directory contains this entry
if (defined (my $subent= $nodes->[-1]{dir}->get_entry($name))) {
$subnode= { dirent => $subent };
my $key= $self->case_insensitive? uc $name : $name;
# Weak reference, until _apply_overrides is called.
Scalar::Util::weaken( $nodes->[-1]{subtree}{$key}= $subnode );
}
}
# If we haven't found one, or if it is 0 (deleted), either create or die.
if (!$subnode) {
lib/DataStore/CAS/FS.pm view on Meta::CPAN
my ($self, $dir)= @_;
# Hold onto a strong reference for a while.
$self->{_recent}[ $self->{_recent_idx}++ ]= $dir;
$self->{_recent_idx}= 0 if $self->{_recent_idx} > @{$self->{_recent}};
# Index it using a weak reference.
Scalar::Util::weaken( $self->{_by_hash}{$dir->hash}= $dir );
# Now, a nifty hack: we attach an object to watch for the destriction of the
# directory. Lazy references will get rid of the dir object, but this cleans
# up our _by_hash index.
$dir->{'#DataStore::CAS::FS::DirCacheCleanup'}=
bless [ $self->{_by_hash}, $dir->hash ], 'DataStore::CAS::FS::DirCacheCleanup';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DataStructure/BTree/Node.pm view on Meta::CPAN
use utf8;
use feature ':5.24';
use feature 'signatures';
no warnings 'experimental::signatures';
use Scalar::Util qw(weaken);
sub new ($class, $tree, $value, $parent = undef, $left = undef, $right = undef) {
my $self = bless {
tree => $tree,
parent => $parent,
left => $left,
right => $right,
value => $value,
}, $class;
weaken($self->{tree});
return $self;
}
sub parent ($self) {
return $self->{parent};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Database/Async/Engine/PostgreSQL.pm view on Meta::CPAN
# and the user can decide whether SSL is mandatory or optional.
$stream = await $self->negotiate_ssl(
stream => $stream,
);
Scalar::Util::weaken($self->{stream} = $stream);
$self->outgoing->each(sub {
$log->tracef('Write bytes [%v02x]', $_);
$self->ready_for_query->set_string('');
$self->stream->write("$_");
return;
view all matches for this distribution
view release on metacpan or search on metacpan
sv_ref||5.015004|
sv_replace|||
sv_report_used|||
sv_resetpvn|||
sv_reset|||
sv_rvweaken||5.006000|
sv_sethek|||
sv_setiv_mg|5.004050||p
sv_setiv|||
sv_setnv_mg|5.006000||p
sv_setnv|||
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Database/Async.pm view on Meta::CPAN
=cut
async sub transaction {
my ($self, @args) = @_;
Scalar::Util::weaken(
$self->{transactions}[@{$self->{transactions}}] =
my $txn = Database::Async::Transaction->new(
database => $self,
@args
)
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