Biblio-Refbase
view release on metacpan or search on metacpan
lib/Biblio/Refbase.pm view on Meta::CPAN
=head2 Searching
First, a very simple example that will just perform a search without
applying any user parameters:
$refbase = Biblio::Refbase->new; # create new instance
$response = $refbase->search; # search with defaults
$content = $response->content; # store content
If there's an unmodified out-of-the-box installation of refbase at localhost,
C<$content> should now contain 5 records in ASCII format.
You should check the status of the C<$response> object before processing the
content. All accessors known from C<HTTP::Response> are available plus
L<the accessors added by this module|"RESPONSE ACCESSOR METHODS">:
if ($response->is_success) {
if ($response->hits) { # hits is special to this module
print "Found something!\n";
$content = $response->content;
}
else {
print "Found nothing!\n";
}
}
else {
print 'An error occurred: ', $response->status_line, "\n";
$http_code = $response->code;
$message = $response->message;
}
Let's provide the C<$refbase> object with connection parameters to access
the official beta refbase site:
$refbase->url('http://beta.refbase.net/');
$refbase->user('guest@refbase.net');
$refbase->password('guest');
If you want you can chain the accessors:
$refbase->url('http://beta.refbase.net/')
->user('guest@refbase.net')
->password('gest');
In the chained accessors example there was an intentional typo:
The password is wrong. This module will 'cast' the original response
from refbase (which redirects to a login page) to one having
the appropriate UNAUTHORIZED status code set and a short message
'Login request denied':
if (($response = $refbase->search)->is_error) {
print 'An error occurred: ', $response->status_line, "\n";
}
=head2 Uploading data to refbase
More examples will be included in the next releases of this module.
Please refer to the L<"SYNOPSIS"> section for now.
=head1 BUGS AND LIMITATIONS
This module is ALPHA status. Interface and features could change.
Documentation and test suite are still incomplete. Some search options
have been omitted in this release.
=head1 SEE ALSO
=over 4
=item * refbase
L<http://www.refbase.net/>
=item * refbase Command line clients
L<http://cli.refbase.net/>
=item * L<LWP::UserAgent>
=item * L<HTTP::Response>
=back
=head1 AUTHOR
Henning Manske <hma@cpan.org>
=head1 ACKNOWLEDGEMENTS
Thanks to Matthias Steffens (info@refbase.net), the creator of refbase,
for encouraging feedback, explaining many details, testing this module
and commenting on the documentation.
=head1 COPYRIGHT AND LICENSE
Copyright (c) 2008-2010 Henning Manske. All rights reserved.
This module is free software. You can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.
See L<http://dev.perl.org/licenses/>.
This module is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=cut
( run in 1.992 second using v1.01-cache-2.11-cpan-39bf76dae61 )