The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

XBRL - Perl extension for Reading Extensible Business Reporting Language documents

CAVEAT UTILITOR

The Extensible Business Reporting Language (XBRL) is a large and complex standard and this module only partially supports the standard.

SYNOPSIS

use XBRL;

my $xbrl_doc = XBRL->new( {file=>"foo.xml", schema_dir="/var/cache/xbrl"});

my $html_report = $doc->get_html_report();

DESCRIPTION

XBRL provides an OO interface for reading Extensible Business Reporting Language documents (XBRL docs).

new
        $xbrl_doc = XBRL->new ( { file="foo.xml", schema_dir="/var/cache/xbrl" } );

file -- This option specifies the main XBRL doc instance.

schema_dir -- allows the caller to specify a directory for storing ancillary schemas required by the instance. Specifying this directory means those schemas won't have to be downloaded each time an XBRL doc is parsed. If no schema_dir is specified, the module will create a temporary directory to store any needed schemas and delete it when the module goes out of scope.

get_html_report

Processes the XBRL doc into an HTML document.

        $html = $xbrl_doc->get_html_report({ css_file => 'style.css'} ) 

The optional css_file allows an external CSS stylesheet to be included in the report for controlling the presentation of the report.

        $html = $xbrl_doc->get_html_report({ css_block => $CSS } ) 

The optional css_block parameter takes a string of CSS instructions and includes them in the reports header section.

If neither option is specified, a default CSS style is included in the header of the report.

get_item_by_contexts
        my $items = $xbrl_doc->get_item_by_contexts($context_id);

Return an array reference of XBRL::Items which share the same context.

get_item_all_contexts
        my $revenue_items = $xbrl_doc->get_item_all_contexts("us-gaap:Revenues");

Takes an item name and returns an array reference of all other items with the same name.

get_all_items
        my $all_items = $xbrl_doc->get_all_items(); 

Returns an array reference to the list of all items.

get_item
        my $item = $xbrl_doc->get_item($item_name, $context_id) 

Returns an item identified by the its name and context. Undef if no item of that description exists.

get_unit
        my $unit = $xbrl_doc->get_unit($unit_id);

Returns unit identified by its id.

get_all_contexts
        my $contexts = $xbrl_doc->get_all_contexts();

Returns a hash reference where the keys are the context ids and the values are XBRL::Context objects.

get_context
        my $context = $xbrl_doc->get_contexts($id);

Returns an XBRL::Context object based on the ID passed into the function.

get_taxonomy
        my $taxonomy = $xbrl_doc->get_taxonomy();

Returns an XBRL::Taxonomy instance based on the XBRL document.

get_company
        my $firm_name = $xbrl_doc->get_compan();

Returns a scalar with the name of the firm issuing the document.

report_type
        my $report = $xbrl_doc->report_type()

Returns the report type (e.g. 10-Q).

report_date
        my $date = $xbrl_doc->report_date()

Returns the date of the financial statement

report_period

Returns a scalar with the period (e.g. Q2).

BUGS AND LIMITATIONS

There are a gajillion bugs. This module only partially supports the XBRL standard and won't currently work on Windows systems.

SEE ALSO

Source code, documentation, and bug tracking is hosted at: https://github.com/MarkGannon/XBRL .

AUTHOR

Mark Gannon <mark@truenorth.nu>

COPYRIGHT AND LICENSE

Copyright (C) 2012 by Mark Gannon

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10 or, at your option, any later version of Perl 5 you may have available.