| 1 | # E2::Usergroup | ||||||||||||||||||||
| 2 | # Jose M. Weeks <jose@joseweeks.com> | ||||||||||||||||||||
| 3 | # 05 June 2003 | ||||||||||||||||||||
| 4 | # | ||||||||||||||||||||
| 5 | # See bottom for pod documentation. | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | package E2::Usergroup; | ||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 2 | ▶ | use 5.006; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 2 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 2 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 2 | ▶ | use E2::Node; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 2 | our @ISA = "E2::Node"; | |||||||||||||||||||
| 17 | 2 | our $VERSION = "0.32"; | |||||||||||||||||||
| 18 | 2 | our $DEBUG; *DEBUG = *E2::Interface::DEBUG; | |||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | # Prototypes | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | sub new; | ||||||||||||||||||||
| 23 | sub clear; | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | sub description; | ||||||||||||||||||||
| 26 | sub list_members; | ||||||||||||||||||||
| 27 | sub list_weblog; | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | # Private | ||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | sub type_as_string; | ||||||||||||||||||||
| 32 | sub twig_handlers; | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | # Object Methods | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 1 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||
| 37 | 1 | my $arg = shift; | |||||||||||||||||||
| 38 | 1 | ▶ | my $class = ref( $arg ) || $arg; | ||||||||||||||||||
|
Condition33%1/3
ref $arg || $arg
MC/DC0%0/2
ref $arg || $arg
ref $arg
$arg
Truth table33%1/3
A || B
A= ref $argB= $arg
| |||||||||||||||||||||
| 39 | 1 | my $self = $class->SUPER::new(); | |||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | # See clear for the other members of $self | ||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | 1 | $self->clear; | |||||||||||||||||||
| 44 | 1 | return $self; | |||||||||||||||||||
| 45 | } | ||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | 3 | ▶ | sub clear { | ||||||||||||||||||
|
Subroutine
clear: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||
| 48 | 3 | ▶ | my $self = shift or croak "Usage: clear E2USERGROUP"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 3 | ▶ | warn "E2::Usergroup::clear\n" if $DEBUG > 1; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | 3 | @{ $self->{members} } = (); | |||||||||||||||||||
| 53 | 3 | @{ $self->{weblog} } = (); | |||||||||||||||||||
| 54 | 3 | $self->{description} = undef; | |||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | # Now clear parent | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 3 | return $self->SUPER::clear; | |||||||||||||||||||
| 59 | } | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 1 | ▶ | sub twig_handlers { | ||||||||||||||||||
|
Subroutine
twig_handlers: called CC=2 SCAR=13.0
Pod
undocumented
| |||||||||||||||||||||
| 62 | 1 | ▶ | my $self = shift or croak "Usage: twig_handlers E2USERGROUP"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | return ( | ||||||||||||||||||||
| 65 | 0 | ▶ | 'description' => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 66 | 0 | (my $a, my $b) = @_; | |||||||||||||||||||
| 67 | 0 | $self->{description} = $b->text; | |||||||||||||||||||
| 68 | }, | ||||||||||||||||||||
| 69 | 0 | ▶ | 'weblog/e2link' => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 70 | 0 | (my $a, my $b) = @_; | |||||||||||||||||||
| 71 | 0 | push @{ $self->{weblog} }, { | |||||||||||||||||||
| 72 | title => $b->text, | ||||||||||||||||||||
| 73 | id => $b->{att}->{node_id} | ||||||||||||||||||||
| 74 | 0 | }; | |||||||||||||||||||
| 75 | }, | ||||||||||||||||||||
| 76 | 0 | ▶ | 'usergroup/e2link' => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 77 | 0 | (my $a, my $b) = @_; | |||||||||||||||||||
| 78 | 0 | push @{ $self->{members} }, { | |||||||||||||||||||
| 79 | name => $b->text, | ||||||||||||||||||||
| 80 | id => $b->{att}->{node_id} | ||||||||||||||||||||
| 81 | 0 | }; | |||||||||||||||||||
| 82 | } | ||||||||||||||||||||
| 83 | 1 | ); | |||||||||||||||||||
| 84 | } | ||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | 1 | ▶ | sub type_as_string { | ||||||||||||||||||
|
Subroutine
type_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 87 | 1 | return 'usergroup'; | |||||||||||||||||||
| 88 | } | ||||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | 0 | ▶ | sub description { | ||||||||||||||||||
|
Subroutine
description: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 91 | 0 | ▶ | my $self = shift or croak "Usage: description E2USERGROUP"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 92 | 0 | return $self->{description}; | |||||||||||||||||||
| 93 | } | ||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | 0 | ▶ | sub list_members { | ||||||||||||||||||
|
Subroutine
list_members: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||
| 96 | 0 | ▶ | my $self = shift or croak "Usage: list_members E2USERGROUP"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 97 | 0 | ▶ | return undef if !$self->node_id; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 98 | 0 | return @{ $self->{members} }; | |||||||||||||||||||
| 99 | } | ||||||||||||||||||||
| 100 | |||||||||||||||||||||
| 101 | 0 | ▶ | sub list_weblog { | ||||||||||||||||||
|
Subroutine
list_weblog: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||
| 102 | 0 | ▶ | my $self = shift or croak "Usage: list_weblog E2USERGROUP"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 103 | 0 | ▶ | return undef if !$self->node_id; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 104 | 0 | return @{ $self->{weblog} }; | |||||||||||||||||||
| 105 | } | ||||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | 2 | 1; | |||||||||||||||||||
| 108 | __END__ | ||||||||||||||||||||