File Coverage

blib/lib/SoggyOnion/Plugin/GeoWeather.pm
Criterion Covered Total %
statement 12 22 54.5
branch 0 4 0.0
condition 0 3 0.0
subroutine 4 5 80.0
pod 1 1 100.0
total 17 35 48.5


line stmt bran cond sub pod time code
1             package SoggyOnion::Plugin::GeoWeather;
2 1     1   10878 use warnings;
  1         2  
  1         39  
3 1     1   7 use strict;
  1         2  
  1         40  
4 1     1   5 use base qw( SoggyOnion::Plugin );
  1         2  
  1         124  
5              
6             our $VERSION = '0.04';
7              
8 1     1   2546 use Geo::Weather;
  1         5198  
  1         386  
9              
10             sub content {
11 0     0 1   my $self = shift;
12              
13             # we need either the city&state or a zip code
14 0           my @args;
15 0 0 0       if ( exists $self->{zip} ) {
    0          
16 0           @args = ( $self->{zip} );
17             }
18             elsif ( exists $self->{city} && exists $self->{state} ) {
19 0           @args = ( $self->{city}, $self->{state} );
20             }
21             else {
22 0           warn __PACKAGE__ . " hash must have 'zip' or 'city' and 'state'\n";
23 0           return;
24             }
25              
26             # get the weather
27 0           my $weather = Geo::Weather->new;
28 0           $weather->get_weather(@args);
29 0           return $weather->report . "
" . $weather->report_forecast;
30             }
31              
32             1;
33              
34             __END__