/usr/share/perl5/MooX/Role/CloneSet.pm is in libmoox-role-cloneset-perl 0.1.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | package MooX::Role::CloneSet;
use 5.012;
use strict;
use warnings;
use version; our $VERSION = version->declare("v0.1.0");
use Moo::Role;
use namespace::clean;
sub cset($ %)
{
my ($self, %new) = @_;
# Hmm, so Moo doesn't have metaclasses, right?
return $self->new(%{$self}, %new);
}
1;
__END__
=encoding utf-8
=head1 NAME
MooX::Role::CloneSet - create updated copies of immutable objects
=head1 SYNOPSIS
package Someone;
use Moo;
with 'MooX::Role::CloneSet';
has name => (
is => 'ro',
);
has race => (
is => 'ro',
);
package main;
my $first = Someone->new(name => 'Drizzt', race => 'drow');
my $hybrid = $first->cset(race => 'dwarf');
my $final = $weird->cset(name => 'Catti-brie', race => 'human');
=head1 DESCRIPTION
C<MooX::Role::CloneSet> is a role for immutable objects, providing an easy
way to create a new object with some modified properties. It provides
the C<cset()> method that creates a new object with the specified changes,
shallowly copying all the rest of the original object's properties.
=head1 METHODS
=over 4
=item * cset(field => value, ...)
Shallowly clone the object, making the specified changes to its attributes.
Note that this method obtains the names and values of the current attributes
by dereferencing the object as a hash reference; since Moo does not provide
metaclasses by default, it cannot really get to them in any other way.
This will not work for parameters that declare an C<init_arg>; see
C<MooX::Role::CloneSet::BuildArgs> for an alternative if using truly
immutable objects.
=back
=head1 LICENSE
Copyright (C) 2016 Peter Pentchev E<lt>roam@ringlet.netE<gt>
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 AUTHOR
Peter Pentchev E<lt>roam@ringlet.netE<gt>
=cut
|