XBRL - Perl extension for Reading Extensible Business Reporting Language documents
The Extensible Business Reporting Language (XBRL) is a large and complex standard and this module only partially supports the standard.
use XBRL;
my $xbrl_doc = XBRL->new( {file=>"foo.xml", schema_dir="/var/cache/xbrl"});
my $html_report = $doc->get_html_report();
XBRL provides an OO interface for reading Extensible Business Reporting Language documents (XBRL docs).
$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.
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.
my $items = $xbrl_doc->get_item_by_contexts($context_id);
Return an array reference of XBRL::Items which share the same context.
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.
my $all_items = $xbrl_doc->get_all_items();
Returns an array reference to the list of all items.
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.
my $unit = $xbrl_doc->get_unit($unit_id);
Returns unit identified by its id.
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.
my $context = $xbrl_doc->get_contexts($id);
Returns an XBRL::Context object based on the ID passed into the function.
my $taxonomy = $xbrl_doc->get_taxonomy();
Returns an XBRL::Taxonomy instance based on the XBRL document.
my $firm_name = $xbrl_doc->get_compan();
Returns a scalar with the name of the firm issuing the document.
my $report = $xbrl_doc->report_type()
Returns the report type (e.g. 10-Q).
my $date = $xbrl_doc->report_date()
Returns the date of the financial statement
Returns a scalar with the period (e.g. Q2).
There are a gajillion bugs. This module only partially supports the XBRL standard and won't currently work on Windows systems.
Source code, documentation, and bug tracking is hosted at: https://github.com/MarkGannon/XBRL .
Mark Gannon <mark@truenorth.nu>
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.
To install XBRL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XBRL
CPAN shell
perl -MCPAN -e shell install XBRL
For more information on module installation, please visit the detailed CPAN module installation guide.