The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

JSAN::Transport - JavaScript Archive Network Transport and Resources

SYNOPSIS

  # Create a client
  JSAN::Transport->init(
        verbose       => 1,
        mirror_remote => 'http://openjsan.org/',
        mirror_local  => '~/.jsan',
        );
  
  # Retrieve a file
  JSAN::Transport->file_get( 'index.sqlite' );
  
  # Get an index database connection
  JSAN::Transport->index_dbh;
 

DESCRIPTION

JSAN::Transport provides the primary programatic interface for creating and manipulating a JSAN client transport and resource manager.

It controls connection to JSAN, retrieval and mirroring of files, and database connectivity to the JSAN index.

METHODS

init param => $value, ...

The init method initializes the JSAN client adapter. It takes a set of parameters and initializes the JSAN::Transport class.

Once you have initialized JSAN::Transport, any further attempts to do so will result in an exception being thrown.

The init method is also aliased to import, so that you can do something like the following.

  # Initialize JSAN::Transport at use-time
  use JSAN::Transport verbose       => 1,
                      mirror_remote => 'http://openjsan.org',
                      mirror_local  => '~/.jsan';
mirror_remote

The mirror_remoter param specifies the JSAN mirror to be retrieve packages and other files from. If you do not specify a location, a default value of http://openjsan.org will be used.

mirror_local

A JSAN client downloads and caches various files from the repository. This primarily means the JSAN packages themselves, but also includes things like the index and other control files. This effectively creates a partial local mirror of the repository, although it will also include some working files not found on the server.

The mirror_local param specifies the path for the local mirror. If the path provided does not exist, the constructor will attempt to create it. If creation fails the constructor will throw an exception.

verbose

Mainly used for console interfaces for user feedback, the verbose flag causes the client to print various information to STDOUT as it does various tasks.

Returns true, or will throw an exception (i.e. die) on error.

The mirror_location accessor returns the HTML::Location of the URI to local path map.

The mirror_remote accessor returns the location of the remote mirror configured when the object was created.

The mirror_local accessor returns the location of the local mirror configured when the object was created.

The verbose accessor returns the boolean flag on whether the object is running in verbose mode.

file_location path/to/file.txt

The file_location method takes the path of a file within the repository, and returns a HTML::Location object representing it's location on both the server, and on the local filesystem.

Paths should always be provided in unix/web format, not the local filesystem's format.

Returns a HTML::Location or throws an exception if passed a bad path.

file_get path/to/file.txt

The file_get method takes the path of a file within the repository, and fetches it from the remote repository, storing it at the appropriate local path.

As all file_ operations, paths should always be provided in unix/web format, not the local filesystem's format.

Returns the HTML::Location for the file if retrieved successfully, false ('') if the file did not exist in the repository, or undef on error.

file_mirror path/to/file.txt

The file_mirror method takes the path of a file within the repository, and mirrors it from the remote repository, storing it at the appropriate local path.

Using this method if preferable for items like indexs for which want to ensure you have the current version, but do not want to freshly download each time.

As all file_ operations, paths should always be provided in unix/web format, not the local filesystem's format.

Returns the HTML::Location for the file if mirrored successfully, false ('') if the file did not exist in the repository, or undef on error.

index_file

The index_file method checks that the SQLite index is up to date, and returns the path to it on the filesystem.

index_dsn

The index_dsn method checks the SQLite index is up to date, and return the DBI dsn for the index database.

index_dbh

The index_dbh method check the SQLite index is up to date, and return a database connection to the index database.

TO DO

- Add verbose support

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.