/usr/share/perl5/Petal/Hash/Test.pm is in libpetal-perl 2.23-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 88 89 90 91 92 93 | =head1 NAME
Petal::Hash::Test - Test and Tutorial Petal modifier
=head1 SUMMARY
Petal modifiers are snippets of code which are used to extend the
expression engine capabilities. This test shows how to write your
own modifiers.
=head1 API
The modifier API is very, very simple. It consists of two elements:
=head2 The package name
Your modifier should be called Petal::Hash::<SomeThing>, where <SomeThing>
is the name that you want to give to your modifier.
For example, this modifier is called Petal::Hash::Test. Petal will
automatically pick it the module up and assign it the 'test:' prefix.
package Petal::Hash::Test;
use warnings;
use strict;
=cut
package Petal::Hash::Test;
use warnings;
use strict;
=head2 The method $class->process ($hash, $argument);
This class method will define the modifier in itself.
* $class is the package name of your modifier (which might come in
handy if you're subclassing a modifier),
* $hash is the execution context, i.e. the objects and data which
will 'fill' your template,
* $argument is whatever was after your modifier's prefix. For example,
for the expression 'test:foo bar', $argument would be 'foo bar'.
In this test / tutorial we're going to write a modifier which
uppercases a Petal expression.
sub process
{
my $class = shift;
my $hash = shift;
my $argument = shift;
return uc ($hash->get ($argument));
}
1;
__END__
And that's it! Simple!
=cut
sub process
{
my $class = shift;
my $hash = shift;
my $argument = shift;
return uc ($hash->get ($argument));
}
1;
__END__
=head1 AUTHOR
Jean-Michel Hiver
This module is redistributed under the same license as Perl itself.
=head1 SEE ALSO
The template hash module:
Petal::Hash
=cut
|