BGPmon-core-2

 view release on metacpan or  search on metacpan

lib/BGPmon/Fetch/Archive.pm  view on Meta::CPAN

        1;
    } or do {
        $error_code{$fname} = SYSCALL_FAIL_CODE;
        $error_msg{$fname} = SYSCALL_FAIL_MSG.": $@";
    };
    return 0;
}

# validateIndex
#A helper function to scan an HTML page to determine whether the page is
#a valid index page or something else.  It looks for the key phrase
#"Index of" with the current year.month subdirectory.
#Input:      The filename to check
#Output:     1 if the file matches the search, 0 otherwise

sub validateIndex{
    my $index_fn = shift;
    my $fname = "validateIndex";
    if( !defined($index_fn) ){
        $error_code{$fname} = UNDEFINED_ARGUMENT_CODE;
        $error_msg{$fname} = UNDEFINED_ARGUMENT_MSG;

t/00-bgpmon-log.t  view on Meta::CPAN

ok($line =~ /$init_params{"prog_name"}/, "Checking prog_name parameter");

# check it really is a log_notice message
my $descr = $BGPmon::Log::function_description{"log_notice"};
my $index = index($line, $descr);
ok($index >= 0, "Checking message level is LOG_NOTICE");

# check it really includes our message a log_notice message
ok($line =~ /$log_msg/, "Checking the test message was included in the log");

# line looks valid,  now lets try all the log level functions
my @function_names = ("log_emerg", "log_emergency", "log_alert",
                      "log_fatal", "log_crit", "log_critical", "log_err",  
                      "log_error", "log_warn", "log_warning", "log_notice", 
                      "log_info", "log_debug", "debug" ); 
my $fn;
for my $function (@function_names) {
    # call the function
    $fn = "BGPmon::Log::".$function;
    $ret = &$fn($log_msg);
    $ecode = BGPmon::Log::get_error_code($function);



( run in 0.300 second using v1.01-cache-2.11-cpan-607d282f910 )