r31736 - in /branches/upstream/libfinance-bank-ie-permanenttsb-perl/current: ./ lib/ lib/Finance/Bank/IE/ lib/Finance/Bank/IE/templates/ t/

antonio-guest at users.alioth.debian.org antonio-guest at users.alioth.debian.org
Sun Mar 8 22:41:58 UTC 2009


Author: antonio-guest
Date: Sun Mar  8 22:41:54 2009
New Revision: 31736

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=31736
Log:
[svn-upgrade] Integrating new upstream version, libfinance-bank-ie-permanenttsb-perl (0.4)

Added:
    branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/COPYING
    branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/t/
    branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/t/Finance-Bank-IE-PermanentTSB.t
Modified:
    branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/Changes
    branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/MANIFEST
    branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/META.yml
    branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/TODO
    branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/lib/Finance/Bank/IE/PermanentTSB.pm
    branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/lib/Finance/Bank/IE/templates/gnuplot_print.gp
    branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/lib/ptsb_util.pm
    branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/ptsb

Added: branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/COPYING
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/COPYING?rev=31736&op=file
==============================================================================
--- branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/COPYING (added)
+++ branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/COPYING Sun Mar  8 22:41:54 2009
@@ -1,0 +1,12 @@
+AUTHOR
+
+    Angelo "pallotron" Failla, <pallotron at freaknet.org> -
+    <http://www.pallotron.net> - <http://www.vitadiunsysadmin.net>
+
+COPYRIGHT AND LICENSE
+
+    Copyright (C) 2009 by Angelo "pallotron" Failla
+
+    This library is free software; you can redistribute it and/or modify it
+    under the same terms as Perl itself, either Perl version 5.8.8 or, at
+    your option, any later version of Perl 5 you may have available.

Modified: branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/Changes?rev=31736&op=diff
==============================================================================
--- branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/Changes (original)
+++ branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/Changes Sun Mar  8 22:41:54 2009
@@ -1,6 +1,10 @@
 Revision history for Perl extension Finance::Bank::IE::PermanentTSB.
 
-0.2 Fri Jan 30 13:49:07 GMT 2009
+0.4
+
+    - Implement CSV export
+
+0.2 and 0.3 Fri Jan 30 13:49:07 GMT 2009
 
     - Implemented graphs using gnuplot
       Graph can be viewed and saved on the filesystem using

Modified: branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/MANIFEST?rev=31736&op=diff
==============================================================================
--- branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/MANIFEST (original)
+++ branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/MANIFEST Sun Mar  8 22:41:54 2009
@@ -2,9 +2,11 @@
 Makefile.PL
 MANIFEST
 README
+t/Finance-Bank-IE-PermanentTSB.t
 lib/Finance/Bank/IE/PermanentTSB.pm
 lib/Finance/Bank/IE/templates/gnuplot_print.gp
 lib/ptsb_util.pm
 ptsb
 TODO
 META.yml #Module meta-data (added by MakeMaker)
+COPYING

Modified: branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/META.yml?rev=31736&op=diff
==============================================================================
--- branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/META.yml (original)
+++ branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/META.yml Sun Mar  8 22:41:54 2009
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Finance-Bank-IE-PermanentTSB
-version:      0.2
+version:      0.4
 version_from: lib/Finance/Bank/IE/PermanentTSB.pm
 installdirs:  site
 requires:

Modified: branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/TODO
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/TODO?rev=31736&op=diff
==============================================================================
--- branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/TODO (original)
+++ branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/TODO Sun Mar  8 22:41:54 2009
@@ -2,6 +2,8 @@
 ====
 
 - convert to OOP rather than functional programming
+- mobile_topup and money_transfer (with check >50)
+- Graphical Interface?
 
 IN PROGRESS
 ===========

Modified: branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/lib/Finance/Bank/IE/PermanentTSB.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/lib/Finance/Bank/IE/PermanentTSB.pm?rev=31736&op=diff
==============================================================================
--- branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/lib/Finance/Bank/IE/PermanentTSB.pm (original)
+++ branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/lib/Finance/Bank/IE/PermanentTSB.pm Sun Mar  8 22:41:54 2009
@@ -30,7 +30,7 @@
 
 package Finance::Bank::IE::PermanentTSB;
 
-our $VERSION = '0.2';
+our $VERSION = '0.4';
 
 use strict;
 use warnings;
@@ -101,8 +101,6 @@
     );
 
 =head2 C<$boolean = login($config_ref)> - B<private>
-
-=over
 
 B<This is a private function used by other function within the module.
 You don't need to call it directly from you code!>
