View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Luke Poskitt > WWW-Myki > WWW::Myki::Card



Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  


WWW::Myki::Card - Class for operations with a Myki card

VERSION 0.01 ^


    # Print my Myki card money balance
    my $balance = $card->money;

    # What time did I stumble home last night?
    print $card->last_transaction;

    # Yeesh, really?  How?
    print $card->service;

    # Ooooohh, now I remember.


WWW::Myki::Card is a class providing account and card management and querying functionality for registered Myki users.

Please note that you're are not meant to call the constructor yourself, instead a WWW::Myki::Card object will be created automatically for you by calls to methods in a WWW::Myki object like cards.



Returns the card ID number.


Returns the name of the registered card holder.


Returns the balance of Myki money on the card.


Returns the balance of the active Myki pass (if any) on the card.


Returns the card type.


Returns the card expiry date in the format DD Mon YYYY, where Mon is the abbreviated month name.


Returns the card status.


Returns the value of any Myki money top up in progress - this is money that has been added by a top up, but may not yet have been credited to the card.


Returns the total of the balance of Myki money and the balance of Myki money top in progress on the card.


Returns the balance of the current active Myki pass (if any) on the card.


Returns the balance of the current inactive Myki pass (if any) on the card.


Returns the last transaction time and date for the card in the format; DD Mon YYYY HH:MM:SS AM/PM, where Mon is the abbreviated month name.


  foreach my $trip ( $card->transactions ) {
    printf( "%10s %8s %-10s %-20s\n", $trip->date, $trip->time, $trip->service, $trip->desc )

  # Prints a formatted list of the last 15 transactions for this card - e.g.
  # 29/05/2012 17:28:38 Bus        Surburbia,Route SUB16out_new
  # 29/05/2012 08:08:12 Bus        Metro,Route MET16in_new

Returns an array of WWW::Myki::Transaction objects representing the last 15 transactions for the card, or an empty array if there are no recorded transactions.

See WWW::Myki::Transaction for more information on transactions. Transaction data is cached on the initial invocation to increase the performance of subsequent calls and reduce unnecessary communication with the Myki portal. This is probably what you want, but if you really do want to force transaction data to be refreshed then you can call the method with the argument refresh set to a true value. e.g.

  $card->transactions( refresh => 1 );

Please note that this will incur a performance penalty.


When a WWW::Myki::Card object is created, the card data is cached to improve the performance of subsequent method calls and reduce unessecary network communication. This is probably what you want, however if you do want to force the object to update its cached data for any reason, then you can call refresh. Note that doing so will incur a performance penalty.


Luke Poskitt, <ltp at>


Please report any bugs or feature requests to bug-www-myki-card at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc WWW::Myki::Card

You can also look for information at:


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 for more information.


WWW::Myki, WWW::Myki::Transaction

syntax highlighting: