WWW::ASN - Retrieve learning objectives from Achievement Standards Network
Without using caches:
use WWW::ASN; my $asn = WWW::ASN->new; for my $jurisdiction (@{ $asn->jurisdictions }) { # $jurisdiction is a WWW::ASN::Jurisdiction object if ($jurisdictions->name =~ /Common Core/i) { for my $document (@{ $jurisdictions->documents({ status => 'published' }) }) { # $document is a WWW::ASN::Document object for my $standard (@{ $document->standards }) { # $standard is a WWW::ASN::Standard document print $standard->identifier, ": ", $standard->text; ... for my $sub_standard (@{ $standard->child_standards }) { ... } } } } }
Another example, With cache files (recommended, if possible):
use WWW::ASN; use URI::Escape qw(uri_escape); my $asn = WWW::ASN->new({ jurisdictions_cache => 'jurisdictions.xml', subjects_cache => 'subjects.xml', }); for my $jurisdiction (@{ $asn->jurisdictions }) { my $docs_cache = 'doclist_' . $jurisdiction->abbreviation . '.xml'; for my $doc (@{ $jurisdictions->documents({ cache_file => $docs_cache }) }) { # Set these cache values before calling standards() $doc->details_cache_file( "doc_" . $jurisdiction->abbreviation . '_details_' . uri_escape($doc->id) ); $doc->manifest_cache_file( "doc_" . $jurisdiction->abbreviation . '_manifest_' . uri_escape($doc->id); ); for my $standard (@{ $document->standards }) { # $standard is a WWW::ASN::Standard document ... for my $sub_standard (@{ $standard->child_standards }) { ... } } } }
This module allows you to retrieve standards documents from the Achievement Standards Network (http://asn.jesandco.org/).
As illustrated in the "SYNOPSIS", you will typically first retrieve a jurisdiction such as a state, or other organization that creates standards documents. From this jurisdiction you can then retrieve specific documents.
Note: Because this is such a niche module and there aren't many expected users, some of the documentation may take for granted your familiarity with the Achievement Standards Network. If you have difficulties using this module, please feel free to contact the author with any questions
Many of the methods in these modules allow for the use of cache files. The main purpose of these options is to allow you to be a good citizen and avoid unnecessary hits to the ASN website during your development and testing.
Using them is very simple: Just provide a file name. That's it!
When a filename is provided it will be used instead of downloading the data again - unless the file doesn't exist, in which case the data will be downloaded and saved to the file.
Optional. The name of a file containing the XML data from http://asn.jesandco.org/api/1/jurisdictions
If the file does not exist, it will be created.
Leave this option undefined to force retrieval each time "jurisdictions" is called.
Optional. The name of a file containing the XML data from http://asn.jesandco.org/api/1/subjects
Leave this option undefined to force retrieval each time "subjects" is called.
In addition to get/set methods for each of the attributes above, the following methods can be called:
Returns an array reference of WWW::ASN::Jurisdiction objects.
Returns an array reference of WWW::ASN::Subject objects.
Currently you need to start with a jurisdiction (either from calling jurisdictions on a WWW::ASN object, or by creating one with an abbreviation attribute (and optionally other attributes), then looping its documents, then fetching their standards.
jurisdictions
WWW::ASN
abbreviation
Ideally the interface should give you more direct routes to get to the data you're interested in.
When a document creates a WWW::ASN::Standard object, it has to fetch two documents, the "details" xml and the "manifest" json.
Ideally this would get everything from the "details" document. We use both though, since it's simpler and took less time to parse the manifest than the xml.
Investigate the feasibility of interfacing with the SPARQL endpoint to allow for more powerful queries.
e.g. get a list of recently updated documents.
Mark A. Stratman, <stratman at gmail.com>
<stratman at gmail.com>
WWW::ASN::Jurisdiction
WWW::ASN::Document
WWW::ASN::Standard
WWW::ASN::Subject
This library retrieves and manipulates data from the Achievement Standards Network. http://asn.jesandco.org/
Copyright 2012 Mark A. Stratman.
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 http://dev.perl.org/licenses/ for more information.
To install WWW::ASN, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::ASN
CPAN shell
perl -MCPAN -e shell install WWW::ASN
For more information on module installation, please visit the detailed CPAN module installation guide.