IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 16, 2006, 11:44:58 AM (20 years ago)
Author:
jhoblitt
Message:

doc update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataStore/lib/DataStore.pm

    r6602 r6603  
    11# Copyright (C) 2006  Joshua Hoblitt
    22#
    3 # $Id: DataStore.pm,v 1.1 2006-03-16 20:56:41 jhoblitt Exp $
     3# $Id: DataStore.pm,v 1.2 2006-03-16 21:44:57 jhoblitt Exp $
    44
    55package DataStore;
     
    3333
    3434This is a convenience module so that that don't have to individualy load (C<use
    35 ...;>) all of the common DataStore inteface modules.  Please see the
    36 POD of the individual modules for usage information.
     35...;>) all of the common DataStore inteface modules.  Please see the POD of the
     36individual modules for usage information.  If this is your browsing of the
     37documentation you may want to start with L<DataStore::Product>.
    3738
    3839=head1 USAGE
     
    4647
    4748None.
     49
     50=head1 EXAMPLE PROGRAM
     51
     52    #!/usr/bin/perl
     53
     54    use strict;
     55    use warnings;
     56
     57    # loads DataStore::*
     58    use DataStore;
     59
     60    my $dsp = DataStore::Product->new(
     61        uri => 'http://example.org/productid/',
     62        last_fileset => 'foobarbaz',
     63    );
     64
     65    # returns a DataStore::Response object
     66    my $response = $dsp->request;
     67
     68    unless ($response->is_success) {
     69        die $response->status;
     70    }
     71
     72    # arrayref of DataStore::FileSet objects
     73    my $filesets = $response->data;
     74
     75    # the query could be a success but still return no filesets
     76    unless ($filesets) {
     77        warn "no filesets returned";
     78        exit(0);
     79    }
     80
     81    # returns a DataStore::Response object
     82    my $response2 = @$filesets[0]->request;
     83
     84    unless ($response2->is_success) {
     85        die $response2->status;
     86    }
     87
     88    # arrayref of DataStore::File objects
     89    my $files = $response->data;
     90
     91    # the query could be a success but still return no files (is that legal?)
     92    unless (@$files) {
     93        warn "no files returned";
     94        exit(0);
     95    }
     96
     97    # requires a filename
     98    my $response3 = @$files[0]->request( filename => '/dev/null' );
     99    unless ($response3->is_success) {
     100        warn $response3->status;
     101        die;
     102    }
     103
     104    # $response3->data is '/dev/null'
    48105
    49106=cut
Note: See TracChangeset for help on using the changeset viewer.