Changeset 6603 for trunk/DataStore/lib/DataStore.pm
- Timestamp:
- Mar 16, 2006, 11:44:58 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/DataStore/lib/DataStore.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataStore/lib/DataStore.pm
r6602 r6603 1 1 # Copyright (C) 2006 Joshua Hoblitt 2 2 # 3 # $Id: DataStore.pm,v 1. 1 2006-03-16 20:56:41jhoblitt Exp $3 # $Id: DataStore.pm,v 1.2 2006-03-16 21:44:57 jhoblitt Exp $ 4 4 5 5 package DataStore; … … 33 33 34 34 This 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 36 individual modules for usage information. If this is your browsing of the 37 documentation you may want to start with L<DataStore::Product>. 37 38 38 39 =head1 USAGE … … 46 47 47 48 None. 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' 48 105 49 106 =cut
Note:
See TracChangeset
for help on using the changeset viewer.
