XUL/TWindow.pm

filter: Statementstmt 54.3% 31 / 57 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 43.7% 7 / 16 Podpod 0.0% 0 / 7 totaltotal 45.2% 38 / 84 CC 3 SCAR 9.1
CC
3
Cov
51%
__ANON__
6.0
create_window
6.0
is_window
2.0
CRAP 2.5
« XUL/State.pm ↑ Summary XUL.pm »
1 package POE::XUL::TWindow;
2 # $Id$
3 # Copyright Philip Gwyn 2007-2010. All rights reserved.
4  
5 21 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 21 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 21 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 21 ▶use POE::XUL::Node;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 21 ▶use Scalar::Util qw( blessed );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 21 ▶use constant DEBUG => 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 21 our $VERSION = '0.0600';
15  
16 ##############################################################
17 0 ▶sub is_window { 1 }
Subroutine is_window: not called CC=1 SCAR=6.9
Pod undocumented
18  
19 ##############################################################
20 sub new
21 {
22 0 ▶ my( $package, %atts ) = @_;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
23 0 my $self = bless { attributes => { %atts },
24 events => {}
25 }, $package;
26 0 return $self;
27 }
28  
29 ##############################################################
30 0 ▶*tag = sub { 'twindow' };
Subroutine __ANON__: not called CC=1 SCAR=1.2
31 21 *id = _mk_accessor( 'id' );
32 21 *width = _mk_accessor( 'width' );
33 21 *height = _mk_accessor( 'height' );
34 21 *status = _mk_accessor( 'status' );
35 21 *menubar = _mk_accessor( 'menubar' );
36 21 *toolbar = _mk_accessor( 'toolbar' );
37 21 *scollbars = _mk_accessor( 'scrollbars' );
38  
39 sub _mk_accessor
40 {
41 147 ▶ my( $tag ) = @_;
Subroutine _mk_accessor: called CC=1 SCAR=3.5
42 return sub {
43 0 ▶ my( $self, $value ) = @_;
Subroutine __ANON__: not called CC=2 SCAR=17.9
44 0 ▶ if( @_ == 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 2) { } 0 0 0
45 0 return $self->{attributes}{$tag} = $value;
46 }
47 else {
48 0 return $self->{attributes}{$tag};
49 }
50 }
51 147 }
52  
53 ##############################################################
54 sub attach
55 {
56 0 ▶ my( $self, $name, $what ) = @_;
Subroutine attach: not called CC=1 SCAR=6.9
Pod undocumented
57 0 POE::XUL::Node::attach( $self, $name, $what );
58 }
59 21 *addEventListener = \&attach;
60  
61 sub detach
62 {
63 0 ▶ my ($self, $name) = @_;
Subroutine detach: not called CC=1 SCAR=6.9
Pod undocumented
64 0 POE::XUL::Node::detach( $self, $name );
65 }
66 21 *removeEventListener = \&detach;
67  
68 sub event
69 {
70 0 ▶ my ($self, $name) = @_;
Subroutine event: not called CC=1 SCAR=6.9
Pod undocumented
71 0 POE::XUL::Node::event( $self, $name );
72 }
73  
74 ##############################################################
75 sub dispose
76 {
77 0 ▶ my( $self ) = @_;
Subroutine dispose: not called CC=1 SCAR=6.9
Pod undocumented
78 # events might cause cyclic references
79 0 $self->{events} = {};
80 0 return;
81 }
82  
83 ##############################################################
84 ## Create the final Window object
85 sub create_window
86 {
87 0 ▶ my( $self ) = @_;
Subroutine create_window: not called CC=2 SCAR=17.9
Pod undocumented
88 0 my $id = $self->id;
89 0 my $window = POE::XUL::Window->new( %{ $self->{attributes} },
90 tag => 'window', id => $id, name => $id
91 );
92  
93 0 ▶ while( my( $name, $what ) = each %{ $self->{events} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$$self{"events"};}) 0 0 0
94 0 $window->attach( $name, $what );
95 }
96 0 return $window;
97 }
« XUL/State.pm ↑ Summary XUL.pm »