/usr/share/perl5/perl5i/2/Signature.pm is in libperl5i-perl 2.13.2-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 | package perl5i::2::Signature;
use 5.010_000;
use strict;
use warnings;
use perl5i::2::Signature::Method::None;
use perl5i::2::Signature::Function::None;
# A proxy class to hold a method's signature until its actually used.
use overload
q[""] => sub { return $_[0]->as_string },
fallback => 1
;
sub new {
my $class = shift;
my %args = @_;
my $string = $args{signature} // '';
my $is_method = $args{is_method} // 0;
my $no_params = !$string || $string !~ /\S/;
if( $no_params ) {
return $is_method ? perl5i::2::Signature::Method::None->new( signature => $string )
: perl5i::2::Signature::Function::None->new( signature => $string );
}
else {
return bless { signature => $string, is_method => $is_method }, $class;
}
}
sub as_string {
my $self = shift;
return $self->{signature};
}
sub make_real {
my $self = shift;
require perl5i::2::Signature::Real;
bless $self, "perl5i::2::Signature::Real";
$self->__parse_signature;
}
# Upgrade to a real signature object
# and call the original method.
# This should only be called once per object.
our $AUTOLOAD;
sub AUTOLOAD {
my($method) = reverse split /::/, $AUTOLOAD;
return if $method eq 'DESTROY';
my $self = $_[0]; # leave @_ alone
# Upgrade to a real object
$self->make_real;
goto $self->can($method);
}
1;
|