@@ -117,9 +115,8 @@
 persist on your filesystem until you reboot your machine (and /var/tmp
 get clean at boot time).
 
-=back
-
 =cut
+
 sub login {
     my $self = shift;
     my $config_ref = shift;
@@ -233,10 +230,12 @@
                 "this 3 times in a row or you account will be locked!");
             return undef;
         }
+        print $content if($config_ref->{debug});
         set_pan_fields($agent, $config_ref);
         $res = $agent->submit();
         $agent->save_content("./step2_pan_result.html") 
             if $config_ref->{debug};
+        print $content if($config_ref->{debug});
     }
 
     return 1;
@@ -244,8 +243,6 @@
 }
 
 =head2 C<set_pan_fields($config_ref)> - B<private>
-
-=over
 
 B<This is a private function used by other function within the module.
 You don't need to call it directly from you code!>
@@ -269,8 +266,6 @@
 The function will fill out the form providing 2,3,4 respectively.
 
 This function doesn't return anything.
-
-=back
 
 =cut
 
@@ -308,8 +303,6 @@
 
 =head2 C<@accounts_balance = check_balance($config_ref)> - B<public>
 
-=over
-
 This function require the configuration hash reference as argument.
 It returns an reference to an array of hashes, one hash for each account. 
 In case of error it return undef;
@@ -318,7 +311,7 @@
 =over
 
 =item * 'accname': account name, i.e. "Switch Current A/C".
-    
+
 =item * 'accno': account number. An integer representing the last 4 digits of the
 account.
 
@@ -352,8 +345,6 @@
         );
     }
 
-=back
-
 =cut
 
 sub check_balance {
@@ -367,8 +358,6 @@
  
     $self->login($config_ref) or return undef;
 
-    $res = $agent->get($BASEURL . '/online/Account.aspx');
-    print $agent->content if($config_ref->{debug});
     my $p = HTML::TokeParser->new(\$agent->content());
     my $i = 0;
     my @array;
@@ -406,8 +395,6 @@
 =head2 C<@account_statement = account_statement($config_ref, $acc_type,
 $acc_no, $from, $to, [$type])> - B<public>
 
-=over
-
 This function requires 4 mandatory arguments, the 5th is optional.
 
 =over
@@ -441,8 +428,6 @@
     }
 
 Undef is returned in case of error;
-
-=back
 
 =cut
 
@@ -741,17 +726,13 @@
 
 =head1 MODULE HOMEPAGES
 
+=over
+
 =item * Project homepage on Google code (with SVN repository):
 
-=over
-
 L<http://code.google.com/p/finance-bank-ie-permanenttsb>
 
-=back
-
 =item * Project homepage on CPAN.org:
-
-=over
 
 L<http://search.cpan.org/~pallotron/Finance-Bank-IE-PermanentTSB/>
 

Modified: branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/lib/Finance/Bank/IE/templates/gnuplot_print.gp
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/lib/Finance/Bank/IE/templates/gnuplot_print.gp?rev=31736&op=diff
==============================================================================
--- branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/lib/Finance/Bank/IE/templates/gnuplot_print.gp (original)
+++ branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/lib/Finance/Bank/IE/templates/gnuplot_print.gp Sun Mar  8 22:41:54 2009
@@ -18,4 +18,8 @@
 
 set terminal wxt
 replot
+
+set terminal dumb
+replot
+
 pause -1 "Hit return to exit"

Modified: branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/lib/ptsb_util.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/lib/ptsb_util.pm?rev=31736&op=diff
==============================================================================
--- branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/lib/ptsb_util.pm (original)
+++ branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/lib/ptsb_util.pm Sun Mar  8 22:41:54 2009
@@ -2,7 +2,7 @@
 
 =head1 NAME
 
-ptsb_util
+ptsb_util - functions used by the Finance::Bank::IE::PermanentTSB CLI
 
 This is a package which contains a set of functions used by the CLI utility.
 
@@ -134,6 +134,7 @@
         "expr|e=s" => \$cf->{'expr'},
         "i|image=s" => \$cf->{'image'},
         "g|graph" => \$cf->{'graph'},
+        "o|output=s" => \$cf->{'csv'},
     ) or $error = 1;
 
     usage if($error or $cf->{'help'});
@@ -175,7 +176,6 @@
                 exit -1;
             }
         }
-        
     }
 
     if(defined $cf->{acc_type}) {
@@ -293,7 +293,12 @@
         $cf->{todate});
 
 
