/usr/share/perl5/Petal/Utils/Base.pm is in libpetal-utils-perl 0.06-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 | package Petal::Utils::Base;
#rename: package Petal::Plugin; ?
use strict;
use warnings::register;
use Carp;
our $VERSION = ((require Petal::Utils), $Petal::Utils::VERSION)[1];
our $REVISION = (split(/ /, ' $Revision: 1.5 $ '))[2];
## Define the enclosed packages inside the Petal Modifiers hash
sub install {
my $class = shift;
foreach my $name ($class->name, $class->aliases) {
$Petal::Hash::MODIFIERS->{"$name:"} = $class;
}
return $class;
}
sub process {
my $class = shift;
confess( "$class does not override process()" );
}
sub name {
my $class = shift;
confess( "$class does not override name()" );
}
sub aliases {
my $class = shift;
confess( "$class does not override aliases()" );
}
sub split_first_arg {
my $class = shift;
my $args = shift;
# don't use split(/\s/,...) as we might kill an expression that way
return ($args =~ /\A(.+?)\s+(.*)\z/);
}
# Return a list of all arguments as an array - does not perform expansion on
# embedded modifiers
sub split_args {
my $class = shift;
my ($args) = @_;
# W. Smith's regex
return ($args =~ /('[^']+'|\S+)/g);
}
# Returns an argument from the data hash as a string/object or as a plaintext
# if arg is surrounded by single quotes or a number (decimal points OK)
# Arguments:
# $hash - reference to the Petal data hash
# $arg - the argument
sub fetch_arg {
my $class = shift;
my ($hash, $arg) = @_;
return undef unless defined($arg);
if($arg =~ /\'/) {
$arg =~ s/\'//g;
return $arg;
}
elsif($arg =~ /^[0-9.]+$/) {
return $arg;
}
else {
#warn "Returning hash key for $arg";
return $hash->fetch($arg);
}
}
1;
|