Acme-Terror-UK
view release on metacpan or search on metacpan
Revision history for Perl extension Acme::Terror::UK.
0.06 Fri May 14 14:34:00 2010
- Added dependancy for LWP::Simple to Makefile.PL
0.05 Wed May 12 14:48:00 2010
- Change screen scraping to new new page on the MI5
website. Patch supplied by Neil Stott.
0.04 Wed Jun 11 09:41:00 2008
- Changed screen scraping to use new page on the MI5
0.02 Mon Aug 7 13:25:00 2006
- Added level() method to return the current threat
level in a nicer format.
- Improved documentation and added details for all
public methods.
- Added some extra tests.
0.01 Wed Aug 2 09:00:13 2006
- original version; created by h2xs 1.23 with options
-X -n Acme::Terror::UK
Changes
Makefile.PL
MANIFEST
README
t/Acme-Terror-UK.t
lib/Acme/Terror/UK.pm
META.yml Module meta-data (added by MakeMaker)
--- #YAML:1.0
name: Acme-Terror-UK
version: 0.06
abstract: Fetch the current UK terror alert level
author:
- A. U. Thor <pricer@localdomain>
license: unknown
distribution_type: module
configure_requires:
ExtUtils::MakeMaker: 0
build_requires:
ExtUtils::MakeMaker: 0
requires:
LWP::Simple: 5.48
Makefile.PL view on Meta::CPAN
use 5.00503;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
NAME => 'Acme::Terror::UK',
VERSION_FROM => 'lib/Acme/Terror/UK.pm', # finds $VERSION
PREREQ_PM => {
'LWP::Simple' => 5.48
}, # e.g., Module::Name => 1.1
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/Acme/Terror/UK.pm', # retrieve abstract from module
AUTHOR => 'A. U. Thor <pricer@localdomain>') : ()),
);
Acme-Terror-UK version 0.04
===========================
Gets and returns the current UK terrorist threat status in the UK.
EXAMPLE
my $t = Acme::Terror::UK->new();
if ($t->level() == Acme::Terror::UK::SEVERE) {
print "The current terror level is SEVERE\n";
}
INSTALLATION
To install this module type the following:
perl Makefile.PL
make
make test
make install
lib/Acme/Terror/UK.pm view on Meta::CPAN
package Acme::Terror::UK;
## Get and return the current UK terrorist threat status.
## Robert Price - http://www.robertprice.co.uk/
use 5.00503;
use strict;
use LWP::Simple;
use vars qw($VERSION);
$VERSION = '0.06';
lib/Acme/Terror/UK.pm view on Meta::CPAN
return UNKNOWN;
}
}
1;
__END__
=head1 NAME
Acme::Terror::UK - Fetch the current UK terror alert level
=head1 SYNOPSIS
use Acme::Terror::UK;
my $t = Acme::Terror::UK->new(); # create new Acme::Terror::UK object
my $level = $t->fetch;
print "Current terror alert level is: $level\n";
=head1 DESCRIPTION
Gets the currrent terrorist threat level in the UK.
The levels are either...
CRITICAL - an attack is expected imminently
SEVERE - an attack is likely
SUBSTANTIAL - an attack is a strong possibility
MODERATE - an attack is possible but not likely
LOW - an attack is unlikely
This module aims to be compatible with the US version, Acme::Terror
=head1 METHODS
=head2 new()
use Acme::Terror::UK
my $t = Acme::Terror::UK->new();
Create a new instance of the Acme:Terror::UK class.
=head2 fetch()
my $threat_level_string = $t->fetch();
print $threat_level_string;
Return the current threat level as a string.
=head2 level()
my $level = $t->level();
if ($level == Acme::Terror::UK::CRITICAL) {
print "Help, we're all going to die!\n";
}
Return the level of the current terrorist threat as a comparable value.
The values to compare against are,
Acme::Terror::UK::CRITICAL
Acme::Terror::UK::SEVERE
Acme::Terror::UK::SUBSTANTIAL
Acme::Terror::UK::MODERATE
Acme::Terror::UK::LOW
If it can't retrieve the current level, it will return
Acme::Terror::UK::UNKNOWN
=head1 BUGS
This module just screenscrapes the MI5 website so is vulnerable
to breaking if the page design changes.
=head1 SEE ALSO
Acme::Terror
http://www.mi5.gov.uk/
http://www.mi5.gov.uk/output/Page4.html
http://www.intelligence.gov.uk/
http://www.homeoffice.gov.uk/security/current-threat-level/
=head1 THANKS
Neil Stott for supplying a patch after MI5 site redesign
B10m for supplying a patch after an MI5 site redesign
t/Acme-Terror-UK.t view on Meta::CPAN
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl Acme-Terror-UK.t'
#########################
use Test::More tests => 3;
BEGIN { use_ok('Acme::Terror::UK') };
#########################
my $t;
ok($t = Acme::Terror::UK->new(), "Create Object");
ok(defined($t->level()), "Current threat level");
( run in 0.531 second using v1.01-cache-2.11-cpan-65fba6d93b7 )