IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6603


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

doc update

Location:
trunk/DataStore/lib
Files:
8 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
  • trunk/DataStore/lib/DataStore/File.pm

    r6601 r6603  
    11# Copyright (C) 2006  Joshua Hoblitt
    22#
    3 # $Id: File.pm,v 1.6 2006-03-16 02:47:09 jhoblitt Exp $
     3# $Id: File.pm,v 1.7 2006-03-16 21:44:58 jhoblitt Exp $
    44
    55package DataStore::File;
     
    5252
    5353=head1 DESCRIPTION
     54
     55This class I<isa> L<DataStore::Record>
    5456
    5557=head1 USAGE
     
    143145=over 4
    144146
    145 =item * C<uri>
    146 
    147 Basic accessor.
    148 
    149 =item * C<fileid>
    150 
    151 Basic accessor.
    152 
    153 =item * C<bytes>
    154 
    155 Basic accessor.
    156 
    157 =item * C<md5sum>
    158 
    159 Basic accessor.
    160 
    161 =item * C<type>
     147=item * C<uri()>
     148
     149Basic accessor.
     150
     151=item * C<fileid()>
     152
     153Basic accessor.
     154
     155=item * C<bytes()>
     156
     157Basic accessor.
     158
     159=item * C<md5sum()>
     160
     161Basic accessor.
     162
     163=item * C<type()>
    162164
    163165Basic accessor.
  • trunk/DataStore/lib/DataStore/File/Parser.pm

    r6501 r6603  
    11# Copyright (C) 2006  Joshua Hoblitt
    22#
    3 # $Id: Parser.pm,v 1.6 2006-02-28 03:02:12 jhoblitt Exp $
     3# $Id: Parser.pm,v 1.7 2006-03-16 21:44:58 jhoblitt Exp $
    44
    55package DataStore::File::Parser;
     
    2828=head1 NAME
    2929
    30 DataStore::File::Parser - parses the DataStore 'File list' format
     30DataStore::File::Parser - parses the DataStore 'File' list format
    3131
    3232=head1 SYNOPSIS
     
    3434    use DataStore::File::Parser;
    3535
    36     my $parser = DataStore::File::Parser->new;
     36    my $parser = DataStore::File::Parser->new(
     37        base_uri => 'http://example.org/',
     38    );
     39
     40    my @data = $parser->parse($str);
     41        or
     42    my $data = $parser->parse($str);
     43
    3744
    3845=head1 DESCRIPTION
     46
     47This class parses a DataStore listing of I<File>s into an array of L<DataStore::File> objects.
    3948
    4049=head1 USAGE
     
    5564Basic constructor.
    5665
    57 Accepts no arguments and returns a L<DataStore::File::Parser> object.
     66    my $parser = DataStore::File::Parser->new(
     67        base_uri => 'http://example.org/',
     68    );
     69
     70Accepts an optional hash and returns a L<DataStore::FileSet::Parser> object.
     71
     72=over 4
     73
     74=item * base_uri
     75
     76The base of the URI to set in the created L<DataStore::File> objects.
     77
     78This key is optional and defaults to C<http://example.org/>.
     79
     80=back
    5881
    5982=cut
     
    87110=over 4
    88111
     112=item * C<base_uri()>
     113
     114Basic accessor.
     115
    89116=item * C<parse()>
     117
     118Accepts a string and returns a list in list context or an arrayref is scalar
     119context.  An empty list or undef is returned if the string contained no rows.
    90120
    91121=cut
     
    98128        {
    99129            type    => SCALAR,
    100             regex   => qr/\S+/, # string with atleast 1 non WS char
     130            regex   => qr/\S+/, # string with at least 1 non WS char
    101131        }
    102132    );
     
    164194    }
    165195
    166     return @data ? \@data : undef;
     196    return unless @data;
     197    return wantarary ? @data : \@data;
    167198}
    168199
     200=back
     201
     202=head1 SEE ALSO
     203
     204L<DataStore::File>, L<DataStore::FileSet::Parser>
     205
     206=cut
     207
    1692081;
    170209
  • trunk/DataStore/lib/DataStore/FileSet.pm

    r6601 r6603  
    11# Copyright (C) 2006  Joshua Hoblitt
    22#
    3 # $Id: FileSet.pm,v 1.4 2006-03-16 02:47:09 jhoblitt Exp $
     3# $Id: FileSet.pm,v 1.5 2006-03-16 21:44:58 jhoblitt Exp $
    44
    55package DataStore::FileSet;
     
    4949
    5050=head1 DESCRIPTION
     51
     52This class I<isa> L<DataStore::Record>
    5153
    5254=head1 USAGE
  • trunk/DataStore/lib/DataStore/FileSet/Parser.pm

    r6501 r6603  
    11# Copyright (C) 2006  Joshua Hoblitt
    22#
    3 # $Id: Parser.pm,v 1.7 2006-02-28 03:02:12 jhoblitt Exp $
     3# $Id: Parser.pm,v 1.8 2006-03-16 21:44:58 jhoblitt Exp $
    44
    55package DataStore::FileSet::Parser;
     
    2020my $time_field = qr/^ (\d{4})-(\d\d)-(\d\d) T (\d\d):(\d\d):(\d\d) Z $/x;
    2121my $std_field = qr/^[a-z0-9-_.]+$/;
    22 #my %known_types = map { $_ => 1 } qw( OBJECT DOMEFLAT SKYFLAT BIAS DARK );
    2322my %known_types = map { $_ => 1 } qw( object domeflat skyflat bias dark );
    2423
     
    2928=head1 NAME
    3029
    31 DataStore::FileSet::Parser - parses the DataStore 'list' format
     30DataStore::FileSet::Parser - parses the DataStore 'FileSet' list format
    3231
    3332=head1 SYNOPSIS
     
    3534    use DataStore::FileSet::Parser;
    3635
    37     my $parser = DataStore::FileSet::Parser->new;
     36    my $parser = DataStore::FileSet::Parser->new(
     37        base_uri => 'http://example.org/',
     38    );
     39
     40    my @data = $parser->parse($str);
     41        or
     42    my $data = $parser->parse($str);
    3843
    3944=head1 DESCRIPTION
     45
     46This class parses a DataStore listing of I<FileSet>s into an array of L<DataStore::FileSet> objects.
    4047
    4148=head1 USAGE
     
    5663Basic constructor.
    5764
    58 Accepts no arguments and returns a L<DataStore::FileSet::Parser> object.
     65    my $parser = DataStore::FileSet::Parser->new(
     66        base_uri => 'http://example.org/',
     67    );
     68
     69Accepts an optional hash and returns a L<DataStore::FileSet::Parser> object.
     70
     71=over 4
     72
     73=item * base_uri
     74
     75The base of the URI to set in the created L<DataStore::FileSet> objects.
     76
     77This key is optional and defaults to C<http://example.org/>.
     78
     79=back
    5980
    6081=cut
     
    88109=over 4
    89110
     111=item * C<base_uri()>
     112
     113Basic accessor.
     114
    90115=item * C<parse()>
     116
     117Accepts a string and returns a list in list context or an arrayref is scalar
     118context.  An empty list or undef is returned if the string contained no rows.
    91119
    92120=cut
     
    99127        {
    100128            type    => SCALAR,
    101             regex   => qr/\S+/, # string with atleast 1 non WS char
     129            regex   => qr/\S+/, # string with at least 1 non WS char
    102130        }
    103131    );
     
    162190    }
    163191
    164     return @data ? \@data : undef;
     192    return unless @data;
     193    return wantarary ? @data : \@data;
    165194}
    166195
     196=head1 SEE ALSO
     197
     198L<DataStore::FileSet>, L<DataStore::File:Parser>
     199
     200=cut
     201
    1672021;
    168203
  • trunk/DataStore/lib/DataStore/Product.pm

    r6601 r6603  
    11# Copyright (C) 2006  Joshua Hoblitt
    22#
    3 # $Id: Product.pm,v 1.4 2006-03-16 02:47:09 jhoblitt Exp $
     3# $Id: Product.pm,v 1.5 2006-03-16 21:44:58 jhoblitt Exp $
    44
    55package DataStore::Product;
     
    4848
    4949=head1 DESCRIPTION
     50
     51This class I<isa> L<DataStore::Record>
    5052
    5153=head1 USAGE
  • trunk/DataStore/lib/DataStore/Record.pm

    r6583 r6603  
    11# Copyright (C) 2006  Joshua Hoblitt
    22#
    3 # $Id: Record.pm,v 1.4 2006-03-14 22:40:15 jhoblitt Exp $
     3# $Id: Record.pm,v 1.5 2006-03-16 21:44:58 jhoblitt Exp $
    44
    55package DataStore::Record;
     
    8686=item * C<request()>
    8787
     88This method must be overloaded in sub-classes.
     89
    8890=cut
    8991
  • trunk/DataStore/lib/DataStore/Response.pm

    r6601 r6603  
    11# Copyright (C) 2006  Joshua Hoblitt
    22#
    3 # $Id: Response.pm,v 1.2 2006-03-16 02:47:09 jhoblitt Exp $
     3# $Id: Response.pm,v 1.3 2006-03-16 21:44:58 jhoblitt Exp $
    44
    55package DataStore::Response;
     
    4646
    4747=head1 DESCRIPTION
     48
     49This class represent the return state of the C<request()> method in
     50L<DataStore::Record> sub-classes.
    4851
    4952=head1 USAGE
     
    142145=over 4
    143146
    144 =item * C<uri>
     147=item * C<uri()>
    145148
    146149Basic accessor.
    147150
    148 =item * C<code>
     151=item * C<code()>
    149152
    150153Basic accessor.
    151154
    152 =item * C<status_line>
     155=item * C<status_line()>
    153156
    154157Basic accessor.
    155158
    156 =item * C<data>
     159=item * C<data()>
    157160
    158161Basic accessor.
    159162
    160 =item * C<request>
     163=item * C<request()>
    161164
    162165Basic accessor.
Note: See TracChangeset for help on using the changeset viewer.