From 80f12b9529dca6b2f425918fce77da41da168f41 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 5 Nov 2014 16:56:32 +0000 Subject: Remove liberror-perl and libsoap-lite-perl. Try and save other people the potential pain of installing SOAP::Lite; only UK FixMyStreet and Zurich geocoder use it, so set it as an optional feature in the cpanfile instead. --- bin/install_perl_modules | 2 +- bin/send-comments | 1 - conf/packages | 1 - conf/packages.debian-squeeze | 2 -- conf/packages.debian-wheezy | 2 -- conf/packages.ubuntu-precise | 2 -- cpanfile | 14 +++++--------- perllib/FixMyStreet/Geocode/Zurich.pm | 3 ++- perllib/FixMyStreet/SendReport/EastHants.pm | 10 +++++----- 9 files changed, 13 insertions(+), 24 deletions(-) diff --git a/bin/install_perl_modules b/bin/install_perl_modules index 883ced235..e86a55261 100755 --- a/bin/install_perl_modules +++ b/bin/install_perl_modules @@ -9,7 +9,7 @@ $DIR/bin/cpanm -l $DIR/local-carton Carton export PATH=$DIR/local-carton/bin:$PATH export PERL5LIB=$DIR/local-carton/lib/perl5 -carton install --deployment --without uk +carton install --deployment --without uk --without zurich if ! perl -MImage::Magick -e 'exit()' >/dev/null 2>&1 then diff --git a/bin/send-comments b/bin/send-comments index 3549113c9..03adfb095 100755 --- a/bin/send-comments +++ b/bin/send-comments @@ -15,7 +15,6 @@ require 5.8.0; use Digest::MD5; use Encode; -use Error qw(:try); use CronFns; use FixMyStreet::App; diff --git a/conf/packages b/conf/packages index 5edbe96fe..de2207f98 100644 --- a/conf/packages +++ b/conf/packages @@ -4,7 +4,6 @@ make jhead -liberror-perl liblocale-gettext-perl libsoap-lite-perl memcached diff --git a/conf/packages.debian-squeeze b/conf/packages.debian-squeeze index 21e5d0485..c2f1f3f68 100644 --- a/conf/packages.debian-squeeze +++ b/conf/packages.debian-squeeze @@ -1,8 +1,6 @@ make jhead -liberror-perl liblocale-gettext-perl -libsoap-lite-perl memcached perl perlmagick diff --git a/conf/packages.debian-wheezy b/conf/packages.debian-wheezy index 546cdf72f..ef6921142 100644 --- a/conf/packages.debian-wheezy +++ b/conf/packages.debian-wheezy @@ -1,8 +1,6 @@ make jhead -liberror-perl liblocale-gettext-perl -libsoap-lite-perl memcached perl perlmagick diff --git a/conf/packages.ubuntu-precise b/conf/packages.ubuntu-precise index 546cdf72f..ef6921142 100644 --- a/conf/packages.ubuntu-precise +++ b/conf/packages.ubuntu-precise @@ -1,8 +1,6 @@ make jhead -liberror-perl liblocale-gettext-perl -libsoap-lite-perl memcached perl perlmagick diff --git a/cpanfile b/cpanfile index 4a15ea7f5..b50e433a8 100644 --- a/cpanfile +++ b/cpanfile @@ -69,7 +69,6 @@ requires 'POSIX'; requires 'Readonly'; requires 'Regexp::Common'; requires 'Scalar::Util'; -requires 'SOAP::Lite'; requires 'Statistics::Distributions'; requires 'Storable'; requires 'Template::Plugin::Comma'; @@ -81,12 +80,9 @@ requires 'XML::RSS'; requires 'XML::Simple'; requires 'YAML'; -# SOAP::Lite isn't needed by all cobrands, but it would require -# code changes to only be imported when installed. - feature 'uk', 'FixMyStreet.com specific requirements' => sub { -# # East Hampshire -# requires 'SOAP::Lite'; + # East Hampshire + requires 'SOAP::Lite'; # Barnet # TODO: This can perhaps be removed since Barnet switched to email for problem reports requires 'SOAP::WSDL'; @@ -101,10 +97,10 @@ feature 'open311-endpoint', 'Open311::Endpoint specific requirements' => sub { requires 'DateTime::Format::Oracle'; # for EXOR }; -#feature 'zurich', 'Zueri wie neu specific requirements' => sub { +feature 'zurich', 'Zueri wie neu specific requirements' => sub { # # Geocoder -# requires 'SOAP::Lite'; -#}; + requires 'SOAP::Lite'; +}; # Moderation by from_body user requires 'Algorithm::Diff'; diff --git a/perllib/FixMyStreet/Geocode/Zurich.pm b/perllib/FixMyStreet/Geocode/Zurich.pm index 7ba3d27ad..84fd83fc7 100644 --- a/perllib/FixMyStreet/Geocode/Zurich.pm +++ b/perllib/FixMyStreet/Geocode/Zurich.pm @@ -16,7 +16,6 @@ use strict; use Digest::MD5 qw(md5_hex); use File::Path (); use Geo::Coordinates::CH1903; -use SOAP::Lite; use Storable; use mySociety::Locale; @@ -33,6 +32,8 @@ sub setup_soap { my $attr = 'http://ch/geoz/fixmyzuerich/service'; my $action = "$attr/IFixMyZuerich/"; + require SOAP::Lite; + # Set up the SOAP handler $security = SOAP::Header->name("Security")->attr({ 'mustUnderstand' => 'true', diff --git a/perllib/FixMyStreet/SendReport/EastHants.pm b/perllib/FixMyStreet/SendReport/EastHants.pm index beab9d55c..44bc084b1 100644 --- a/perllib/FixMyStreet/SendReport/EastHants.pm +++ b/perllib/FixMyStreet/SendReport/EastHants.pm @@ -4,11 +4,9 @@ use Moose; BEGIN { extends 'FixMyStreet::SendReport'; } -# export just what we need as error if we use :try -use Error qw(try otherwise); +use Try::Tiny; use Encode; use mySociety::Web qw(ent); -use EastHantsWSDL; sub construct_message { my %h = @_; @@ -37,6 +35,8 @@ sub send { # FIXME: should not recreate this each time my $eh_service; + require EastHantsWSDL; + $h->{category} = 'Customer Services' if $h->{category} eq 'Other'; $h->{message} = construct_message( %$h ); my $return = 1; @@ -50,8 +50,8 @@ sub send { '', '', '', '', '', '', $message, 'Yes', $h->{image_url} ); $return = 0 if $result eq 'Report received'; - } otherwise { - my $e = shift; + } catch { + my $e = $_; print "Caught an error: $e\n"; $self->error( "Error sending to East Hants: $e" ); }; -- cgit v1.2.3