/usr/share/perl5/MooseX/LazyRequire/Meta/Attribute/Trait/LazyRequire.pm is in libmoosex-lazyrequire-perl 0.10-1.
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 | package MooseX::LazyRequire::Meta::Attribute::Trait::LazyRequire;
BEGIN {
$MooseX::LazyRequire::Meta::Attribute::Trait::LazyRequire::AUTHORITY = 'cpan:FLORA';
}
{
$MooseX::LazyRequire::Meta::Attribute::Trait::LazyRequire::VERSION = '0.10';
}
# ABSTRACT: Attribute trait to make getters fail on unset attributes
use Moose::Role;
use Carp qw/cluck/;
use namespace::autoclean;
has lazy_required => (
is => 'ro',
isa => 'Bool',
default => 0,
);
after _process_options => sub {
my ($class, $name, $options) = @_;
if (exists $options->{lazy_require}) {
cluck "deprecated option 'lazy_require' used. use 'lazy_required' instead.";
$options->{lazy_required} = delete $options->{lazy_require};
}
return unless $options->{lazy_required};
# lazy_required + default or builder doesn't make sense because if there
# is a default/builder, the reader will always be able to return a value.
Moose->throw_error(
"You may not use both a builder or a default and lazy_required for one attribute ($name)",
data => $options,
) if $options->{builder} or $options->{default};
$options->{ lazy } = 1;
$options->{ required } = 1;
$options->{ default } = sub {
confess "Attribute '$name' must be provided before calling reader"
};
};
package # hide
Moose::Meta::Attribute::Custom::Trait::LazyRequire;
sub register_implementation { 'MooseX::LazyRequire::Meta::Attribute::Trait::LazyRequire' }
1;
__END__
=pod
=encoding utf-8
=head1 NAME
MooseX::LazyRequire::Meta::Attribute::Trait::LazyRequire - Attribute trait to make getters fail on unset attributes
=head1 AUTHORS
=over 4
=item *
Florian Ragwitz <rafl@debian.org>
=item *
Dave Rolsky <autarch@urth.org>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Florian Ragwitz.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|