WWW::Myki::Transaction - Class for operations with a Myki transaction
# Print the date, time, service, description and cost of our last 15 transactions foreach my $trip ( $card->transactions ) { printf( "%10s %8s %-10s %-20s %-5s\n", $trip->date, $trip->time, $trip->service, $trip->desc, $trip->debit ) } # Maybe do a rough calculation of the cost of public transport per day use List::Util qw( sum ); my %sum; foreach my $t ( $card->transactions ) { ( my $cost = $t->debit ) =~ s/(-|\$|\s)//g; $sum{ $t->date } += $cost; } print "Average daily cost of travel on public transport: ", ( ( sum values %sum ) / ( keys %sum ) ), "\n"; # Still cheaper than environmental cost of driving to work
WWW::Myki::Transaction is a class providing Myki transaction querying functionality for registered Myki users. Each WWW::Myki::Transaction object is representative of a single Myki card transaction.
Please note that you're are not meant to call the constructor yourself, instead a WWW::Myki::Transaction object will be created automatically for you by calls to methods in a WWW::Myki::Card object like transactions.
Return the date of the transaction using the format DD/MM/YYYY.
Print the time of the last transaction using the format HH:MM:SS AM/PM.
The type of service for the last transaction (e.g. busi or train)
The transit zone for the last transaction.
A description of the transaction usually including the start and destination localities and a service name. This may be a hyphen (-) where no information is provided.
The amount debited for the transaction using in decimal currency format (i.e. $D.DD) where present, or a hyphen where no debit was made.
The amount credited for the transaction using in decimal currency format (i.e. $D.DD) where present, or a hyphen where no credit was made.
The balance of the associated Myki card at the time this transaction was completed in decimal curreny format.
The type of transaction made (e.g. Touch-on or Touch-off).
Luke Poskitt, <ltp at cpan.org>
<ltp at cpan.org>
Please report any bugs or feature requests to bug-www-myki-transaction at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Myki-Transaction. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-www-myki-transaction at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc WWW::Myki::Transaction
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Myki-Transaction
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/WWW-Myki-Transaction
CPAN Ratings
http://cpanratings.perl.org/d/WWW-Myki-Transaction
Search CPAN
http://search.cpan.org/dist/WWW-Myki-Transaction/
Copyright 2012 Luke Poskitt.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
WWW::Myki, WWW::Myki::Card
To install WWW::Myki, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Myki
CPAN shell
perl -MCPAN -e shell install WWW::Myki
For more information on module installation, please visit the detailed CPAN module installation guide.