JSAN::URI - A JavaScript Archive Network (JSAN) Validating Mirror URI
my $url = 'http://www.jsan.de'; # Create the mirror handle my $mirror = JSAN::URI->new( $url ); # Check the mirror if ( ! $mirror->valid ) { die "The mirror does not exist"; } if ( $mirror->age > (3600 * 48) ) { die "The mirror is too old"; }
The JavaScript Archive Network (JSAN) uses a mirror synchronisation method originally invented for the Comprehensive Perl Archive Network (CPAN) which involved created a tiny specially named file in the root of the filesystem that contains a timestamp, updated whenever the index is regenerated.
By retrieving and examining this file, it is possible to validate if a given URL actually represents a JSAN mirror, and how up to date that mirror is, compared to the master site.
This module implements the logic required to do this in a reusable form
The new constructor takes a path to the base of a JSAN mirror and creates a handle object for it.
new
Returns a JSAN::URI object, or undef if not passed a valid url path.
JSAN::URI
undef
The URI accessor returns a URI object for the location of the mirror.
URI
The uri accessor returns a string of the location of the mirror.
uri
The valid method check to see if the mirror exists, that is has the mirror.conf file, and that matches the expected content.
valid
Returns true if the mirror is valid, or false otherwise.
- Add verbose support
- Finish this when the mirrors have mirror.conf files
Bugs should be reported via the CPAN bug tracker at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=JSAN-Client
For other issues, contact the author.
Adam Kennedy <cpan@ali.as>, http://ali.as/
Copyright 2005 Adam Kennedy. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
To install JSAN::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm JSAN::Client
CPAN shell
perl -MCPAN -e shell install JSAN::Client
For more information on module installation, please visit the detailed CPAN module installation guide.