From 62ce76880f772fee4865b0c6404ffef02f1d1486 Mon Sep 17 00:00:00 2001 From: Slaven Rezic Date: Tue, 11 Aug 2009 10:38:23 +0200 Subject: [PATCH] replaced INIT by BEGIN block, to make it possible to require the module --- MANIFEST | 1 + lib/Geo/Distance.pm | 4 ++-- t/require.t | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100755 t/require.t diff --git a/MANIFEST b/MANIFEST index 6be375a..9e6b75b 100644 --- a/MANIFEST +++ b/MANIFEST @@ -13,3 +13,4 @@ MANIFEST This list of files META.yml README t/00.t +t/require.t diff --git a/lib/Geo/Distance.pm b/lib/Geo/Distance.pm index 7e9d45e..5893eb9 100644 --- a/lib/Geo/Distance.pm +++ b/lib/Geo/Distance.pm @@ -54,7 +54,7 @@ use strict; use warnings; use Carp; use Math::Trig qw( great_circle_distance deg2rad rad2deg acos pi asin tan atan ); -our $VERSION = '0.14'; +our $VERSION = '0.1401'; use constant KILOMETER_RHO => 6371.64; #------------------------------------------------------------------------------- @@ -444,7 +444,7 @@ sub closest { } #------------------------------------------------------------------------------- -INIT { +BEGIN { eval "use Geo::Distance::XS" unless $ENV{GEO_DISTANCE_PP}; } diff --git a/t/require.t b/t/require.t new file mode 100755 index 0000000..21c21f7 --- /dev/null +++ b/t/require.t @@ -0,0 +1,11 @@ +use strict; +use Test::More; + +plan tests => 1; + +my @warnings; +$SIG{__WARN__} = sub { push @warnings, @_ }; + +require Geo::Distance; + +is("@warnings", "", "No warnings"); -- 1.6.3.3