Go to the source code of this file.
Functions | |
| use lib | dirname ($0) |
| our ($opt_v, $opt_t, $opt_T, $opt_l, $opt_u, $opt_d) | |
| getopts ('Tvtlu:d:') | |
| if (defined $opt_v) | |
| if (!(defined $opt_u &&defined $locid &&!$locid eq"")) | |
| if (!$xml) | |
| if ($weather_string=~/^cloudy $/i) | |
| elsif ($weather_string=~/^foggy $/i||$weather_string=~/^misty $/i) | |
| foreach (@data) | |
Variables | |
| use | strict |
| use | BBCLocation |
| my | $name = 'BBC-Current-XML' |
| my | $version = 0.1 |
| my | $author = 'Stuart Morgan' |
| my | $email = 'stuart@tase.co.uk' |
| my | $updateTimeout = 120*60 |
| my | $retrieveTimeout = 30 |
| my | types |
| my | $dir = "./" |
| my | $locid = shift |
| my | $units = $opt_u |
| my | $base_url |
| my | $local_base_url |
| die unless defined | $response |
| my | $xml = XMLin($response) |
| printf appt::NA | n |
| my | $location = $xml->{channel}->{title} |
| my | $item_title = $xml->{channel}->{item}->{title} |
| $obs_time = ~ s/^(.*?)\:.*/$1/s | |
| my | $weather_string = $item_title |
| use lib dirname | ( | $ | 0 | ) |
| our | ( | $ | opt_v, | |
| $ | opt_t, | |||
| $ | opt_T, | |||
| $ | opt_l, | |||
| $ | opt_u, | |||
| $ | opt_d | |||
| ) |
| getopts | ( | 'Tvtlu:d:' | ) |
| if | ( | defined $ | opt_v | ) |
Definition at line 37 of file bbccurrentxml.pl.
| if | ( | ! | defined $opt_u &&defined $locid &&!$locid eq"" | ) |
Definition at line 72 of file bbccurrentxml.pl.
| if | ( | !$ | xml | ) |
Definition at line 100 of file bbccurrentxml.pl.
| if | ( | $ | weather_string = ~ /^cloudy$/i |
) |
Definition at line 124 of file bbccurrentxml.pl.
Definition at line 127 of file bbccurrentxml.pl.
| foreach | ( | @ | data | ) |
Definition at line 171 of file bbccurrentxml.pl.
| use strict |
Definition at line 7 of file bbccurrentxml.pl.
| use BBCLocation |
Definition at line 16 of file bbccurrentxml.pl.
| my $name = 'BBC-Current-XML' |
Definition at line 20 of file bbccurrentxml.pl.
| my $version = 0.1 |
Definition at line 21 of file bbccurrentxml.pl.
| my $author = 'Stuart Morgan' |
Definition at line 22 of file bbccurrentxml.pl.
| my $email = 'stuart@tase.co.uk' |
Definition at line 23 of file bbccurrentxml.pl.
| my $updateTimeout = 120*60 |
Definition at line 24 of file bbccurrentxml.pl.
| my $retrieveTimeout = 30 |
Definition at line 28 of file bbccurrentxml.pl.
| my types |
Initial value:
('cclocation', 'station_id', 'copyright', 'observation_time', 'weather', 'temp', 'relative_humidity', 'wind_dir', 'pressure', 'visibility', 'weather_icon', 'appt', 'wind_spdgst')
Definition at line 29 of file bbccurrentxml.pl.
| my $dir = "./" |
Definition at line 33 of file bbccurrentxml.pl.
| my $locid = shift |
Definition at line 71 of file bbccurrentxml.pl.
| my $units = $opt_u |
Definition at line 76 of file bbccurrentxml.pl.
| my $base_url |
Definition at line 77 of file bbccurrentxml.pl.
| my $local_base_url |
Initial value:
'http: my $world_base_url = 'http: if ($locid =~ s/^W(.*)/$1/) { $base_url = $world_base_url; } elsif ($locid =~ s/^L(.*)/$1/) { $base_url = $local_base_url; } else { die "Invalid Location ID"; } my $response = get $base_url . $locid . '.xml'
Definition at line 79 of file bbccurrentxml.pl.
| die unless defined $response |
Definition at line 96 of file bbccurrentxml.pl.
| my $xml = XMLin($response) |
Definition at line 98 of file bbccurrentxml.pl.
| printf weather:: $weather_string n |
Definition at line 105 of file bbccurrentxml.pl.
| $location = $xml->{channel}->{title} |
| $item_title = $xml->{channel}->{item}->{title} |
Definition at line 113 of file bbccurrentxml.pl.
Definition at line 117 of file bbccurrentxml.pl.
| $weather_string = $item_title |
Definition at line 119 of file bbccurrentxml.pl.
1.5.5