-    if(not defined $balance) {
+    if(defined $balance->[0]->{accno}) {
+        if($balance->[0]->{accno} eq '') {
+            print "Error while retrieving the content...\n";
+            return;
+        }
+    } else {
         exit -1;
     }
 
@@ -328,6 +333,7 @@
     my $gnuplot_tmpfile;
 
     my $error = 0;
+    my $csv = 0;
 
     my %config = (
         "open24numba" => $cf->{open24_num},
@@ -346,10 +352,19 @@
     );
 
     if(not defined $statement) {
-        exit -1;
+        return;
     }
 
     print STDERR Dumper(\$statement) if($cf->{debug});
+
+    if(defined $cf->{csv}) {
+        if(open(CSV, ">".$cf->{csv})) {
+            $csv = 1;
+        } else {
+            print STDERR "Error opening file ".$cf->{csv}.": $!\n";
+            $csv = 0;
+        }
+    }
 
     print_statement_header($cf->{no_balance});
 
@@ -442,9 +457,17 @@
             } else {
                 $counter_deposit += $row->{euro_amount};
             }
-        }
-
-    }
+            if($csv) {
+                printf CSV "%s,%s,%s", $row->{date}, $row->{description},
+                    $row->{euro_amount};
+                print CSV ",", $row->{balance} if(not $cf->{no_balance});
+                print CSV "\n";
+            }
+        }
+
+    }
+
+    close CSV if ($csv);
 
     $gnuplot_tmpfile .=
         $statement->[$#$statement]->{date}."\t".

Modified: branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/ptsb
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/ptsb?rev=31736&op=diff
==============================================================================
--- branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/ptsb (original)
+++ branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/ptsb Sun Mar  8 22:41:54 2009
@@ -48,7 +48,7 @@
 
 =head1 NAME
 
-ptsb - Interact with you Permanent TSB homebanking!
+ptsb - Interact with you Permanent TSB homebanking from your shell!
 
 =head1 SYNOPSIS
 
@@ -56,20 +56,26 @@
 
 =head2 Print accounts balance:
 
-=over 2
-
-ptsb [ -F F</path/of/conf/file> ] -b
+=over
+
+=item C<ptsb [ -F F</path/of/conf/file> ] -b>
 
 =back
 
 =head2 Print account statement:
 
-=over 2
-
-ptsb [ -F F</path/of/conf/file> ] -s -a c -n <4digits>
-       -f yyyy/mm/dd  -t yyyy/mm/dd
-
-=back
+=over
+
+=item C<ptsb [ -F F</path/of/conf/file> ] -s -a c -n <4digits> -f yyyy/mm/dd  -t yyyy/mm/dd>
+
+=back
+
+If your are running Linux you can use the F<date --date> command to simplify the date range definition.
+You can put these aliases on your F<~/.bashrc>:
+
+    alias ptsb_stat='ptsb --statement -a c -n xyzt'
+    alias ptst_last_month="statement_current -f `date +%Y/%m/%d --date='1 month ago'` -t `date +%Y/%m/%d`"
+
 
 =head1 OPTIONS
 
@@ -90,7 +96,7 @@
 Please refer to manual page to see how this file is built.
 
 =item B<-b | --balance>
-                     
+
 print account balance
 
 =item B<-s | --statement>
@@ -147,6 +153,15 @@
 =item B<-i F<path> | --image F<path>>
 
 Save PNG image in path.
+
+=item B<-o F<filename> | --output F<filename>>
+
+Save the output of the statement inside a CSV file named F<filename>.
+CSV format is:
+
+date,description,amount,balance
+
+last field presence depends on the -N flag.
 
 =item B<-v | --version>
 
@@ -185,6 +200,8 @@
 
 =head1 SEE ALSO
 
+=over
+
 =item * B<Official CPAN page for Finance::Bank::IE::PermanentTSB>
 
 L<http://search.cpan.org/~pallotron/Finance-Bank-IE-PermanentTSB/lib/Finance/Bank/IE/PermanentTSB.pm>
@@ -200,6 +217,8 @@
 =item * B<Author homepage on CPAN>
 
 L<http://search.cpan.org/~pallotron/>
+
+=back
 
 =head1 AUTHOR
 

Added: branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/t/Finance-Bank-IE-PermanentTSB.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/t/Finance-Bank-IE-PermanentTSB.t?rev=31736&op=file
==============================================================================
--- branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/t/Finance-Bank-IE-PermanentTSB.t (added)
+++ branches/upstream/libfinance-bank-ie-permanenttsb-perl/current/t/Finance-Bank-IE-PermanentTSB.t Sun Mar  8 22:41:54 2009
@@ -1,0 +1,10 @@
+use Test::MockObject;
+use Data::Dumper;
+
+use Test::More tests => 1;
+use strict;
+use warnings;
+
+BEGIN { 
+    use_ok('Finance::Bank::IE::PermanentTSB') 
+};




More information about the Pkg-perl-cvs-commits mailing list