Bio-Biblio
view release on metacpan or search on metacpan
lib/Bio/Biblio.pm view on Meta::CPAN
# this is called only the first time when somebody calls: 'new
# Bio::Biblio (...)', and it actually loads a 'real-work-doing'
# module and call this new() method again (unless the loaded
# module has its own new() method)
} else {
my %param = @args;
@param { map { lc $_ } keys %param } = values %param; # lowercase keys
my $access =
$param {'-access'} ||
$class->_guess_access ( $param {'-location'} ) ||
'soap';
$access = "\L$access"; # normalize capitalization to lower case
# load module with the real implementation - as defined in $access
return unless (&_load_access_module ($access));
# this will call this same method new() - but rather its the
# upper (object) branche
return "Bio::DB::Biblio::$access"->new (@args);
}
lib/Bio/Biblio.pm view on Meta::CPAN
return 1;
}
# -----------------------------------------------------------------------------
# this is kept here for the future when more access protocols
# (e.g. CORBA) may be available for accessing bibliographic query
# services
sub _guess_access {
# my ($class, $location) = @_;
return 'soap';
}
1;
__END__
=pod
=encoding utf-8
lib/Bio/Biblio.pm view on Meta::CPAN
Args : 'access' should contain the last part of the
name of a module who does the real implementation
It does (in run-time) a similar thing as
require Bio::DB::Biblio::$access
It prints an error on STDERR if it fails to find and load the module
(for example, because of the compilation errors in the module).
=head2 _guess_access
Usage : $class->_guess_access ($location)
Returns : string with a guessed access protocol (e.g. 'soap')
Args : 'location' defines where to find a bibliographic service
in a protocol-dependent manner (e.g. for SOAP it is
a URL of a bibliographic WebService)
It makes an expert guess what kind of access/transport protocol should
be used based on the I<location> of the service (e.g. if the
I<location> looks like an IOR then the access protocol is probably
CORBA).
=head1 OVERVIEW OF CLASSES AND PACKAGES
=over
=item L<Bio::Biblio>
lib/Bio/Biblio/IO.pm view on Meta::CPAN
return $self;
# this is called only the first time when somebody calls: 'new
# Bio::Biblio::IO (...)', and it actually loads a 'real-work-doing'
# module and call this new() method again (unless the loaded
# module has its own new() method)
} else {
my %param = @args;
@param{ map { lc $_ } keys %param } = values %param; # lowercase keys
my $format = $param{'-format'} ||
$class->_guess_format( $param{-file} || $ARGV[0] ) ||
'medlinexml';
$format = "\L$format"; # normalize capitalization to lower case
# load module with the real implementation - as defined in $format
return unless (&_load_format_module ($format));
# this will call this same method new() - but rather its
# upper (object) branche
return "Bio::Biblio::IO::$format"->new(@args);
}
lib/Bio/Biblio/IO.pm view on Meta::CPAN
Exception $@
For more information about the Biblio system please see the Bio::Biblio::IO docs.
END
;
return;
}
return 1;
}
sub _guess_format {
my $class = shift;
return unless $_ = shift;
return 'medlinexml' if (/\.(xml|medlinexml)$/i);
return;
}
sub DESTROY {
my $self = shift;
lib/Bio/Biblio/IO.pm view on Meta::CPAN
Args : 'format' should contain the last part of the
name of a module who does the real implementation
It does (in run-time) a similar thing as
require Bio::Biblio::IO::$format
It throws an exception if it fails to find and load the module
(for example, because of the compilation errors in the module).
=head2 _guess_format
Usage : $class->_guess_format ($filename)
Returns : string with a guessed format of the input data (e.g. 'medlinexml')
Args : a file name whose extension can help to guess its format
It makes an expert guess what kind of data are in the given file
(but be prepare that $filename may be empty).
=head1 SEE ALSO
=over 4
=item *
An example script F<eg/biblio-soap.pl>
( run in 0.749 second using v1.01-cache-2.11-cpan-748bfb374f4 )