| 1 | package Weather::Com::Object; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 6 | ▶ | use 5.006; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 6 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 6 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 6 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | #-------------------------------------------------------------------- | ||||||||||||||||||||
| 9 | # Define some globals | ||||||||||||||||||||
| 10 | #-------------------------------------------------------------------- | ||||||||||||||||||||
| 11 | 6 | our $VERSION = sprintf "%d.%03d", q$Revision: 1.3 $ =~ /(\d+)/g; | |||||||||||||||||||
| 12 | 6 | my %LH = (); # our language handles | |||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 15 | # Constructor | ||||||||||||||||||||
| 16 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 17 | 7 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.1
Pod
undocumented
| |||||||||||||||||||||
| 18 | 7 | my $proto = shift; | |||||||||||||||||||
| 19 | 7 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 20 | 7 | my $self = {}; | |||||||||||||||||||
| 21 | 7 | my %parameters; | |||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | # parameters provided by new method | ||||||||||||||||||||
| 24 | 7 | ▶ | if ( ref( $_[0] ) eq "HASH" ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 25 | 7 | %parameters = %{ $_[0] }; | |||||||||||||||||||
| 26 | } else { | ||||||||||||||||||||
| 27 | 0 | %parameters = @_; | |||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 7 | $self = bless( $self, $class ); | |||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | # creating the SUPER instance | ||||||||||||||||||||
| 33 | 7 | $self->{ARGS} = \%parameters; | |||||||||||||||||||
| 34 | 7 | ▶ | if ( $parameters{lang} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 35 | 2 | $self->{LANGUAGE} = $parameters{lang}; | |||||||||||||||||||
| 36 | } else { | ||||||||||||||||||||
| 37 | 5 | $self->{LANGUAGE} = 'en_US'; | |||||||||||||||||||
| 38 | } | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 7 | return $self; | |||||||||||||||||||
| 42 | } # end new() | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 45 | # update barometric data | ||||||||||||||||||||
| 46 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 47 | 0 | ▶ | sub update { | ||||||||||||||||||
|
Subroutine
update: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 48 | 0 | my $self = shift; | |||||||||||||||||||
| 49 | 0 | return 1; | |||||||||||||||||||
| 50 | } | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 53 | # Get a language handle | ||||||||||||||||||||
| 54 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 55 | 14 | ▶ | sub get_language_handle { | ||||||||||||||||||
|
Subroutine
get_language_handle: called CC=4 SCAR=14.5
Pod
undocumented
| |||||||||||||||||||||
| 56 | 14 | my $self = shift; | |||||||||||||||||||
| 57 | 14 | ▶ | my $lang = shift || $self->{LANGUAGE}; | ||||||||||||||||||
|
Condition33%1/3
shift() || $self->{'LANGUAGE'}
MC/DC0%0/2
shift() || $self->{'LANGUAGE'}
shift()
$self->{'LANGUAGE'}
Truth table33%1/3
A || B
A= shift()B= $self->{'LANGUAGE'}
| |||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | # check if we already have an open handle | ||||||||||||||||||||
| 60 | 14 | ▶ | unless (defined($LH{$lang})) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 61 | 4 | ▶ | $LH{$lang} = Weather::Com::L10N->get_handle($lang) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 62 | or croak ("Language?"); | ||||||||||||||||||||
| 63 | } | ||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | # return language handle | ||||||||||||||||||||
| 66 | 14 | return $LH{$lang}; | |||||||||||||||||||
| 67 | } | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | 6 | 1; | |||||||||||||||||||