File Coverage

blib/lib/Webservice/InterMine/Simple.pm
Criterion Covered Total %
statement 9 18 50.0
branch 0 6 0.0
condition 0 3 0.0
subroutine 3 4 75.0
pod 1 1 100.0
total 13 32 40.6


line stmt bran cond sub pod time code
1             package Webservice::InterMine::Simple;
2              
3             our $VERSION = "0.9800";
4              
5 1     1   22984 use strict;
  1         3  
  1         43  
6 1     1   582 use Webservice::InterMine::Simple::Service;
  1         3  
  1         32  
7 1     1   5 use Exporter 'import';
  1         2  
  1         288  
8              
9             our @EXPORT_OK = ("get_service");
10             our @EXPORT = @EXPORT_OK;
11              
12             =head1 NAME
13              
14             Webservice::InterMine::Simple - A basic InterMine web-service client.
15              
16             =head1 SYNOPSIS
17              
18             my $service = get_service("http://www.flymine.org/query/service");
19             my $query = $service->new_query;
20              
21             $query->add_view("Organism.shortName", "Organism.taxonId");
22             $query->add_constraint({path => "Organism.genus", op => "=", value => "Rattus"});
23              
24             @rows = $query2->results_table;
25             for my $row (@rows) {
26             print "name: $row->[0], id: $row->[1]\n";
27             }
28              
29             =head1 DESCRIPTION
30              
31             This is a basic representation of a query. It can handle straight-forward
32             requests and result sets, but for anything more complicated, we recommend you look
33             as the more fully featured L. This is especially true of
34             large data sets, as this implementation has the potential to use lots of memory when
35             receiving and processing results.
36              
37             =head1 IMPORTED ROUTINES
38              
39             =head2 get_service(@args)
40              
41             Get a service instantiated with the given arguments.
42              
43             Arguments:
44              
45             =over
46              
47             =item * ($url) - The root-url to the webservice.
48              
49             =item * ($url, $token) - The root-url, and an authorisation token.
50              
51             =item * ($url, $username, $password) - The root-url, and a user's login information.
52              
53             =back
54              
55             This can also be called as a static method on the package:
56              
57             Webservice::InterMine::Simple->get_service(...);
58              
59             =cut
60              
61             sub get_service {
62 0 0 0 0 1   if ($_[0] and $_[0] eq __PACKAGE__) {
63 0           my $self = shift;
64             }
65 0 0         if (@_ == 3) {
    0          
66 0           my ($url, $user, $pass) = @_;
67 0           return Webservice::InterMine::Simple::Service->new(
68             root => $url,
69             user => $user,
70             pass => $pass,
71             );
72             } elsif (@_ == 2) {
73 0           my ($url, $token) = @_;
74 0           return Webservice::InterMine::Simple::Service->new(
75             root => $url,
76             token => $token,
77             );
78             } else {
79 0           my ($url) = @_;
80 0           return Webservice::InterMine::Simple::Service->new(
81             root => $url,
82             );
83             }
84             }
85              
86             =head1 SEE ALSO
87              
88             =over 4
89              
90             =item * L For a more powerful alternative
91              
92             =back
93              
94             =head1 AUTHOR
95              
96             Alex Kalderimis C<< >>
97              
98             =head1 BUGS
99              
100             Please report any bugs or feature requests to C.
101              
102             =head1 SUPPORT
103              
104             You can find documentation for this module with the perldoc command.
105              
106             perldoc Webservice::InterMine::Simple
107              
108             You can also look for information at:
109              
110             =over 4
111              
112             =item * InterMine
113              
114             L
115              
116             =item * Documentation
117              
118             L
119              
120             =back
121              
122             =head1 COPYRIGHT AND LICENSE
123              
124             Copyright 2006 - 2011 FlyMine, all rights reserved.
125              
126             This program is free software; you can redistribute it and/or modify it
127             under the same terms as Perl itself.
128              
129             =cut
130              
131             1;
132