line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DesignPattern::Factory::Product; |
2
|
|
|
|
|
|
|
$VERSION = '0.01'; |
3
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
103
|
|
4
|
3
|
|
|
3
|
|
17
|
use Carp; # nice errors |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
220
|
|
5
|
3
|
|
|
3
|
|
15
|
use vars qw( $VERSION ); |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
260
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# constructor |
8
|
|
|
|
|
|
|
sub new |
9
|
|
|
|
|
|
|
{ |
10
|
1
|
|
|
1
|
1
|
3
|
my $class = shift; |
11
|
1
|
|
|
|
|
13
|
return bless {}, $class; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
1; |
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
DesignPattern::Factory::Product - a participant in the Perl implementation of the Factory Method. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
DesignPattern::Factory::Product is the superclass of DesignPattern::Factory::ConcreteProduct. That is, ConcreteProduct inherits all methods from Product, but can override these methods by implementing its own methods. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
DesignPattern::Factory::Product defines the interface of objects the factory method creates. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 new() |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Constructor for this class. Usage: |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $object = DesignPattern::Factory::Product->new(); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 AUTHOR |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Nigel Wetters (nwetters@cpan.org) |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 COPYRIGHT |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Copyright (c) 2001, Nigel Wetters. All Rights Reserved. This module is free software. |
38
|
|
|
|
|
|
|
It may be used, redistributed and/or modified under the same terms as Perl itself. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |