This file is indexed.

/usr/share/perl5/Poet/Manual/Subclassing.pod is in libpoet-perl 0.16-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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
__END__

=pod

=head1 NAME

Poet::Manual::Subclassing - Customizing Poet with subclasses

=head1 DESCRIPTION

You can subclass the following Poet classes for your application:

    Poet::Cache
    Poet::Conf
    Poet::Log
    Poet::Mason
    Poet::Import
    Poet::Plack::Request
    Poet::Plack::Response

and arrange things so that Poet always uses your subclass instead of its
default class.

Place Poet subclasses under C<lib/MyApp/Class.pm> in your environment, where
C<MyApp> is your app name and C<Class> is the class you are subclassing minus
the C<Poet> prefix. A few of these subclasses are generated for you by C<poet
new>.

For example, to subclass C<Poet::Cache>:

    package MyApp::Cache;
    use Poet::Moose;
    extends 'Poet::Cache';

    # put your modifications here

    1;

(Note: L<Poet::Moose|Poet::Moose> is Moose plus a few Poet standards. You could
also use plain C<Moose> here.)

Poet will automatically detect, load and use any such subclasses. Internally it
uses the L<app_class|Poet::Environment/app_class> environment method whenever
it needs a classname, e.g.

    # Do something with MyApp::Cache or Poet::Cache
    $poet->app_class('Cache')->...

=head2 Subclassing Mason

As long as you have even a bare-bones C<Poet::Mason> subclass, e.g.

    package MyApp::Mason;
    use Poet::Moose;
    extends 'Poet::Mason';

    1;

then your Mason subclasses will be autodetected as well, e.g.

    package MyApp::Mason::Interp;
    use Moose;
    extends 'Mason::Interp';
    # put your modifications here
    1;

C<poet new> will create the bare-bones subclass for you; it is otherwise
harmless.

See L<Mason::Manual::Subclasses|Mason::Manual::Subclasses> for more
information.

=head1 EXAMPLES

=head2 Use INI instead of YAML for config files

    package MyApp::Conf;
    use Config::INI;
    use Moose;
    extends 'Poet::Conf';

    override 'read_conf_file' => sub {
        my ($self, $file) = @_;
        return Config::INI::Reader->read_file($file);
    };

=head2 Perform tasks before and after each Mason request

    package MyApp::Mason::Request;
    use Moose;
    extends 'Mason::Request';

    override 'run' => sub {
        my $self = shift;

        # Perform tasks before request
        my $result = super();
        # Perform tasks after request

        return $result;
    };

=head2 Add Perl code to the top of every compiled component

    package MyApp::Mason::Compilation;
    use Moose;
    extends 'Mason::Compilation';

    override 'output_class_header' => sub {
         return join("\n", super(), 'use Foo;', 'use Bar qw(baz);');
    };

=head2 Use Log::Dispatch instead of Log4perl for logging

    package MyApp::Log;
    use Log::Any::Adapter;
    use Log::Dispatch;
    use Moose;
    extends 'Poet::Log';

    override 'initialize_logging' => sub {
        my $log = Log::Dispatch->new( ... );
        Log::Any::Adapter->set('Dispatch', dispatcher => $log);
    };

=head2 Add your own $dbh quick var

    package MyApp::Import
    use DBI;
    use Poet::Moose;
    extends 'Poet::Import';
    
    method provide_dbh ($caller, $poet) {
        $dbh = DBI->connect(...);
    }

=head1 SEE ALSO

L<Poet|Poet>

=head1 AUTHOR

Jonathan Swartz <swartz@pobox.com>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Jonathan Swartz.

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

=cut