SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

 
 

perl-Sub-Trigger-Lock rpm build for : OpenSuSE. For other distributions click perl-Sub-Trigger-Lock.

Name : perl-Sub-Trigger-Lock
Version : 0.002 Vendor : obs://build_opensuse_org/devel:languages:perl
Release : lp154.1.1 Date : 2023-01-27 18:04:23
Group : Development/Libraries/Perl Source RPM : perl-Sub-Trigger-Lock-0.002-lp154.1.1.src.rpm
Size : 0.04 MB
Packager : https://www_suse_com/
Summary : Coderef for Use in Moose Triggers That Will Lock Hashrefs and Arrayrefs
Description :
This module provides two constants, \'Lock\' and \'RO\'. The first of these is
the only one exported by default, and the key to understanding this module.
This module also provides the utility functions \'lock\' and \'unlock\', which
are not exported by default.

* \'Lock\'

\'Lock\' is a constant which evaluates to a coderef. The coderef takes two
or more arguments. That is, \'Lock\' itself takes no arguments; it returns
a coderef that takes arguments!

The first argument is supposed to be a blessed object, but it is actually
completely ignored.

If the second argument is not a hashref or arrayref, it is also ignored.
Everything is ignored! But if the second argument _is_ a hashref or
arrayref, it will be flagged as read-only.

This is a fairly shallow read-only flag. Attempts to add or remove keys
from the hash, or change the value for any key will throw an exception.
But if the value is reference to some other structure, that structure
will be unaffected.

Similarly, attempts to push, pop, shift, or unshift a read-only array, or
to change the value for any index will throw an exception. Buf if the
values are references to other structures, these will also be unaffected.

Overall, the effect of \'Lock\' is that you can do something like this:

package Person {
use Moose;

has name => (is => \'ro\', writer => \'set_name\');
}

package Band {
use Moose;
use Sub::Trigger::Lock;

has members => (is => \'ro\', trigger => Lock);
}

my $spice_girls = Band->new(
members => [
Person->new(name => \'Victoria Adams\'),
Person->new(name => \'Melanie Brown\'),
Person->new(name => \'Emma Bunton\'),
Person->new(name => \'Melanie Chisholm\'),
Person->new(name => \'Geri Halliwell\'),
],
);


$spice_girls->members->[0]->set_name(\'Victoria Beckham\');


$spice_girls->members->[0] = Person->new(name => \'Johnny Cash\');

* \'RO\'

\'RO\' is a constant that evaluates to the list:

\'ro\', \'trigger\', Lock,

* \'lock($ref)\'

A utility function for locking an arrayref or hashref in the same way
that the \'Lock\' coderef would.

* \'unlock($ref)\'

A utility function for unlocking an arrayref or hashref.

Note that this returns a _guard object_. You should store this object in
a variable. Once the object is destroyed (e.g. because the variable has
gone out of scope), \'$ref\' will be automatically locked again!

This allows you to temporarily unlock a hashref or arrayref in order to
privately manipulate it:

package Band {
use Moose;
use Sub::Trigger::Lock qw( Lock unlock );

has members => (is => \'ro\', trigger => Lock);

sub add_members {
my ($self, AATTmembers) = AATT_;
my $guard = unlock( $self->members );
push AATT{$self->members}, AATTmembers;
}
}

RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-S/15.4/noarch

Content of RPM  Provides Requires

Download
ftp.icm.edu.pl  perl-Sub-Trigger-Lock-0.002-lp154.1.1.noarch.rpm
     

Provides :
perl(Sub::Trigger::Lock)
perl-Sub-Trigger-Lock

Requires :
perl(:MODULE_COMPAT_5.26.1)
perl(Exporter::Tiny)
perl(Scope::Guard)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1


Content of RPM :
/usr/lib/perl5/vendor_perl/5.26.1/Sub
/usr/lib/perl5/vendor_perl/5.26.1/Sub/Trigger
/usr/lib/perl5/vendor_perl/5.26.1/Sub/Trigger/Lock.pm
/usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi
/usr/share/doc/packages/perl-Sub-Trigger-Lock
/usr/share/doc/packages/perl-Sub-Trigger-Lock/CONTRIBUTING
/usr/share/doc/packages/perl-Sub-Trigger-Lock/COPYRIGHT
/usr/share/doc/packages/perl-Sub-Trigger-Lock/CREDITS
/usr/share/doc/packages/perl-Sub-Trigger-Lock/Changes
/usr/share/doc/packages/perl-Sub-Trigger-Lock/LICENSE
/usr/share/doc/packages/perl-Sub-Trigger-Lock/README
/usr/share/doc/packages/perl-Sub-Trigger-Lock/doap.ttl
/usr/share/man/man3/Sub::Trigger::Lock.3pm.gz

 
ICM