blib/lib/Statocles/Link/Tree.pm

filter: Statementstmt 100% 8 / 8 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 10 / 10 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
__ANON__
1.0
CRAP 1.0
« blib/lib/Statocles/Event.pm ↑ Summary blib/lib/Statocles/Page/Plain.pm »
1 package Statocles::Link::Tree;
2 101 our $VERSION = '0.099';
3 # ABSTRACT: A link object with child links, making a tree
4  
5 #pod =head1 SYNOPSIS
6 #pod
7 #pod my $link = Statocles::Link::Tree->new(
8 #pod href => '/',
9 #pod text => 'Home',
10 #pod children => [
11 #pod {
12 #pod href => '/blog',
13 #pod text => 'Blog',
14 #pod },
15 #pod {
16 #pod href => '/projects',
17 #pod text => 'Projects',
18 #pod },
19 #pod ],
20 #pod );
21 #pod
22 #pod =head1 DESCRIPTION
23 #pod
24 #pod This class represents a link which is allowed to have child links.
25 #pod This allows making trees of links for multi-level menus.
26 #pod
27 #pod =head1 SEE ALSO
28 #pod
29 #pod L<Statocles::Link>
30 #pod
31 #pod =cut
32  
33 101 ▶use Statocles::Base 'Class';
Subroutine BEGIN: called CC=1 SCAR=0.0
34 101 extends 'Statocles::Link';
35  
36 #pod =attr children
37 #pod
38 #pod $link->children([
39 #pod # Object
40 #pod Statocles::Link::Tree->new(
41 #pod href => '/blog',
42 #pod text => 'Blog',
43 #pod ),
44 #pod
45 #pod # Hashref of attributes
46 #pod {
47 #pod href => '/about',
48 #pod text => 'About',
49 #pod },
50 #pod
51 #pod # URL only
52 #pod 'http://example.com',
53 #pod ]);
54 #pod
55 #pod The children of this link. Should be an arrayref of
56 #pod C<Statocles::Link::Tree> objects, hashrefs of attributes for
57 #pod C<Statocles::Link::Tree> objects, or URLs which will be used as the
58 #pod C<href> attribute for a C<Statocles::Link::Tree> object.
59 #pod
60 #pod =cut
61  
62 has children => (
63 is => 'rw',
64 isa => LinkTreeArray,
65 coerce => LinkTreeArray->coercion,
66 18 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
67 101 );
68  
69 101 1;
70  
71 __END__
« blib/lib/Statocles/Event.pm ↑ Summary blib/lib/Statocles/Page/Plain.pm »