view release on metacpan or search on metacpan
bin/pbib-export.pl view on Meta::CPAN
# print out a little message on the screen
my ($informat, $outformat) = Biblio::BP::format();
print STDERR "Using bp, version ", Biblio::BP::doc('version'), ".\n";
print STDERR "Writing: $outformat\n";
print STDERR "\n";
# clear errors. Not really necessary.
# Biblio::BP::errors('clear');
### CAUTION: This currently works only if the file is not yet open (I guess ...)
Biblio::BP::export($outfile, $refs);
sub dieusage {
my($prog) = substr($0,rindex($0,'/')+1);
my $str =<<"EOU";
Usage:
perl pbib-export.pl -to <outfile.bib>
lib/Biblio/BP.pm view on Meta::CPAN
=head1 NAME
Biblio::BP - Package Frontend for bp (Perl Bibliography Package)
=head1 SYNOPSIS
use Biblio::BP;
=head1 DESCRIPTION
well, I guess it\'s better if you check the source or the original docs
for now .... sorry ... ;-)
=cut
package Biblio::BP;
use 5.006;
#no strict; # for strange AUTOLOAD method call ...
use warnings;
#use English;
lib/Biblio/Bibtex.pm view on Meta::CPAN
if( defined($paper->{$e}) ) {
print $fh " ", $self->quoteEntry($e), " = ",
$self->quoteValue($paper->{$e}), ",\n";
}
}
print $fh "\}\n\n";
}
}
sub quoteEntry { my ($self, $entry) = @_;
# I guess, I'm using bibtex names!?
if( exists($entry_names{$entry}) ) {
$entry = $entry_names{$entry};
}
return lc($entry);
}
sub quoteValue { my ($self, $text) = @_;
# not quite advanced yet ...
return "\"$text\"";
}
lib/Biblio/Util.pm view on Meta::CPAN
=head1 NAME
Biblio::Util - Package Frontend for bp_util (Perl Bibliography Package)
=head1 SYNOPSIS
use Biblio::Util;
=head1 DESCRIPTION
well, I guess it\'s better if you check the source or the original docs
for now .... sorry ... ;-)
=cut
package Biblio::Util;
use 5.006;
no strict; # for strange AUTOLOAD method call ...
use warnings;
#use English;
lib/Biblio/bp/lib/bp-auto.pl view on Meta::CPAN
#
# Auto format recognizer routines.
#
# Note that this package is intimately tied to the internals of the main
# package. Most format packages will _not_ look like this one. Since this
# does automatic recognition, it needs to change what the main package
# thinks the format of the file is.
#
# The basic idea is that we define open and openwrite, which they call on
# some file. We then determine the real format of the file (either by name,
# or by slogging through it trying to guess at the type <not implemented yet>)
# and then change the main package's pointers for this file to point to the
# real type. So we shouldn't ever be called again for that file.
#
# Dana Jacobsen (dana@acm.org)
# 14 January 1995 (last modified on 21 Jan 1996)
#
package bp_auto;
######
lib/Biblio/bp/lib/bp-medline.pl view on Meta::CPAN
local($_) = @_;
local(%entry) = ();
local($val);
local($field) = undef;
local(@lines) = split(/\n/);
foreach (@lines) {
if (/^<title>.*<\/title>$/) {
next if $opt_html;
# We could guess that it's html and change options here.
}
if ($opt_html) {
s/^<pre>\s*//i;
next if /^</;
next if /^\s*$/;
}
if (/^\s/) {
return &bib'goterror("Medline explode--Problems parsing entry") unless defined $field;
s/^\s+//;
$entry{$field} .= " " . $_;
lib/Biblio/bp/lib/bp-medline.pl view on Meta::CPAN
$can{'Editors'} .= $bib'cs_sep . &medname_to_canon($n);
}
$can{'Editors'} =~ s/^$bib'cs_sep//;
}
# Sometimes the SO field is split out into seperate fields, sometimes not.
# We check the DP and VI fields -- if they exist, assume that SO is split.
# XXXXX We ought to check to split SO anyway and compare the results.
# Alternatively, we could have an option for 1) always use split
# fields, 2) always split SO and use the results, 3) what we do now
# which is make a good guess.
if ( (!defined $entry{DP}) || (!defined $entry{VI}) ) {
&parseSO;
}
# split DP into year and month
if ( !(($entry{Yr}, $entry{Mo}) = $entry{DP} =~ /(\S+)\s+(.*)/) ) {
$entry{Yr} = $entry{DP};
delete $entry{Mo};
}
lib/Biblio/bp/lib/bp-p-utils.pl view on Meta::CPAN
# Jones,von,John,Jr./Krol,Ed,/Beethoven,von,Ludwig,
#
# (the actual seperators are $cs_sep for '/' and $cs_sep2 for ',')
#
# This is a total heuristic hack, and if you know where names are split,
# use multiple calls to name_to_canon instead. Use this routine if you
# expect the input to be some sort of free-form such that you can't
# easily seperate the names yourself.
#
# This routine assumes there can be multiple authors per line, seperated by
# "and" or commas, and it's going to try to guess how to break them up,
# given that it can get "name1, name2, jr, name3" as a 3 name string with
# "name2, jr" as the second name. This method precludes the ability to
# also correctly parse "last, first" format strings. If that is the format
# your string is in, call the function with a "1" as the second argument.
#
# Note that no-break-space ("tie", ~ in TeX, \0 in troff) is \240.
#
sub mname_to_canon {
local($allnames, $revauthor) = @_;
local($firstn, $vonn, $lastn, $jrn);
lib/Biblio/bp/lib/bp-refer.pl view on Meta::CPAN
# Dana Jacobsen (dana@acm.org)
# 12 January 1995 (last modified 17 March 1996)
#
# This reads the refer format, as described in the web page:
# <http://www.ecst.csuchico.edu/~jacobsd/bib/formats/refer.html>
#
# It also has an option to conform to EndNote standards for refer.
# Using this option does:
# 1) turns on the reverseauthor option, since names are in Last, First order.
# 2) enables parsing of some extra fields.
# 3) uses the %0 field to determine the entry type rather than guessing.
#
# XXXXX It still has some limitations however. They include:
# 1) it doesn't change the character set. Do we need another module?
# 2) it doesn't properly handle some of the %0 types (distinguising between
# magazine, newspaper, and journal article; artwork vs. avmaterial)
# 3) it doesn't handle all the extra fields.
# 4) how does EndNote want the %E field formatted?
#
package bp_refer;
lib/Biblio/bp/lib/old/bp-medline.pl view on Meta::CPAN
local($_) = @_;
local(%entry) = ();
local($val);
local($field) = undef;
local(@lines) = split(/\n/);
foreach (@lines) {
if (/^<title>.*<\/title>$/) {
next if $opt_html;
# We could guess that it's html and change options here.
}
if ($opt_html) {
s/^<pre>\s*//i;
next if /^</;
next if /^\s*$/;
}
if (/^\s/) {
return &bib'goterror("Medline explode--Problems parsing entry") unless defined $field;
s/^\s+//;
$entry{$field} .= " " . $_;
lib/Biblio/bp/lib/old/bp-medline.pl view on Meta::CPAN
$can{'Editors'} .= $bib'cs_sep . &medname_to_canon($n);
}
$can{'Editors'} =~ s/^$bib'cs_sep//;
}
# Sometimes the SO field is split out into seperate fields, sometimes not.
# We check the DP and VI fields -- if they exist, assume that SO is split.
# XXXXX We ought to check to split SO anyway and compare the results.
# Alternatively, we could have an option for 1) always use split
# fields, 2) always split SO and use the results, 3) what we do now
# which is make a good guess.
if ( (!defined $entry{DP}) || (!defined $entry{VI}) ) {
&parseSO;
}
# split DP into year and month
if ( !(($entry{Yr}, $entry{Mo}) = $entry{DP} =~ /(\S+)\s+(.*)/) ) {
$entry{Yr} = $entry{DP};
delete $entry{Mo};
}
lib/Biblio/bp/tests/TIMING view on Meta::CPAN
Sun SparcStation 5/85 88.8
Gateway 2000 PentOD/83 96.2
Gateway 2000 486/66 137.2
Sun IPX 155.6
HP 9000/710 224.4 (?? also way too slow)
It is interesting to note that there was almost no gain from overclocking
the 133 MHz Pentium machine to 180 MHz. This same machine benefits greatly
from overclocking on many other tests, so we're guessing it's memory bound.
The SPARC machines do quite well, and the HP's do very poorly. This may
be caused by a bad compilation of Perl on the HPs. The Pentium Pro machines
do extremely well.
lib/Config/General.pm view on Meta::CPAN
},
DefaultConfig => {},
level => 1,
InterPolateVars => 0,
ExtendedAccess => 0,
SplitPolicy => 'guess', # also possible: whitespace, equalsign and custom
SplitDelimiter => 0, # must be set by the user if SplitPolicy is 'custom'
StoreDelimiter => 0, # will be set by me unless user uses 'custom' policy
CComments => 1, # by default turned on
StrictObjects => 1, # be strict on non-existent keys in OOP mode
StrictVars => 1, # be strict on undefined variables in Interpolate mode
lib/Config/General.pm view on Meta::CPAN
# use of the old style
$self->{ConfigFile} = $param[0];
}
else {
# this happens if $#param == -1,1 thus no param was given to new!
$self->{config} = {};
$self->{parsed} = 1;
}
# prepare the split delimiter if needed
if ($self->{SplitPolicy} ne 'guess') {
if ($self->{SplitPolicy} eq 'whitespace') {
$self->{SplitDelimiter} = '\s+';
$self->{StoreDelimiter} = " " if(!$self->{StoreDelimiter});
}
elsif ($self->{SplitPolicy} eq 'equalsign') {
$self->{SplitDelimiter} = '\s*=\s*';
$self->{StoreDelimiter} = " = " if(!$self->{StoreDelimiter});
}
elsif ($self->{SplitPolicy} eq 'custom') {
if (! $self->{SplitDelimiter} ) {
lib/Config/General.pm view on Meta::CPAN
# remove the \ char in front of masked "#", if any
s/\\#/#/g;
# look for here-doc identifier
if ($this->{SplitPolicy} eq 'guess') {
if (/^\s*(\S+?)(\s*=\s*|\s+)<<\s*(.+?)\s*$/) {
$hier = $1; # the actual here-doc variable name
$hierend = $3; # the here-doc identifier, i.e. "EOF"
next;
}
}
else {
# no guess, use one of the configured strict split policies
if (/^\s*(\S+?)($this->{SplitDelimiter})<<\s*(.+?)\s*$/) {
$hier = $1; # the actual here-doc variable name
$hierend = $3; # the here-doc identifier, i.e. "EOF"
next;
}
}
# look for multiline option, indicated by a trailing backslash
lib/Config/General.pm view on Meta::CPAN
#
# build option value assignment, split current input
# using whitespace, equal sign or optionally here-doc
# separator (ascii 182).
my ($option,$value);
if (/$indichar/) {
($option,$value) = split /\s*$indichar\s*/, $_, 2; # separated by heredoc-finding in _open()
}
else {
if ($this->{SplitPolicy} eq 'guess') {
# again the old regex. use equalsign SplitPolicy to get the
# 2.00 behavior. the new regexes were too odd.
($option,$value) = split /\s*=\s*|\s+/, $_, 2;
}
else {
# no guess, use one of the configured strict split policies
($option,$value) = split /$this->{SplitDelimiter}/, $_, 2;
}
}
if ($value && $value =~ /^"/ && $value =~ /"$/) {
$value =~ s/^"//; # remove leading and trailing "
$value =~ s/"$//;
}
if (! defined $block) { # not inside a block @ the moment
if (/^<([^\/]+?.*?)>$/) { # look if it is a block
lib/Config/General.pm view on Meta::CPAN
=item B<-StrictVars>
By default this is turned on, which causes Config::General to croak with an
error if an undefined variable with B<InterPolateVars> turned on occurs
in a config. Set to I<false> (i.e. 0) to avoid such error messages.
=item B<-SplitPolicy>
You can influence the way how Config::General decides which part of a line
in a config file is the key and which one is the value. By default it tries
it's best to guess. That means you can mix equalsign assignments and whitespace
assignments.
However, somtimes you may wish to make it more strictly for some reason. In
this case you can set B<-SplitPolicy>. The possible values are: 'guess' which
is the default, 'whitespace' which causes the module to split by whitespace,
'equalsign' which causes it to split strictly by equal sign, or 'custom'. In the
latter case you must also set B<-SplitDelimiter> to some regular expression
of your choice. For example:
-SplitDelimiter => '\s*:\s*'
will cause the module to split by colon while whitespaces which surrounds
the delimiter will be removed.
Please note that the delimiter used when saving a config (save_file() or save_string())
will be choosen accordingto the current B<-SplitPolicy>. If -SplitPolicy is
set to 'guess' or 'whitespace', 3 whitespaces will be used to delimit saved
options. If 'custom' is set, then you need to set B<-StoreDelimiter>.
=item B<-SplitDelimiter>
Set this to any arbitrary regular expression which will be used for option/value
splitting. B<-SplitPolicy> must be set to 'custom' to make this work.
=item B<-StoreDelimiter>
You can use this parameter to specify a custom delimiter to use when saving
lib/Config/General/Extended.pm view on Meta::CPAN
# or
$conf->value("key", \@somearray);
# or
$conf->value("key", $somescalar);
Please note, that this method does not complain about existing values within "key"!
=item is_hash('key') is_array('key') is_scalar('key')
As seen above, you can access parts of your current config using hash, array or scalar
methods. But you are right if you guess, that this might become problematic, if
for example you call B<hash()> on a key which is in real not a hash but a scalar. Under
normal circumstances perl would refuse this and die.
To avoid such behavior you can use one of the methods is_hash() is_array() is_scalar() to
check if the value of "key" is really what you expect it to be.
An example(based on the config example from above):
if($conf->is_hash("individual") {
$individual = $conf->obj("individual");
lib/PBib/Document.pm view on Meta::CPAN
=item $doc = new PBib::Document('filename' => $filename);
Arguments are passed as hash:
=over
=item B<filename> => string for filename
=item B<class> => document class to use, e.g. 'RTF' or 'MSWord'
If class is not defined, it is tried to be guessed by looking at the file. (Currently, the filename's extension only.)
=item B<formatOptions> => hash with options passed to ReferenceFormator
OBSOLETE??
=item B<bibitemOptions> => hash with options passed to BibItemFormator
OBSOLETE??
=item B<converter> => string for ReferenceConverter class
lib/PBib/Document/OpenOffice.pm view on Meta::CPAN
#
sub formatRange {
my ($self, $text) = @_;
# replace with endash
$text =~ s/\s*-(-?)\s*/$EN_DASH/g if defined $text;
return $text;
}
sub paragraph { my ($self, $text) = @_;
# hmmmmmmm I guess this needs to be mor intelligent .....
return "<text:p>$text</text:p>\n";
}
sub linebreak { my ($self) = @_;
# return code that stands for a line-break
return "<text:line-break/>\n";
}
sub singleQuotes { my ($self, $text) = @_;
# return $text enclosed in single quotes
return "$LQUOTE_EN$text$RQUOTE_EN";
lib/PBib/ReferenceConverter.pm view on Meta::CPAN
$self->warn("Can't find CiteKey $refID");
}
return $ref;
}
sub entry { my ($self, $refID, $entry, $check) = @_;
my $e = $self->entries($refID)->{$entry};
#
# I could include a return-once-only check, i.e.
# if called a second time, it will return ().
# this could make the writing of some style a lot
# easier, I guess ...
#
if( !$e ) {
if( $check ) {
$self->warn("entry '$entry' not defined in $refID");
return "{\\b \\i <<$entry missing>>}" if
$self->refOptions()->{'debug-undef-entries'};
}
return ();
}
if( $e eq '{}' ) {
lib/PBibTk/Main.pm view on Meta::CPAN
sub refListLabel { my $self = shift; return $self->{'refListLabel'}; }
sub foundListLabel { my $self = shift; return $self->{'foundListLabel'}; }
sub refListSelection { my $self = shift; return $self->refList()->curselection(); }
sub foundListSelection { my $self = shift; return $self->foundList()->curselection(); }
sub litRefs { my $self = shift; return $self->{'litRefs'}; }
sub initDropSite {
# I guess this doesn't qork jet under Win32 ...
my ($self, $win) = @_;
$win->DropSite(
-entercommand => sub{print "enter @_\n";},
-leavecommand => sub{print "leave @_\n";},
-motioncommand => sub{print "motion @_\n";},
-dropcommand => sub{print "drop @_\n";},
);
}