Advanced-Config
view release on metacpan or search on metacpan
lib/Advanced/Config/Date.pm view on Meta::CPAN
{
DBUG_ENTER_FUNC ( @_ );
my $in_date = shift;
my $month_num = shift;
my $dom_num = shift;
my $allow_2_digit_years = shift;
my $date_format_options = shift;
my ($year, $s1, $month, $s2, $day );
# Unknown format, use hint to decide ...
if ( $in_date =~ m/(^|\D)(\d{8})($|\D)/ ) {
( $year, $month, $day ) = parse_8_digit_date ( $2, $date_format_options, 0 );
$s1 = $s2 = "";
# American or European Format, use hint to decide ...
} elsif ( $in_date =~ m/(^|\D)(\d{1,2})(\D+)(\d{1,2})(\D+)(\d{4})(\D|$)/ ) {
( $s1, $s2 ) = ( $3, $5 );
my $date = sprintf ("%02d%02d%04d", $2, $4, $6);
( $year, $month, $day ) = parse_8_digit_date ( $date, $date_format_options, 1 );
# ISO Format ...
} elsif ( $in_date =~ m/(^|\D)(\d{4})(\D+)(${month_num})(\D+)(${dom_num})(\D|$)/ ) {
( $year, $s1, $month, $s2, $day ) = ( $2, $3, $4, $5, $6 );
}
if ( $allow_2_digit_years && ! defined $year ) {
# Unknown format, use hint to decide ...
if ( $in_date =~ m/(^|\D)(\d{6})($|\D)/ ) {
( $year, $month, $day ) = parse_6_digit_date ( $2, $date_format_options );
$s1 = $s2 = "";
# Unknown format, use hint to decide ...
} elsif ( $in_date =~ m/(^|[^:\d])(\d{1,2})([^:\d]+)(\d{1,2})([^:\d]+)(\d{1,2})([^:\d]|$)/ ) {
( $s1, $s2 ) = ( $3, $5 );
my $date = sprintf ("%02d%02d%02d", $2, $4, $6);
( $year, $month, $day ) = parse_6_digit_date ( $date, $date_format_options );
}
} # End if allowing 2-digit years ...
if ( defined $year ) {
return DBUG_RETURN ( _check_if_good_date ($in_date, $year, $month, $day) );
}
lib/Advanced/Config/Options.pm view on Meta::CPAN
Once the new file is sourced in, it inherits most of the options currently used
unless you override them. The only ones not inherited deal with decryption.
Here is the callback function's expected definition:
my ($rOpts, $dOpts) = source_callback_func ($file[, $cbOpts]);
$file --> The file being sourced in.
$cbOpts --> A hash reference containing values needed by your callback
function to decide what options are required to source in the
requested file. You may update the contents of this hash to
perserve info between calls. This module will "never" examine
the contents of this hash!
$rOpts --> A reference to the "Read Options" hash used to parse the file
you want to source in. Returns "undef" if the options don't
change. The returned options override what's currently in use by
"load_config" when loading the current file.
$dOpts --> A reference to the "Date Formatting Options" hash used to tell how
lib/Advanced/Config/Reader.pm view on Meta::CPAN
# Should never, ever happen ...
DBUG_PRINT ("WARN", "Failed to create the new section: %s.", $new_name);
DBUG_RETURN (""); # This is the main/default section being returned.
}
# ==============================================================
# Allows a config file to run a random command when it's loaded into memory.
# Only allowed if explicity enabled & configured!
# Decided it's too dangerous to use, so never called outside of a POC example!
sub _execute_backquoted_cmd
{
my $rOpts = shift;
my $hide = shift;
my $tag = shift;
my $value = shift;
return ( $value ) unless ( $rOpts->{enable_backquotes} );
# Left & right backquotes ...
t/test-helper/helper1234.pm view on Meta::CPAN
BEGIN
{
}
END
{
}
# Uses 2 ENV vars so that the meaning of undefined %ENV var can be easily
# changed for deciding what to do with the real %ENV var ...
sub turn_fish_on_off_for_advanced_config
{
DBUG_ENTER_FUNC(@_);
# Get the name of the fish file to return ...
my $fish = $0;
$fish =~ s/[.]t$//;
$fish =~ s/[.]pl$//;
$fish .= ".fish.txt";
( run in 0.914 second using v1.01-cache-2.11-cpan-de7293f3b23 )