File: ManagerFactory.pm

package info (click to toggle)
libapache2-sitecontrol-perl 1.05-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, forky, sid, trixie
  • size: 208 kB
  • sloc: perl: 558; makefile: 7
file content (61 lines) | stat: -rw-r--r-- 1,148 bytes parent folder | download | duplicates (2)
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
package Apache2::SiteControl::ManagerFactory;

use 5.008;
use strict;
use warnings;
use Carp;
use Carp::Assert;

sub getPermissionManager
{
   croak "Attempt to call abstract method getPermissionManager";
}

1;

__END__

=head1 NAME

Apache2::SiteControl::ManagerFactory - An abstract base class to use as a
pattern for custom PermissionManager production.

=head1 DESCRIPTION

This package is a simple abstract base class. Use it as the base for creating
your instances of permission managers. For example,

package MyManagerFactory;

use strict;
use Apache2::SiteControl::ManagerFactory;

use base qw(Apache2::SiteControl::ManagerFactory);

our $manager;

sub getPermissionManager
{
   return $manager if(defined($manager) && $manager->isa(Apache2::SiteControl::ManagerFactory));

   $manager = new Apache2::SiteControl::PermissionManager;

   $manager->addRule(new XYZRule);
   $manager->addRule(new SomeOtherRule);

   return $manager;
}

1;

=head1 SEE ALSO

Apache2::SiteControl::PermissionManager, Apache::SiteControl::Rule

=head1 AUTHOR

This module was written by Tony Kay, E<lt>tkay@uoregon.eduE<gt>.

=head1 COPYRIGHT AND LICENSE

=cut