/usr/share/doc/libmodule-optional-perl/examples/Foo.pm is in libmodule-optional-perl 0.03-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 | Package Foo;
use strict;
=head1 NAME
Foo - Example of a module which can optionally use Params::Validate
=head1 SYNOPSYS
use Foo
my $obj=Foo->new('fred');
=head1 DESCRIPTION
This is an example of how you would write a module that optionally uses
Params::Validate. If the target machine has Params::Validate installed,
the user gets the benefit of full blown parameter validation.
If not, the code will still work, but callers may pass in unexpected data
types that cause the module to blow in unexpected ways,
=cut
use Params::Validate::Dummy qw();
use Module::Optional qw(Params::Validate :all);
sub new {
my $pkg = shift;
my %par = validate( @_, {
name => {
regex => qr/[:alpha:]+/,
type => SCALAR
}});
...
}
|