#!/usr/bin/perl use strict; use warnings; use LWP::Simple; use XML::Simple; # use XML::LibXML; use POSIX qw(strftime); no warnings 'uninitialized'; use Data::Dumper; my $data_dir = "/weatherdata"; my $current_file = 'SDC095.xml'; my $current = XMLin($current_file); # These seem to work if there is no active alert # my $warntitle = $current->{'entry'}->{'title'}; # my $warnlink = $current->{'entry'}->{'id'}; # my $warntext = $current->{'entry'}->{'summary'}; # These work if I already know the full URL for the alert my $warntitle = $current->{'entry'}->{'http://alerts.weather.gov/cap/wwacapget.php?x=SD124CB88C681C.SpecialWeatherStatement.124CB88C9184SD.UNRSPSUNR.046ee1fda521a403079118865edf9ad4'}->{'title'}; my $warnlink = $current->{'entry'}->{'http://alerts.weather.gov/cap/wwacapget.php?x=SD124CB88C681C.SpecialWeatherStatement.124CB88C9184SD.UNRSPSUNR.046ee1fda521a403079118865edf9ad4'}->{'id'}; my $warntext = $current->{'entry'}->{'http://alerts.weather.gov/cap/wwacapget.php?x=SD124CB88C681C.SpecialWeatherStatement.124CB88C9184SD.UNRSPSUNR.046ee1fda521a403079118865edf9ad4'}->{'summary'}; print "$warntitle\n"; print "$warnlink\n"; print "$warntext\n"; # print output # print Dumper($current);