| 1 | package POE::XUL::Application; | ||||||||||||||||||||||||||||
| 2 | # $Id$ | ||||||||||||||||||||||||||||
| 3 | # Copyright Philip Gwyn 2007-2010. All rights reserved. | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | our $VERSION = '0.0601'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use POE; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use POE::Component::XUL; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use POE::XUL::Logging; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use POE::XUL::Session; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use constant DEBUG => 1; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use vars qw( $window $server ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 1 | require Exporter; | |||||||||||||||||||||||||||
| 20 | 1 | our @ISA = qw( Exporter ); | |||||||||||||||||||||||||||
| 21 | 1 | our @EXPORT = qw( window server ); | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | ################################################################ | ||||||||||||||||||||||||||||
| 24 | 0 | ▶ | sub window () { return $window; } | ||||||||||||||||||||||||||
|
Subroutine
window: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | sub server () { return $server; } | ||||||||||||||||||||||||||
|
Subroutine
server: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | ################################################################ | ||||||||||||||||||||||||||||
| 28 | sub create_server | ||||||||||||||||||||||||||||
| 29 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
create_server: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 30 | 0 | my( $package, $name ) = @_; | |||||||||||||||||||||||||||
| 31 | 0 | POE::Component::XUL->spawn( { | |||||||||||||||||||||||||||
| 32 | apps => { | ||||||||||||||||||||||||||||
| 33 | $name => $package | ||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | } ); | ||||||||||||||||||||||||||||
| 36 | 0 | $poe_kernel->run; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | ################################################################ | ||||||||||||||||||||||||||||
| 40 | sub spawn | ||||||||||||||||||||||||||||
| 41 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
spawn: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 42 | 0 | my( $self, $event ) = @_; | |||||||||||||||||||||||||||
| 43 | 0 | ▶ | $self = $self->new unless ref $self; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 44 | 0 | $self->SID( $event->SID ); | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 0 | POE::XUL::Session->create( $self ); | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | ################################################################ | ||||||||||||||||||||||||||||
| 50 | sub new | ||||||||||||||||||||||||||||
| 51 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 52 | 0 | my( $package ) = @_; | |||||||||||||||||||||||||||
| 53 | 0 | return bless {}, $package; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | ################################################################ | ||||||||||||||||||||||||||||
| 57 | sub connect | ||||||||||||||||||||||||||||
| 58 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
connect: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 59 | 0 | my( $self, $event ) = @_; | |||||||||||||||||||||||||||
| 60 | 0 | die "You must overload ", ref( $self ), "->connect"; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | ################################################################ | ||||||||||||||||||||||||||||
| 64 | sub __mk_accessor | ||||||||||||||||||||||||||||
| 65 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
__mk_accessor: called CC=1 SCAR=3.5
| |||||||||||||||||||||||||||||
| 66 | 2 | my( $name ) = @_; | |||||||||||||||||||||||||||
| 67 | 0 | ▶ | return sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 68 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 69 | 0 | my $rv = $self->{$name}; | |||||||||||||||||||||||||||
| 70 | 0 | ▶ | $self->{$name} = $_[0] if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | 0 | return $rv; | |||||||||||||||||||||||||||
| 72 | 2 | }; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 1 | *SID = __mk_accessor( 'SID' ); | |||||||||||||||||||||||||||
| 76 | 1 | *name = __mk_accessor( 'name' ); | |||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | ################################################################ | ||||||||||||||||||||||||||||
| 79 | sub createHandler | ||||||||||||||||||||||||||||
| 80 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
createHandler: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 81 | 0 | my( $self, $name, $what ) = @_; | |||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 0 | ▶ | croak "Unable to createHandler outside of a POE::XUL::Application" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | unless $server; | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | # TODO: Make sure current_session is our session! | ||||||||||||||||||||||||||||
| 87 | 0 | ▶ | if( $what and ref $what ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$what and ref $what
MC/DC0%0/2
$what and ref $what
$what
ref $what
Truth table0%0/3
A and B
A= $whatB= ref $what
| |||||||||||||||||||||||||||||
| 88 | 0 | $poe_kernel->state( $name, $what ); | |||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | else { | ||||||||||||||||||||||||||||
| 91 | 0 | $poe_kernel->state( $name, $self, $what ); | |||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | ################################################################ | ||||||||||||||||||||||||||||
| 96 | sub removeHandler | ||||||||||||||||||||||||||||
| 97 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
removeHandler: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 98 | 0 | my( $self, $name ) = @_; | |||||||||||||||||||||||||||
| 99 | # TODO: Make sure current_session is our session! | ||||||||||||||||||||||||||||
| 100 | 0 | $poe_kernel->state( $name ); | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 1 | 1; | |||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | __END__ | ||||||||||||||||||||||||||||