The Perl Advent Calendar needs more articles for 2022. Submit your idea today!

NAME

Fsdb::Support - support routines for Fsdb

SYNOPSIS

This class contains the bits of Fsdb::Old that needed to be kept.

FUNCTIONS

LOGGING REALTED FUNCTIONS

progname

Generate the name of our program for error messages.

IO SETUP FUNCTIONS

default_in(@READER_OPTIONS)

Generate a default Fsdb::Reader object with the given READER_OPTIONS

default_out(@WRITER_OPTIONS)

Generate a default Fsdb::Writer object with the given READER_OPTIONS

CONVERSION FUNCTIONS

code_prettify

Convert db-code into "pretty code".

shell_quote

Convert output to shell-like quoting

CONVERSION FUNCTIONS

number_prettify

Add-thousands-separators to numbers.

xxx: should consider locale.

(This code is from http://www.perlmonks.org/?node_id=653, contributed by Andrew Johnson from University of Alberta.)

force_numeric

    my $x = force_numeric($s, $include_non_numeric)

Return $S if it's numeric, or undef if not. If $INCLUDE_NON_NUMERIC, then non-numeric values register as zero.

fullname_to_sortkey

    my $sortkey = fullname_to_sortkey("John Smith");

Convert "Firstname Lastname" to sort key "lastname, firstname".

ddmmmyy_to_iso

    my $iso_date = ddmmmyy_to_iso('1-Jan-10')

Converts a date in the form dd-mmm-yy to ISO-style yyyy-mm-dd. Examples:

2-Jan-70 to 1970-01-02 2-Jan-99 to 1999-01-02 2-Jan-10 to 2010-01-02 2-Jan-69 to 2069-01-02 Jan-10 to 2010-01-00 99 to 1999-00-00

int_to_metric

    my $value_str = int_to_metric(1000000);

Converts an integer into a string with its metric abbreviation.

1000 => 1k 1000000 => 1M