NAME

JSAN::URI - A JavaScript Archive Network (JSAN) Validating Mirror URI

SYNOPSIS

  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";
  }

DESCRIPTION

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

METHODS

new $uri

The new constructor takes a path to the base of a JSAN mirror and creates a handle object for it.

Returns a JSAN::URI object, or undef if not passed a valid url path.

URI

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.

valid

The valid method check to see if the mirror exists, that is has the mirror.conf file, and that matches the expected content.

Returns true if the mirror is valid, or false otherwise.

TO DO

- Add verbose support

- Finish this when the mirrors have mirror.conf files

SUPPORT

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.

AUTHOR

Adam Kennedy <cpan@ali.as>, http://ali.as/

COPYRIGHT

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.