This file is indexed.

/usr/share/perl5/Class/Trait/Base.pm is in libclass-trait-perl 0.31-4.

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
package Class::Trait::Base;

use strict;
use warnings;
require Class::Trait;

our $VERSION = '0.31';

sub apply {
    my ($trait, $instance) = @_;
    Class::Trait->apply($instance, $trait);
    return $trait;
}

# all that is here is an AUTOLOAD method which is used to fix the SUPER call
# method resolution problem introduced when a trait calls a method in a SUPER
# class since SUPER should be bound after the trait is flattened and not
# before.

sub AUTOLOAD {
    my $auto_load = our $AUTOLOAD;

    # we dont want to mess with DESTORY
    return if ( $auto_load =~ m/DESTROY/ );

    # if someone is attempting a call to
    # SUPER, then we need to handle this.
    if ( my ($super_method) = $auto_load =~ /(SUPER::.*)/ ) {

        # get our arguemnts
        my ( $self, @args ) = @_;

        # lets get the intended method name
        $super_method = scalar( caller 1 ) . '::' . $super_method;
        return $self->$super_method(@args);
    }

    # if it was not a call to SUPER, then
    # we need to let this fail, as it is
    # not our problem
    die "undefined method ($auto_load) in trait\n";
}

1;

__END__

=head1 NAME

Class::Trait::Base - Base class for all Traits

=head1 SYNOPSIS

This class needs to be inherited by all traits so they can be identified as
traits.

	use Class::Trait 'base';

=head1 DESCRIPTION

Not much going on here, just an AUTOLOAD method to help properly dispatch
calls to C<SUPER::> and an C<apply> method.


=head2 apply

  require TSomeTrait;
  TSomeTrait->apply($object);

This method allows you to apply a trait to an object.  It returns the trait so
you can then reapply it:

 TTricks->apply($dog_object)
        ->apply($cat_object);

This is merely syntactic sugar for the C<Class::Trait::apply> method:

 Class::Trait->apply($dog_object, 'TTricks');
 Class::Trait->apply($cat_object, 'TTricks');

=cut

=head1 SEE ALSO

B<Class::Trait>, B<Class::Trait::Config>

=head1 MAINTAINER

Curtis "Ovid" Poe, C<< <ovid [at] cpan [dot] org> >>

=head1 AUTHOR

Stevan Little E<lt>stevan@iinteractive.comE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright 2004, 2005 by Infinity Interactive, Inc.

L<http://www.iinteractive.com> 

This library is free software; you can redistribute it and/or modify it under
the same terms as Perl itself. 

=cut