Bundle-PBib
view release on metacpan or search on metacpan
lib/Biblio/bp/lib/bp.pl view on Meta::CPAN
# fromcanon(%record);
# fromcanon(%record, $file_name);
#
# clear();
# clear($file_name);
#
# [ file bp-p-option ]
#
# stdargs(@ARGV)
#
# options($general_opts, $converter_opts, $infmt_opts, $outfmt_opts);
#
# doc($what);
#
#
# Functions available primarily for modules to call:
#
#
# parse_format($format_string)
#
# [ file bp-p-debug ]
#
# panic($string);
#
# debugs($statement, $level);
# debugs($statement, $level, $module);
#
# check_consist();
#
# debug_dump($what_kind);
#
# ok_print($variable);
#
# [ file bp-p-errors ]
#
# errors($warning_level);
# errors($warning_level, $error_level);
# errors($warning_level, $error_level, $header_string);
#
# goterror($error_message);
# goterror($error_message, $linenum);
#
# gotwarn($warning_message);
# gotwarn($warning_message, $linenum);
#
# [ file bp-p-dload ]
#
# load_format($format_name);
#
# load_charset($charset_name);
#
# load_converter($converter_name);
#
# find_bp_files();
# find_bp_files($rehash);
#
# reg_format($long_name, $short_name, $pkg_name, $charset_name, @info);
#
# [ file bp-p-cs ]
#
# unicode_to_canon($unicode);
#
# canon_to_unicode($character);
#
# decimal_to_unicode($number);
#
# unicode_to_decimal($unicode);
#
# unicode_name($unicode);
#
# meta_name($metacode);
#
# meta_approx($metacode);
#
# unicode_approx($unicode);
#
# nocharset($string);
#
# [ file bp-p-util ]
#
# bp_util'mname_to_canon($names_string);
# bp_util'mname_to_canon($names_string, $flag_reverse_author);
#
# bp_util'name_to_canon($name_string);
# bp_util'name_to_canon($name_string, $flag_reverse_author);
#
# bp_util'canon_to_name($name_string);
# bp_util'canon_to_name($name_string, $how_formatted);
#
# bp_util'parsename($name_string);
# bp_util'parsename($name_string, $how_formatted);
#
# bp_util'parsedate($date_string);
#
# bp_util'canon_month($month_string);
#
# bp_util'genkey(%canon_record);
#
# bp_util'regkey($key);
#
#
# Internal functions:
#
#
# close_input($file_name);
#
# close_output($file_name);
#
# [ file bp-p-debug ]
#
# log2($number);
#
# [ file bp-p-option ]
#
# parse_num_option($value);
#
# parse_option($option);
#
# [ file bp-p-stdbib ]
#
# open_stdbib($file_name);
#
# close_stdbib($file_name);
#
# read_stdbib($file_name);
#
# write_stdbib($file_name, $output_string);
#
# clear_stdbib();
#
# options_stdbib();
#
# implode_stdbib();
#
# explode_stdbib();
lib/Biblio/bp/lib/bp.pl view on Meta::CPAN
$glb_cvtname = undef; # we don't want to call some strange converter!
# special: if ifmt or ofmt is a null string, then we want to leave
# the current setting alone!
if ($ifmt eq '') {
$success++;
($fmti, $cset) = &parse_format($glb_Iformat);
} elsif ( ($fmti, $cset) = &load_format($ifmt) ) {
# XXXXX should implement this, or at least hook into it
return &goterror("auto charset recognition is unimplemented")
if ( ($cset eq 'auto') && ($fmti ne 'auto') );
$success++;
$glb_Iformat = "$fmti:$cset";
# XXXXX Should we open stdin here?
}
if ($ofmt eq '') {
$success++;
($fmto, $cset) = &parse_format($glb_Oformat);
} elsif ( ($fmto, $cset) = &load_format($ofmt) ) {
return &goterror("auto charset recognition is unimplemented")
if ( ($cset eq 'auto') && ($fmto ne 'auto') );
$success++;
$glb_Oformat = "$fmto:$cset";
# XXXXX open STDOUT to our format. Right? This is a re-open.
# 17 Nov 95, changed to >>- from >-.
&open('>>-') if $fmto ne "auto";
}
# If we have a second format and we're successful, then set converter name.
# The name looks like "ref2btx", or "ins2mrc". This will be set to undef
# if we don't have a safely loaded converter, or the name of it if we do.
# We also don't have special converters between the same format.
if ( ($success == 2) && ($fmti ne $fmto) ) {
$glb_cvtname = &load_converter( $formats{$fmti, 'i_sname'} . '2'
. $formats{$fmto, 'i_sname'});
}
&check_consist;
($success == 2);
}
######
require "${glb_bpprefix}p-dload.pl";
# loads:
# bib'load_format
# bib'load_charset
# bib'find_bp_files
# bib'reg_format
######
require "${glb_bpprefix}p-cs.pl";
# loads:
# variables used by the cs routines
# bib'nocharset
# bib'unicode_to_canon
######
require "${glb_bpprefix}p-option.pl";
# loads:
# bib'stdargs
# bib'options
# bib'parse_num_option
# bib'parse_option
# bib'doc
###### open("file" [,"format"] );
# Much like the normal open call, we use "foo" to open foo for read, ">foo"
# to open for write, and ">>foo" for append.
#
# Note that because of the way Perl filehandles are transferred, I can't tell
# the difference between STDOUT and 'STDOUT', so you must always use '-' for
# STDIN and '>-' (or '>>-') for STDOUT.
#
# XXXXX You can get the routines confused by giving them 'foo' and './foo'
# which point to the same file of course, but they have different names.
sub open {
local($file, $format) = @_;
local($name, $mode);
local($fmt, $cset);
&panic("open called with no arguments") unless defined $file;
#&check_consist;
if ($file =~ /^>>(.*)/) {
$mode = 'append'; $name = $1;
} elsif ($file =~ /^>(.*)/) {
$mode = 'write'; $name = $1;
} else {
$mode = 'read'; $name = $file;
}
# XXXXX for now, warn them about this.
&gotwarn("Using STDIN ${mode}s to the file 'STDIN'") if $name eq 'STDIN';
&gotwarn("Using STDOUT ${mode}s to the file 'STDOUT'") if $name eq 'STDOUT';
&gotwarn("Using STDERR ${mode}s to the file 'STDERR'") if $name eq 'STDERR';
# We allow '-' to be read and written to at the same time. No others.
# XXXXX For now, files cannot be re-opened without an explicit close.
if ($name ne '-') {
if ($mode eq 'read') {
return &goterror("file $name is already opened for write")
if defined $glb_Orfmt{$name};
return &goterror("re-opening file $name") if defined $glb_Irfmt{$name};
} else {
return &goterror("file $name is already opened for read")
if defined $glb_Irfmt{$name};
return &goterror("re-opening file $name") if defined $glb_Orfmt{$name};
}
}
$glb_vloc = undef;
( run in 0.853 second using v1.01-cache-2.11-cpan-d8267643d1d )