Declare/Meta/Slot.pm

filter: Statementstmt 94.1% 16 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod n/a totaltotal 91.6% 22 / 24 CC 1 SCAR 1.3
CC
1
Cov
94%
_compile
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Declare/Object.pm ↑ Summary Declare/Meta/Attribute.pm »
1 package POE::Declare::Meta::Slot;
2  
3 =pod
4  
5 =head1 NAME
6  
7 POE::Declare::Meta::Slot - Abstract base class for named class elements
8  
9 =head1 DESCRIPTION
10  
11 In L<POE::Declare>, each class is a simple controlled structure with a set
12 of named elements within it, known as "slots".
13  
14 Each slot uniquely occupies a name (just like in a HASH) except that in the
15 L<POE::Declare> model, that name is reserved across all resources (the
16 method name, the HASH key, and in some cases certain method names below the
17 root name as well).
18  
19 For example, a slot named "foo" of type C<Param> will consume the HASH key
20 "foo", have an accessor method "foo", and take a "foo" parameter in the
21 object constructor.
22  
23 A slot named "mytimeout" filled with a C<Timeout> will consume the
24 "mytimeout" HASH key, and may have methods such as C<mytimeout_alarm>,
25 C<mytimeout_keepalive> and C<mytimeout_clear>.
26  
27 =head1 METHODS
28  
29 =head2 new
30  
31 # You cannot create a Slot directly
32 my $object = POE::Declare::Meta::Attribute->new(
33 name => 'foo',
34 );
35  
36 The default slot constructor takes a list of named parameters, and creates
37 a C<HASH>-based object using them. The default implementation does not
38 check its parameters, as it expects them to be provided by other functions
39 which themselves will have already checked params.
40  
41 =cut
42  
43 7 ▶use 5.008007;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
45 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
46  
47 7 ▶use vars qw{$VERSION};
Subroutine BEGIN: called CC=1 SCAR=0.0
48 BEGIN {
49 7 ▶ $VERSION = '0.23_01';
Subroutine BEGIN: called CC=1 SCAR=0.0
50 }
51  
52 use Class::XSAccessor
53 7 constructor => 'new',
54 getters => {
55 name => 'name',
56 7 ▶ };
Subroutine BEGIN: called CC=1 SCAR=0.0
57  
58 # By default, a slot contains nothing
59 0 ▶sub _compile { '' }
Subroutine _compile: not called CC=1 SCAR=6.9
60  
61 7 1;
62  
63 =pod
64  
65 =head1 SUPPORT
66  
67 Bugs should be always be reported via the CPAN bug tracker at
68  
69 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE-Declare>
70  
71 For other issues, or commercial enhancement or support, contact the author.
72  
73 =head1 AUTHORS
74  
75 Adam Kennedy E<lt>adamk@cpan.orgE<gt>
76  
77 =head1 SEE ALSO
78  
79 L<POE>, L<POE::Declare>
80  
81 =head1 COPYRIGHT
82  
83 Copyright 2006 - 2009 Adam Kennedy.
84  
85 This program is free software; you can redistribute
86 it and/or modify it under the same terms as Perl itself.
87  
88 The full text of the license can be found in the
89 LICENSE file included with this module.
90  
91 =cut
« Declare/Object.pm ↑ Summary Declare/Meta/Attribute.pm »