NAME
WWW::ASN - Retrieve learning objectives from Achievement Standards Network
SYNOPSIS
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 }) {
...
}
}
}
}
DESCRIPTION
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
Cache files
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.
ATTRIBUTES
jurisdictions_cache
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.
subjects_cache
Optional. The name of a file containing the XML data from http://asn.jesandco.org/api/1/subjects
If the file does not exist, it will be created.
Leave this option undefined to force retrieval each time "subjects" is called.
METHODS
In addition to get/set methods for each of the attributes above, the following methods can be called:
jurisdictions
Returns an array reference of WWW::ASN::Jurisdiction objects.
subjects
Returns an array reference of WWW::ASN::Subject objects.
TODO
Currently you need to start with a jurisdiction (either from calling
jurisdictions
on aWWW::ASN
object, or by creating one with anabbreviation
attribute (and optionally other attributes), then looping its documents, then fetching their standards.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.
AUTHOR
Mark A. Stratman, <stratman at gmail.com>
SEE ALSO
ACKNOWLEDGEMENTS
This library retrieves and manipulates data from the Achievement Standards Network. http://asn.jesandco.org/
LICENSE AND COPYRIGHT
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.