/usr/share/perl5/Class/MakeMethods/Evaled.pm is in libclass-makemethods-perl 1.01-4.
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 88 89 90 91 92 93 94 95 96 97 | =head1 NAME
Class::MakeMethods::Evaled - Make methods with simple string evals
=head1 SYNOPSIS
package MyObject;
use Class::MakeMethods::Evaled::Hash (
new => 'new',
scalar => [ 'foo', 'bar' ],
array => 'my_list',
hash => 'my_index',
);
=head1 DESCRIPTION
This document describes the various subclasses of Class::MakeMethods
included under the Evaled::* namespace, and the method types each
one provides.
The Evaled subclasses generate methods using a simple string templating mechanism and basic string evals.
=head2 Calling Conventions
When you C<use> this package, the method names you provide
as arguments cause subroutines to be generated and installed in
your module.
See L<Class::MakeMethods::Standard/"Calling Conventions"> for more information.
=head2 Declaration Syntax
To declare methods, pass in pairs of a method-type name followed
by one or more method names.
Valid method-type names for this package are listed in L<"METHOD
GENERATOR TYPES">.
See L<Class::MakeMethods::Standard/"Declaration Syntax"> and L<Class::MakeMethods::Standard/"Parameter Syntax"> for more information.
=cut
package Class::MakeMethods::Evaled;
$VERSION = 1.000;
use strict;
use Carp;
use Class::MakeMethods::Standard '-isasubclass';
use Class::MakeMethods::Utility::TextBuilder 'text_builder';
########################################################################
=head2 About Evaled Methods
=cut
sub evaled_methods {
my $class = shift;
my $template = shift;
my $package = $Class::MakeMethods::CONTEXT{TargetClass};
my @declarations = $class->_get_declarations( @_ );
my @code_chunks;
foreach my $method ( @declarations ) {
my $code = $template;
$code =~ s/__(\w+?)__/$method->{lc $1}/eg;
# my $code = text_builder( $template, {
# '__NAME__' => $method->{name},
# '__METHOD__{}' => $method,
# '__CONTEXT__{}' => $Class::MakeMethods::CONTEXT,
# } );
push @code_chunks, $code;
}
my $code = join( "\n", "package $package;", @code_chunks, "1;" );
eval $code;
$@ and Class::MakeMethods::_diagnostic('inst_eval_syntax', 'from eval', $@, $code);
return;
}
########################################################################
=head1 SEE ALSO
See L<Class::MakeMethods> for general information about this distribution.
For distribution, installation, support, copyright and license
information, see L<Class::MakeMethods::Docs::ReadMe>.
=cut
1;
|