our
$VERSION
=
'1.23_01'
;
sub
methods {
return
(
sixfunds
=> \
&sixfunds
); }
sub
labels {
return
(
sixfunds
=> [
qw/name date time price last currency p_change/
] );
}
sub
sixfunds {
my
$quoter
=
shift
;
my
@symbols
=
@_
;
return
unless
@symbols
;
my
(
$ua
,
$reply
,
%q
);
foreach
my
$symbol
(
@symbols
) {
$ua
=
$quoter
->user_agent;
$q
{
$symbol
,
'success'
} = 0;
$q
{
$symbol
,
'name'
} =
$symbol
;
$q
{
$symbol
,
'symbol'
} =
$symbol
;
$reply
=
$ua
->request( GET(
$url
.
$symbol
) );
if
( !
$reply
->is_success ) {
$q
{
$symbol
,
'errormsg'
} =
'HTTP failure'
;
}
else
{
if
(
$reply
->content
=~ />([A-Z]{3})
 
;<\/td><td.+?id=
"mop_ClosingPrice"
.+?>([0-9.]+)<\/td>/
)
{
$q
{
$symbol
,
'currency'
} = $1;
$q
{
$symbol
,
'last'
} = $2;
$q
{
$symbol
,
'success'
} = 1;
}
if
(
$reply
->content
=~ /<td.+?id=
"mop_LastDate"
.+?>([0-3][0-9]\.[01][0-9]\.[0-9]{4})<\/td>/
)
{
$quoter
->store_date( \
%q
,
$symbol
, {
eurodate
=> $1 } );
}
if
(
$reply
->content
=~ /<td.+?id=
"mop_LastTime"
.+?>([0-2][0-9]:[0-5][0-9]:[0-5][0-9])<\/td>/
)
{
$q
{
$symbol
,
'time'
} = $1;
}
if
(
$reply
->content
=~ /<td.+?id=
"mop_ClosingDelta"
.+?>(-?[0-9.]+)%<\/td>/ )
{
$q
{
$symbol
,
'p_change'
} = $1;
}
}
}
return
wantarray
?
%q
: \
%q
;
}