File perl-Finance-Quote-70690-IndiaMutual-temp.patch of Package perl-Finance-Quote
https://rt.cpan.org/Public/Bug/Display.html?id=70690
Subject: Finance::Quote::IndiaMutual temp file creation
Date: Fri, 2 Sep 2011 00:13:44 +0100
To: bug-Finance-Quote [...] rt.cpan.org
From: Vishal Grover <vishal.grover [...] gmail.com>
Hi,
Finance::Quote::IndiaMutual uses a hardcoded temporary file for downloaded
NAVs. This approach fails with ActivePerl on Windows. A simple patch is
below
Thanks
Vishal
Index: Finance-Quote-1.18/lib/Finance/Quote/IndiaMutual.pm
===================================================================
--- Finance-Quote-1.18.orig/lib/Finance/Quote/IndiaMutual.pm
+++ Finance-Quote-1.18/lib/Finance/Quote/IndiaMutual.pm
@@ -13,6 +13,7 @@ use LWP::UserAgent;
use HTTP::Request::Common;
use HTTP::Status;
use HTML::TableExtract;
+use File::Temp qw / tempfile /;
$VERSION = '1.18';
@@ -24,8 +25,7 @@ $AMFI_URL = ("${AMFI_MAIN_URL}NavReport.
#$AMFI_URL = ("${AMFI_MAIN_URL}spages/NAV0.txt"); #This page seems to do the job also. Keep for reference
# amfinavlist.txt is a cache-file. keep it until updated on the website since this is a 1meg file.
-my $cachedir = $ENV{TMPDIR} // $ENV{TEMP} // '/tmp/';
-$AMFI_NAV_LIST = $cachedir."amfinavlist.txt";
+(undef, $AMFI_NAV_LIST) = tempfile();
sub methods { return (indiamutual => \&amfiindia,
amfiindia => \&amfiindia); }