Subject: | Need to load Carp before we use it |
The code calls Carp::croak(), but never loads Carp. Patch attached.
Subject: | 0001-Need-to-load-Carp-before-we-use-it.patch |
From 69f5d55c118297bc56a55b1e9475f5fc32cd9382 Mon Sep 17 00:00:00 2001
From: Ken Williams <Ken.Williams@WindLogics.com>
Date: Tue, 7 May 2013 17:36:46 -0500
Subject: [PATCH] Need to load Carp before we use it
---
Makefile.PL | 1 +
lib/DateTime/Tiny.pm | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index 029efcb..1a2058c 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -11,6 +11,7 @@ WriteMakefile1(
ABSTRACT => 'A datetime object with as little code as possible',
VERSION => $VERSION,
PREREQ_PM => {
+ Carp => 0,
},
BUILD_REQUIRES => {
# Skip on Windows to avoid breaking ActivePerl PPMs
diff --git a/lib/DateTime/Tiny.pm b/lib/DateTime/Tiny.pm
index f9f9d21..58b3f61 100644
--- a/lib/DateTime/Tiny.pm
+++ b/lib/DateTime/Tiny.pm
@@ -302,9 +302,11 @@ Returns a new B<DateTime::Tiny> object, or throws an exception on error.
sub from_string {
my $string = $_[1];
unless ( defined $string and ! ref $string ) {
+ require Carp;
Carp::croak("Did not provide a string to from_string");
}
unless ( $string =~ /^(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)$/ ) {
+ require Carp;
Carp::croak("Invalid time format (does not match ISO 8601)");
}
$_[0]->new(
--
1.7.9