This file is indexed.

/usr/share/perl5/Exporter/Declare/Export.pm is in libexporter-declare-perl 0.114-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
 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
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package Exporter::Declare::Export;
use strict;
use warnings;
use Carp qw/croak carp/;
use Scalar::Util qw/reftype/;

our %OBJECT_DATA;

sub required_specs {qw/ exported_by /}

sub new {
    my $class = shift;
    my ( $item, %specs ) = @_;
    my $self = bless( $item, $class );

    for my $prop ( $self->required_specs ) {
        croak "You must specify $prop when calling $class\->new()"
            unless $specs{$prop};
    }

    $OBJECT_DATA{$self} = \%specs;

    return $self;
}

sub _data {
    my $self = shift;
    ($OBJECT_DATA{$self}) = @_ if @_;
    $OBJECT_DATA{$self};
}

sub exported_by {
    shift->_data->{ exported_by };
}

sub inject {
    my $self = shift;
    my ( $class, $name, @args ) = @_;

    carp(
        "Ignoring arguments importing ("
        . reftype($self)
        . ")$name into $class: "
        . join( ', ', @args )
    ) if (@args);

    croak "You must provide a class and name to inject()"
        unless $class && $name;
    no strict 'refs';
    no warnings 'once';
    *{"$class\::$name"} = $self;
}

sub DESTROY {
    my $self = shift;
    delete $OBJECT_DATA{$self};
}

1;

=head1 NAME

Exporter::Declare::Export - Base class for all export objects.

=head1 DESCRIPTION

All exports are refs, and all are blessed. This class tracks some per-export
information via an inside-out objects system. All things an export may need to
do, such as inject itself into a package are handled here. This allows some
complicated, or ugly logic to be abstracted out of the exporter and metadata
classes.

=head1 METHODS

=over

=item $class->new( $ref, exported_by => $package, %data )

Create a new export from $ref. You must specify the name of the class doing the
exporting.

=item $export->inject( $package, $name, @args )

This will inject the export into $package under $name. @args are ignored in
most cases. See L<Exporter::Declare::Export::Generator> for an example where
they are used.

=item $package = $export->exported_by()

Returns the name of the package from which this export was originally exported.

=item @params = $export->required_specs()

Documented for subclassing purposes. This should always return a list of
required parameters at construction time.

=item $export->DESTROY()

Documented for subclassing purposes. This takes care of cleanup related to
storing data in an inside-out objects system.

=back

=head1 AUTHORS

Chad Granum L<exodist7@gmail.com>

=head1 COPYRIGHT

Copyright (C) 2010 Chad Granum

Exporter-Declare is free software; Standard perl licence.

Exporter-Declare is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the license for more details.