NAME

Finance::SE::PPM - Retrieve a person's account status from the Swedish PPM

SYNOPSIS

DESCRIPTION

DO NOT USE THIS MODULE! IT DOES NOT WORK AND WILL NOT BE FIXED!

---------------

Finance::SE::PPM provides a simple interface to retrieve the state of a pension saver's account in the Swedish PPM system.

PPM (Premiepensionsmyndigheten) is a Swedish state authority that handles a part of the pension savings of the Swedish population, collected through taxes on income. PPM gives each pension saver the possibility to choose among a wide range of funds in which to place his/her savings. The saver can change funds as often as wanted, and at no cost. A pension saver's account gives a snapshot of a person's holdings in form of shares in various funds at a given time.

PPM has a web site (www.ppm.nu) where one's account can be monitored and fund transactions planned. This web site requires some credentials for login.

Finance::SE::PPM offers an object oriented interface to performing most of the fund related transactions available on PPM's web site. It is basically a wrapper around PPM's web portal and is designed to be integrated into some more general Âaccount monitoring and managing tool.

REQUIREMENTS

Finance::SE::PPM requires the following modules:

Crypt::SSLeay
Class::XPath
HTTP::TreeBuilder

STATUS

This module is still under development, and should be handled as fragile beta code. So far only functions related to retrieving an account status are implemented. Functions to handle fond profile modification are still to come.

API

new Finance::SE::PPM(personnummer => $pnr, pincode => $pin, debug => $d)

ARGS

$pnr the pension saver's personnummer, ie his 12 digit identity code.

$pin his 5 digit pin code.

$d (optional) debug level, where $d is a positive digit. the higher the more verbose. 0 by default.

RETURN

a Finance::SE::PPM object.

DESC

new creates an object holding all information required to later log onto a person's PPM account via PPM's website.

EXAMPLE
my $ppm  = new Finance::SE::PPM(personnummer => '197504010666', pincode => '12345');
my $ppm2 = new Finance::SE::PPM(personnummer => '197504010666', pincode => '12345', debug => 3);

setProxy($proxy)

ARGS

$proxy a string of the form "<PROXY_NAME_OR_IP>:<PROXY_PORT>"

RETURN

nothing.

DESC

Specify which proxy the UserAgent shall use to connect to PPM's web site, if any. Finance::SE::PPM's user agent uses Crypt::SSLeay which supports even Squid proxying.

EXAMPLE
$ppm->setProxy("proxy:8080");
or 
$ppm->setProxy("192.168.0.1:8080");

fetchAccountStatus()

ARGS

none.

RETURN

nothing.

DESC

Connect to PPM's web site, logon using the credentials given when creating the PPM object, and import the account status into the PPM object, to be later used and analysed.

EXAMPLE
$ppm->fetchAccountStatus();
ERROR

Die if cannot login onto web site or cannot recognize the page retrieved.

getAccountFunds()

ARGS

none.

RETURN

an array of fund hashes.

DESC

Returns an array of fund hashes. Each fund hashs describe the status of the pension saver's ownings in a given fund. All amounts and prices are given in Swedish crowns. The hash contains the following keys:

DATE the current date, in format YYYY-MM-DD
PNR the saver's personal number
ID the fund PPM ID code
NAME the fund's name
SHARE_CNT the number of shares owned in that fund
SHARE_PRICE the value of one share that day
SHARE_VALUE the current total value of the pension saver's holdings in that fund that day
CHOSEN_PCT the initial percentage of the saver's holdings that should be invested in that fund
ACTUAL_PCT the real percentage, taking in account the growths (or losses) in other funds
EXAMPLE
print Dumper($ppm->getAccountFunds);

isChangingFunds()

ARGS

none.

RETURN

1 if the person is currently changing funds, 0 otherwise.

DESC

Check whether the person's account is currently blocked due to a change in the fund profile. You must have called fetchAccountStatus first.

EXAMPLE
if ($ppm->isChangingFunds) {
    print "you are currently changing fund profile\n";
}

EXAMPLE

See the script myppmtoday.pl distributed together with Finance::SE::PPM. Run './myppmtoday.pl -h' to get some help.

BUGS

This module has been tested in very few environments. Some bugs might appear in your environment that the author did not experience. Further more, PPM may change the layout of their web site, in which case the parsing code will crash.

In any case, please send a bug report to <erwan@cpan.org>. Thanks!

AUTHOR

Erwan Lemmonier, <erwan@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2004 by Erwan Lemmonier

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 580:

Non-ASCII character seen before =encoding in 'Âaccount'. Assuming CP1252