Subject: | accept array as photo argument |
I find it useful to pass an array as the photo argument to Flickr::Upload so that I do not have to write the image data to a file and so that I can supply the file name separately, however the check (-f $args{'photo'}) in upload() does not allow this.
Subject: | 0001-accept-array-as-photo-argument.patch |
From 0be510ec9331341b464a3d57ca0da76ef34bb65b Mon Sep 17 00:00:00 2001
From: Kensaku Yamaguchi <cpan@kensaku-yamaguchi.org>
Date: Sun, 21 Aug 2016 10:24:59 +0900
Subject: [PATCH] accept array as photo argument
---
lib/Flickr/Upload.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Flickr/Upload.pm b/lib/Flickr/Upload.pm
index 0d7746e..6c42324 100644
--- a/lib/Flickr/Upload.pm
+++ b/lib/Flickr/Upload.pm
@@ -125,7 +125,7 @@ sub upload {
my %args = @_;
# these are the only things _required_ by the uploader.
- die "Can't read photo '$args{'photo'}'" unless $args{'photo'} and -f $args{'photo'};
+ die "Can't read photo '$args{'photo'}'" unless $args{'photo'} and (ref $args{'photo'} eq "ARRAY" or -f $args{'photo'});
die "Missing 'auth_token'" unless $self->is_oauth or defined $args{'auth_token'};
# create a request object and execute it
--
2.1.4