view release on metacpan or search on metacpan
lib/Data/IconText.pm view on Meta::CPAN
use v5.20;
use strict;
use warnings;
use Carp;
use Scalar::Util qw(looks_like_number weaken);
use Data::Identifier v0.12;
use constant {
WK_UNICODE_CP => Data::Identifier->new(uuid => '5f167223-cc9c-4b2f-9928-9fe1b253b560')->register, # unicode-code-point
WK_ASCII_CP => Data::Identifier->new(uuid => 'f4b073ff-0b53-4034-b4e4-4affe5caf72c')->register, # ascii-code-point
lib/Data/IconText.pm view on Meta::CPAN
my $v = delete $opts{$key};
next unless defined $v;
croak 'Invalid type for key: '.$key unless eval {$v->isa($_types{$key})};
$self->{$key} //= $v;
croak 'Missmatch for key: '.$key unless $self->{$key} == $v;
weaken($self->{$key}) if $weak;
}
croak 'Stray options passed' if scalar keys %opts;
return $self;
lib/Data/IconText.pm view on Meta::CPAN
A L<File::FStore> object.
=item C<weak>
Marks the value for all subobjects as weak.
If only a specific one needs needs to be weaken use L</attach>.
=back
=head2 unicode
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Identifier/Interface/Subobjects.pm view on Meta::CPAN
use warnings;
use parent 'Data::Identifier::Interface::Userdata';
use Carp;
use Scalar::Util qw(weaken);
our $VERSION = v0.31;
my %_types = (
db => 'Data::TagDB',
lib/Data/Identifier/Interface/Subobjects.pm view on Meta::CPAN
my $v = delete $opts{$key};
next unless defined $v;
croak 'Invalid type for key: '.$key unless eval {$v->isa($_types{$key})};
$storage->{$key} //= $v;
croak 'Missmatch for key: '.$key unless $storage->{$key} == $v;
weaken($storage->{$key}) if $weak;
}
croak 'Stray options passed' if scalar keys %opts;
return $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
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/Data/Monad/Base/Monad.pm view on Meta::CPAN
sub ap { (ref $_[0])->map_multi(sub { my $c = shift; $c->(@_) } => @_) }
sub while {
my ($self, $predicate, $f) = @_;
my $weaken_loop;
my $loop = sub {
my @v = @_;
$predicate->(@v) ? $f->(@v)->flat_map($weaken_loop)
: (ref $self)->unit(@v);
};
Scalar::Util::weaken($weaken_loop = $loop);
$self->flat_map($loop);
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Morph/Backend/DBIC.pm view on Meta::CPAN
use MooseX::Types::Moose(':all');
use MooseX::Params::Validate;
use Devel::PartialDump('dump');
use namespace::autoclean;
use DBIx::Class;
use Scalar::Util('weaken');
has result_set =>
(
is => 'ro',
lib/Data/Morph/Backend/DBIC.pm view on Meta::CPAN
sub _build_new_instance
{
my ($self) = @_;
weaken($self);
return sub { $self->result_set->new_result({}) };
}
sub epilogue
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/MuForm/Field.pm view on Meta::CPAN
package Data::MuForm::Field;
# ABSTRACT: Base field package
use Moo;
use Types::Standard -types;
use Try::Tiny;
use Scalar::Util ('blessed', 'weaken');
use Data::Clone ('data_clone');
use Data::MuForm::Localizer;
use Data::MuForm::Merge ('merge');
with 'Data::MuForm::Common';
lib/Data/MuForm/Field.pm view on Meta::CPAN
sub BUILD {
my $self = shift;
if ( $self->form ) {
# To avoid memory cycles it needs to be weakened when
# it's set through a form.
weaken($self->{localizer});
weaken($self->{renderer});
}
else {
# Vivify. This would generally only happen in a standalone field, in tests.
$self->localizer;
$self->renderer;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Munge.pm view on Meta::CPAN
sub rec (&) {
my ($f) = @_;
sub { $f->(CORE::__SUB__, @_) }
}
EOT
} elsif (eval { require Scalar::Util } && defined &Scalar::Util::weaken) {
*rec = sub (&) {
my ($f) = @_;
my $w;
my $r = $w = sub { $f->($w, @_) };
Scalar::Util::weaken($w);
$r
};
} else {
# slow but always works
*rec = sub (&) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Object/Attributes.pm view on Meta::CPAN
};
my $example = Example::HasWkr->new(data => $data);
This package supports the C<wkr> and C<weak_ref> directives is used to denote if
the attribute's value should be weakened. See the L<Moo> documentation for more
details.
=cut
=head2 has-wrt
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/ObjectDriver/BaseObject.pm view on Meta::CPAN
package Data::ObjectDriver::BaseObject;
use strict;
use warnings;
our $HasWeaken;
eval q{ use Scalar::Util qw(weaken) }; ## no critic
$HasWeaken = !$@;
use Carp ();
use Class::Trigger qw( pre_save post_save post_load pre_search
lib/Data/ObjectDriver/BaseObject.pm view on Meta::CPAN
## Hold in a variable here too, so we don't lose it immediately
## by having only the weak reference.
my $ret = $parentclass->lookup($id);
if ($HasWeaken) {
$obj->{$cachekey} = $ret;
weaken($obj->{$cachekey});
}
return $ret;
};
} else {
if (ref($column)) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/ObjectStore.pm view on Meta::CPAN
no warnings 'numeric';
no warnings 'uninitialized';
no warnings 'recursion';
use File::Path qw( make_path );
use Scalar::Util qw(weaken);
use Time::HiRes qw(time);
use vars qw($VERSION);
use Data::RecordStore;
use Data::ObjectStore::Cache;
lib/Data/ObjectStore.pm view on Meta::CPAN
$self->[CACHE]->stow( $id, $ref );
}
$self->[WEAK]{$id} = $ref;
weaken( $self->[WEAK]{$id} );
} #_store_weak
sub _dirty {
my( $self, $id ) = @_;
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
share/dictionary.txt 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
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/Password/zxcvbn/RankedDictionaries/English.pm view on Meta::CPAN
'waves' => 3107,
'wayans' => 28057,
'waynesboro' => 26682,
'wazir' => 23336,
'waziristan' => 22378,
'weakened' => 4878,
'weakening' => 8805,
'weakens' => 26179,
'weakly' => 12115,
'weald' => 17491,
'wealth' => 2748,
'wealthier' => 15310,
'wealthiest' => 9979,
lib/Data/Password/zxcvbn/RankedDictionaries/English.pm view on Meta::CPAN
'we\'d' => 554,
'we\'ll' => 159,
'we\'re' => 77,
'we\'ve' => 226,
'weak' => 1301,
'weaken' => 7596,
'weaker' => 6329,
'weakest' => 8826,
'weakling' => 14449,
'weakness' => 2777,
'weaknesses' => 5595,
view all matches for this distribution
view release on metacpan or search on metacpan
use strict;
use warnings;
use Test::More;
use Test::LeakTrace;
use Scalar::Util qw(weaken isweak);
use Data::Path::XS qw(
path_get path_set path_delete path_exists
patha_get patha_set
);
};
subtest 'weak references propagate as the underlying ref' => sub {
my $target = { val => 42 };
my $d = { weak => $target };
weaken $d->{weak};
ok(isweak($d->{weak}), 'sanity: weak flag set');
is(path_get($d, '/weak/val'), 42, 'path_get follows weak ref');
# path_get must NOT strengthen the ref
ok(isweak($d->{weak}), 'weak flag preserved after path_get');
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
examples/try_me.pl view on Meta::CPAN
#!/usr/bin/env perl
use strict;
use warnings;
use Scalar::Util qw(weaken);
# This sample code is available to you so you
# can see Data::Printer working out of the box.
# It can be used as a quick way to test your
# color palette scheme!
examples/try_me.pl view on Meta::CPAN
class => $obj,
};
$sample->{weakref} = $sample;
weaken $sample->{weakref};
BEGIN { $ENV{DATAPRINTERRC} = '' }; # <-- skip user's .dataprinter
use DDP show_memsize => 1,
show_refcount => 1,
view all matches for this distribution
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/Random/dict view on Meta::CPAN
ways
wayside
wayward
we
weak
weaken
weakened
weakening
weakens
weaker
weakest
weakly
weakness
weaknesses
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
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
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