Skip Menu |

This queue is for tickets about the LBMA-Statistics CPAN distribution.

Report information
The Basics
Id: 75821
Status: resolved
Priority: 0/
Queue: LBMA-Statistics

People
Owner: Nobody in particular
Requestors: ken.ingram [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Feature Request
Date: Fri, 16 Mar 2012 09:25:34 -0700
To: bug-lbma-statistics [...] rt.cpan.org
From: Ken Ingram <ken.ingram [...] gmail.com>
1. Output the date with YYYY format instead of YY 2. An option to suppress the output to STDOUT or Hash
Subject: Feature Request (Output the date with YYYY format instead of YY)
Am Fr 16. Mär 2012, 12:26:27, ken.ingram@gmail.com schrieb: Show quoted text
> 1. Output the date with YYYY format instead of YY
Just pass the date to a Date::* module on CPAN and format the date accordingly. #!/usr/bin/perl use warnings; use strict; use lib '../lib'; use LBMA::Statistics; use Date::Manip; my $lbma = LBMA::Statistics->new(); # @fixings # 0 date # 1 GOLD A.M. USD # 2 GOLD A.M. GBP # 3 GOLD A.M. EUR # 4 GOLD P.M. USD # 5 GOLD P.M. GBP # 6 GOLD P.M. EUR my ( $date, $gold_am_usd, $gold_am_gbp, $gold_am_eur, $gold_pm_usd, $gold_pm_gbp, $gold_pm_eur, ) = $lbma->dailygoldfixing( year => 2009, month => 2, day => 2 ); print "$date\n"; my @format = '%d-%b-%Y'; print UnixDate( $date, @format ), "\n"; exit;
Subject: Feature Request (An option to suppress the output to STDOUT or Hash)
Am Fr 16. Mär 2012, 12:26:27, ken.ingram@gmail.com schrieb: Show quoted text
> 2. An option to suppress the output to STDOUT or Hash
Just set Log::Log4perl loglevel to OFF and wrap calls in an eval {} block. Hope this helps. Regards, Thomas #!/usr/bin/perl use warnings; use strict; use lib '../lib'; use LBMA::Statistics; use Log::Log4perl qw/:easy/; Log::Log4perl->easy_init($OFF); my $lbma = LBMA::Statistics->new(); # @fixings # 0 date # 1 GOLD A.M. USD # 2 GOLD A.M. GBP # 3 GOLD A.M. EUR # 4 GOLD P.M. USD # 5 GOLD P.M. GBP # 6 GOLD P.M. EUR my @fixings = (); eval { # Should give no results @fixings = $lbma->dailygoldfixing( year => 4099, month => 1, day => 4 ); }; if ($@) { # Do ... } else { print join( '|', @fixings ), "\n"; }
Ken, Thanks for using LBMA::Statistics. I've added some examples to this feature request. Hope this helps. Regards, Thomas