ASNMTAP

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

# my $ac = ExtUtils::Autoconf->new;
# $ac->configure;

WriteMakefile(
  NAME              => 'ASNMTAP',
  AUTHOR            => "alex.peeters\@citap.be",
  ABSTRACT          => "Application System Network Monitoring Toolkit Alex Peeters",
  VERSION           => $VERSION,
  LICENSE           => 'perl',
  PM                => \%PM,
  MAN3PODS          => { map { my $man3pod = $_; $man3pod =~ s/\//::/g; ("lib/ASNMTAP/$_.pod" => "\$(INST_MAN3DIR)/ASNMTAP::$man3pod.\$(MAN3EXT)") } @man3pods },
  PREREQ_PM         => \%PREREQ_PM,
  ($] >= 5.005 ?
    (ABSTRACT       => 'Application System Network Monitoring Toolkit Alex Peeters',
     AUTHOR         => 'Alex Peeters <alex.peeters@citap.com>') : ()
    ),
  'dist'            => { COMPRESS => 'gzip -9f', SUFFIX => 'gz' },
# 'dist'            => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', PREOP => q{$(PERLRUN) -MExtUtils::Autoconf -e'ExtUtils::Autoconf->run_autogen'} },
);


applications/custom/sde-supportRequest.pm-orig  view on Meta::CPAN

    use Data::Dumper;
    print Dumper (%methods), "\n";
  }

  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  my %fieldlist;

  if ( defined $fieldlist ) {
    my $counter = 10;
    %fieldlist = map { $counter++ => $_ } split (/,/, $fieldlist);
  } else {
    $fieldlist {'*'} = '*';
  }

  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  my ($rv, %valueEventsDataDisplay, %valueSupportRequestData) = ( 1 );

	$rv = _getEventsData ($catalogID, $uKey, \%valueEventsDataDisplay, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID, $debug);

applications/htmlroot/cgi-bin/moderator/generateCollectorDaemonSchedulingReport.pl  view on Meta::CPAN

  $c->xAxis()->setLabelStyle("tahoma.ttf", 8, $forGround);

  # Reverse the x-axis scale so that it points downwards.
  $c->xAxis()->setReverse();

  # Set the horizontal ticks and grid lines to be between the bars
  $c->xAxis()->setTickOffset(0.5);

  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  # Use a red hash pattern as the color for the actual dates. The pattern is created as a 4 x 4 bitmap defined in memory as an array of colors.
  my $actualColor = $c->patternColor([0xFF000000, 0xFF000000, 0xFF000000, 0xff0000, 0xFF000000, 0xFF000000, 0xff0000, 0xFF000000, 0xFF000000, 0xff0000, 0xFF000000, 0xFF000000, 0xff0000, 0xFF000000, 0xFF000000, 0xFF000000], 4);

  # Add a box whisker layer to represent the actual dates. We add the actual dates layer first, so it will be the top layer.
  my $actualLayer = $c->addBoxLayer(\@actualStartDate, \@actualEndDate, $actualColor, "Actual");
  $actualLayer->setXData(\@dataPoints);

  # Set the bar height to 16 pixels so they will not block the bottom bar
  $actualLayer->setDataWidth(16);

  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

applications/tools/resources/CalendarPopup-combined.js  view on Meta::CPAN

		}
	this.use_gebi = false;
	this.use_css = false;
	this.use_layers = false;
	if (document.getElementById) { this.use_gebi = true; }
	else if (document.all) { this.use_css = true; }
	else if (document.layers) { this.use_layers = true; }
	else { this.type = "WINDOW"; }
	this.offsetX = 0;
	this.offsetY = 0;
	// Method mappings
	this.getXYPosition = PopupWindow_getXYPosition;
	this.populate = PopupWindow_populate;
	this.setUrl = PopupWindow_setUrl;
	this.setWindowProperties = PopupWindow_setWindowProperties;
	this.refresh = PopupWindow_refresh;
	this.showPopup = PopupWindow_showPopup;
	this.hidePopup = PopupWindow_hidePopup;
	this.setSize = PopupWindow_setSize;
	this.isClicked = PopupWindow_isClicked;
	this.autoHide = PopupWindow_autoHide;

applications/tools/resources/CalendarPopup-combined.js  view on Meta::CPAN

	c.disabledDatesExpression = "";
	c.yearSelectStartOffset = 2;
	c.currentDate = null;
	c.todayText="Today";
	c.cssPrefix="";
	c.isShowNavigationDropdowns=false;
	c.isShowYearNavigationInput=false;
	window.CP_calendarObject = null;
	window.CP_targetInput = null;
	window.CP_dateFormat = "MM/dd/yyyy";
	// Method mappings
	c.copyMonthNamesToWindow = CP_copyMonthNamesToWindow;
	c.setReturnFunction = CP_setReturnFunction;
	c.setReturnMonthFunction = CP_setReturnMonthFunction;
	c.setReturnQuarterFunction = CP_setReturnQuarterFunction;
	c.setReturnYearFunction = CP_setReturnYearFunction;
	c.setMonthNames = CP_setMonthNames;
	c.setMonthAbbreviations = CP_setMonthAbbreviations;
	c.setDayHeaders = CP_setDayHeaders;
	c.setWeekStartDay = CP_setWeekStartDay;
	c.setDisplayType = CP_setDisplayType;

lib/ASNMTAP/Asnmtap/Applications.pm  view on Meta::CPAN

    return (0, ());
  }

  unless ( defined $cgisession ) {
    print "\nEmpty cgisess file '$cgipathFilename'!\n" if ($Tdebug);
    return (0, ());
  }

  print "$cgisession\n\n" if ($Tdebug == 2);

  (undef, $cgisession) = map { split (/^\$D = {/) } split (/};;\$D$/, $cgisession);
  $cgisession =~ s/["']//g;

  my %session = map { my ($key, $value) = split (/ => /) } split (/,/, $cgisession);

  if ($Tdebug == 2) {
    print "Session param\n";
    print "_SESSION_ID          : ", $session{_SESSION_ID}, "\n" if (defined $session{_SESSION_ID});
    print "_SESSION_REMOTE_ADDR : ", $session{_SESSION_REMOTE_ADDR}, "\n" if (defined $session{_SESSION_REMOTE_ADDR});
    print "_SESSION_CTIME       : ", $session{_SESSION_CTIME}, "\n" if (defined $session{_SESSION_CTIME});
    print "_SESSION_ATIME       : ", $session{_SESSION_ATIME}, "\n" if (defined $session{_SESSION_ATIME});
    print "_SESSION_ETIME       : ", $session{_SESSION_ETIME}, "\n" if (defined $session{_SESSION_ETIME});
    print "_SESSION_EXPIRE_LIST : ", $session{_SESSION_EXPIRE_LIST}, "\n" if (defined $session{_SESSION_EXPIRE_LIST});
    print "ASNMTAP              : ", $session{ASNMTAP}, "\n" if (defined $session{ASNMTAP});

lib/ASNMTAP/Asnmtap/Applications.pm  view on Meta::CPAN


# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

sub _in_cyclus {
  my ($what, $cyclus, $min, $max) = @_;

  my @a = split(/,/, $cyclus);
  my @b = ();
  my ($x, $i);

  map {
    if (/^\*\/(\d+)$/) {                                          # */n
      if ($1) {
        for $i ($min..$max) { push (@b, $i) if ((($i-$min) % $1) == 0); };
      }
    } elsif (/^\*$/) {                                            # *
      push (@b, $min..$max);
    } elsif (/^(\d+)-(\d+)\/(\d+)$/) {					          # x-y/n
      if ($3) {
        for $i ($1..$2) { push (@b, $i) if ((($i-$1) % $3) == 0); };
      }

lib/ASNMTAP/Asnmtap/Applications/CGI.pm  view on Meta::CPAN


    if ( $logonRequestLogoff ne 'logoff' ) {
      if ( $session->param('~logged-in') ) {
        $subTitle .= "&nbsp;&nbsp;<a href=\"" .$ENV{SCRIPT_NAME}. "?pagedir=$pagedir&amp;pageset=$pageset&amp;debug=$debug&amp;CGISESSID=$sessionID&amp;logonRequest=logoff\"><IMG SRC=\"$IMAGESURL/logoff.jpg\" title=\"Logoff " .$session->param('remote...
      } else {
        $session->param('remoteUser', $ENV{REMOTE_USER}) if ($ENV{REMOTE_USER});
      }
    } else {
      if ( $debug eq 'T' and defined $queryString ) {
        # standard code to parse HTTP query parameters
        my %query = map { my($k, $v) = split(/=/) } split(/&/, $queryString);
        while (my ($key, $value) = each(%query)) { print "$key=$value<br>\n"; }
      }
    }

    return ($subTitle);
  }

  if ( $level eq 'guest' or $level eq 'member' ) {
    $sessionID = $cgi->cookie('asnmtap-root-cgisess') || $cgi->param("CGISESSID") || undef;
  } else {

lib/ASNMTAP/Asnmtap/Applications/CGI.pm  view on Meta::CPAN

        $errorUserAccessControl = "Remote User, Password and/or Time stamp are missing";
      }
    }

    if (defined $errorUserAccessControl) {
      $logonRequest = "logonView";
      my $trials = $session->param('~login-trials') || 0;
      $session->param('~login-trials', ++$trials);

      if ( $debug eq 'T' and defined $queryString ) {
        my %query = map { my($k, $v) = split(/=/) } split(/&/, $queryString);
        while (my ($key, $value) = each(%query)) { print "$key=$value<br>\n"; }
        print "&lt;$password&gt; " if (defined $password);
        print "&lt;$logonPassword&gt;<br>\n";
      }
    }

    if( $logonRequest eq "logonView" ) {
      $logonTimestamp = time();
      print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, 'Logon', 3600, '', 'F', "<script language=\"JavaScript1.2\" type=\"text/javascript\" src=\"$HTTPSURL/md5.js\"></script>", $sessionID);
      print "<br>\n<table WIDTH=\"100%\" border=0><tr><td class=\"HelpPluginFilename\">\n<font size=\"+1\">$errorUserAccessControl</font>\n</td></tr></table>\n<br>\n" if ( defined $errorUserAccessControl );

lib/ASNMTAP/Asnmtap/Applications/CGI.pm  view on Meta::CPAN

<form action="$ENV{SCRIPT_NAME}" method="post" name="usac" onSubmit="return validateForm();">
  <input type="hidden" name="pagedir"        value="$pagedir">
  <input type="hidden" name="pageset"        value="$pageset">
  <input type="hidden" name="debug"          value="$debug">
  <input type="hidden" name="CGISESSID"      value="$sessionID">
  <input type="hidden" name="logonRequest"   value="logonCheck">
  <input type="hidden" name="logonTimestamp" value="$logonTimestamp">
HTML

      if ( defined $queryString ) {
        my %query = map { my($k, $v) = split(/=/) } split(/&/, $queryString);
        while (my ($key, $value) = each(%query)) { print "<input type=\"hidden\" name=\"$key\" value=\"$value\">\n"; }
      }

      print <<HTML;
  <table border="0" cellspacing="0" cellpadding="0">
    <tr><td><b>Remote User: </b></td><td>
      <input type="text" name="remoteUser" value="" size="15" maxlength="15">
    </td></tr><tr><td><b>Password: </b></td><td>
      <input type="password" name="logonPassword" value="" size="15" maxlength="32">&nbsp;&nbsp;The password must contain at least 1 number, at least 1 lower case letter, and at least 1 upper case letter.
    </td></tr><tr align="left"><td align="right"><br><input type="submit" value="Logon"></td><td><br><input type="reset" value="Reset"></td></tr>

lib/ASNMTAP/Asnmtap/Applications/CGI.pm  view on Meta::CPAN


  print "$inputType, $selYear, $selQuarter, $selMonth, $selWeek, $selStartDate, $selEndDate, $startDate, $endDate, $sqlStartDate, $sqlEndDate, $fromDeltaDays, $toDeltaDays, $numberOfDays, $sqlDeltaDays, $goodDate\n" if ( $debug eq 'T' );
  return ($goodDate, $sqlStartDate, $sqlEndDate, $numberOfDays);
}

# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

sub create_combobox_from_keys_and_values_pairs {
  my ($comboboxSelectKeysAndValuesPairs, $sortOn, $sortNumeric, $Ckey, $selectName, $selectValue, $selectLabel, $formDisabled, $onChange, $debug) = @_;

  my %comboSelectKeysAndValuesPairs = map { my ($key, $value) = split (/=>/) } split (/\|/, $comboboxSelectKeysAndValuesPairs);

  my $comboSelect  = "<select name=\"$selectName\" $formDisabled $onChange>\n";

  if ($selectLabel ne '') {
    $comboSelect .= "          <option value=\"$selectValue\"";
    $comboSelect .= " selected" if ($Ckey eq $selectValue);
    $comboSelect .= ">$selectLabel</option>\n";
  }

  if ($sortOn eq 'K') {

lib/ASNMTAP/Asnmtap/Plugins/Mail.pm  view on Meta::CPAN

                        smtp            => 'localhost',
                        port            => 25,
                        retries         => 3,
                        delay           => 1,
                        mime            => 0,
                        tz              => undef,
                        debug           => 0
					  },
                    _IMAP4              =>
                      {
                        imap4           => undef,
                        port            => 143,
                        username        => undef,
                        password        => undef,
                        timeout         => 120,
                        debug           => 0
                      },
                    _POP3               =>
                      {
                        pop3            => undef,
                        port            => 110,

lib/ASNMTAP/Asnmtap/Plugins/Mail.pm  view on Meta::CPAN

    $self->{_SMTP}->{smtp}          = $args{_SMTP}->{smtp}          if ( exists $args{_SMTP}->{smtp} );
    $self->{_SMTP}->{port}          = $args{_SMTP}->{port}          if ( exists $args{_SMTP}->{port} );
    $self->{_SMTP}->{retries}       = $args{_SMTP}->{retries}       if ( exists $args{_SMTP}->{retries} );
    $self->{_SMTP}->{delay}         = $args{_SMTP}->{delay}         if ( exists $args{_SMTP}->{delay} );
    $self->{_SMTP}->{mime}          = $args{_SMTP}->{mime}          if ( exists $args{_SMTP}->{mime} );
    $self->{_SMTP}->{tz}            = $args{_SMTP}->{tz}            if ( exists $args{_SMTP}->{tz} );
    $self->{_SMTP}->{debug}         = $args{_SMTP}->{debug}         if ( exists $args{_SMTP}->{debug} );
  }

  if ( exists $args{_IMAP4} ) {
    $self->{_IMAP4}->{imap4}        = $args{_IMAP4}->{imap4}        if ( exists $args{_IMAP4}->{imap4} );
    $self->{_IMAP4}->{port}         = $args{_IMAP4}->{port}         if ( exists $args{_IMAP4}->{port} );
    $self->{_IMAP4}->{username}     = $args{_IMAP4}->{username}     if ( exists $args{_IMAP4}->{username} );
    $self->{_IMAP4}->{password}     = $args{_IMAP4}->{password}     if ( exists $args{_IMAP4}->{password} );
    $self->{_IMAP4}->{timeout}      = $args{_IMAP4}->{timeout}      if ( exists $args{_IMAP4}->{timeout} );
    $self->{_IMAP4}->{debug}        = $args{_IMAP4}->{debug}        if ( exists $args{_IMAP4}->{debug} );
  }

  if ( exists $args{_POP3} ) {
    $self->{_POP3}->{pop3}          = $args{_POP3}->{pop3}          if ( exists $args{_POP3}->{pop3} );
    $self->{_POP3}->{port}          = $args{_POP3}->{port}          if ( exists $args{_POP3}->{port} );

lib/ASNMTAP/Asnmtap/Plugins/Mail.pm  view on Meta::CPAN

    return ( $ERRORS{UNKNOWN} );
  }

  unless ($parms{receivedState} =~ /^[01]$/ ) {
    $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Parameter receivedState must be 0 or 1' }, $TYPE{APPEND} );
    return ( $ERRORS{UNKNOWN} );
  }

  my ($numberOfMails, $email);

  if ( defined $self->{_IMAP4}->{imap4} ) {
    unless ( defined $self->{_IMAP4}->{username} ) {
      $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing Mail IMAP4 parameter username' }, $TYPE{APPEND} );
      return ( $ERRORS{UNKNOWN} );
    }

    unless ( defined $self->{_IMAP4}->{password} ) {
      $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing Mail IMAP4 parameter password' }, $TYPE{APPEND} );
      return ( $ERRORS{UNKNOWN} );
    }

    use Net::IMAP::Simple;
    $email = Net::IMAP::Simple->new ( $self->{_IMAP4}->{imap4}, port => $self->{_IMAP4}->{port}, timeout => $self->{_IMAP4}->{timeout} );
 
    unless ( defined $email ) {
      $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => "Cannot connect to IMAP4 server: $self->{_IMAP4}->{imap4}, $Net::IMAP::Simple::errstr" }, $TYPE{APPEND} );
      return ( $ERRORS{UNKNOWN} );
    }
 
    unless ( $email->login( $self->{_IMAP4}->{username}, $self->{_IMAP4}->{password} ) ){
      my $errstr = $email->errstr; $errstr =~ s/[\n\r]/ /g; $errstr =~ s/ +$//g; 
      $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => "Cannot login to IMAP4 server: $self->{_IMAP4}->{imap4}, $errstr" }, $TYPE{APPEND} );
      return ( $ERRORS{UNKNOWN} );
    }

    $numberOfMails = $email->select ( 'INBOX' );

    unless ( defined $numberOfMails ) {
      my $errstr = $email->errstr; $errstr =~ s/[\n\r]/ /g; $errstr =~ s/ +$//g; 
      $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => "Cannot select my INBOX on IMAP4 server: $self->{_IMAP4}->{imap4}, $errstr" }, $TYPE{APPEND} );
      return ( $ERRORS{UNKNOWN} );
    }
  } elsif ( defined $self->{_POP3}->{pop3} ) {
    unless ( defined $self->{_POP3}->{username} ) {
      $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing Mail POP3 parameter username' }, $TYPE{APPEND} );
      return ( $ERRORS{UNKNOWN} );
    }

    unless ( defined $self->{_POP3}->{password} ) {
      $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing Mail POP3 parameter password' }, $TYPE{APPEND} );

lib/ASNMTAP/Asnmtap/Plugins/Mail.pm  view on Meta::CPAN

            ($xmlNotFound, $fingerprintFound) = (1, $fingerprintFound + 2);
          } else {
            ($messageNotFound, $brandingNotFound, $timestampNotFound, $fingerprintFound) = (1, 1, 1, $fingerprintFound + 4);
          }
        }

        $self->{defaultArguments}->{result} = '';

        my $msgbuffer;

        if ( defined $self->{_IMAP4}->{imap4} ) {
          $msgbuffer = $email->top ( $msgnum );
        } elsif ( defined $self->{_POP3}->{pop3} ) {
          $msgbuffer = $email->Head ( $msgnum );
        }

        my $entity = $parser->parse_data( $msgbuffer );
        my $head = $entity->head;
        $head->unfold;

        if ( $debug >= 2 ) {

lib/ASNMTAP/Asnmtap/Plugins/Mail.pm  view on Meta::CPAN

              my $label = $subjectNotFound ? '    (?)' : '(match)';
              print "  $label : $self->{_text}->{subject} $self->{_subject_}\n" if ($debug);
              unless ( $subjectNotFound ) { $fingerprintFound--; next; }
		        }
          }
        }

        unless ( $fromNotFound or $toNotFound or $subjectNotFound ) {
          print "\n", ref ($self), "::receiving_fingerprint_mails(): BODY\n" if ($debug);

          if ( defined $self->{_IMAP4}->{imap4} ) {
            use Email::Simple;
            my $mail = Email::Simple->new( join ( '', @{ $email->get ( $msgnum ) } ) );
            $msgbuffer = $mail->body;
          } elsif ( defined $self->{_POP3}->{pop3} ) {
            $msgbuffer = $email->Body ( $msgnum );
          }

          use MIME::Decoder;

          unless ( supported MIME::Decoder $head->mime_encoding ) {

lib/ASNMTAP/Asnmtap/Plugins/Mail.pm  view on Meta::CPAN

          }

          print "\n", ref ($self), "::receiving_fingerprint_mails(): BODY MESSAGE\n". $self->{defaultArguments}->{result}. "\n" if ($debug >= 2);

          if ( defined $parms{custom} ) {
            $returnCode = ( defined $parms{customArguments} ) ? $parms{custom}->($self, $self->{_asnmtapInherited}, $email, $msgnum, $parms{customArguments}) : $parms{custom}->($self, $self->{_asnmtapInherited}, $email, $msgnum);
          } else {
            $self->{defaultArguments}->{numberOfMatches}++;

            unless ( $debug or $$asnmtapInherited->getOptionsValue ('onDemand') ) {
              if ( defined $self->{_IMAP4}->{imap4} ) {
                $email->delete ( $msgnum );
              } elsif ( defined $self->{_POP3}->{pop3} ) {
                $email->Delete( $msgnum );
              }
            }
          }
        }

        $self->{defaultArguments}->{date}  = undef;
        $self->{defaultArguments}->{day}   = undef;

lib/ASNMTAP/Asnmtap/Plugins/Mail.pm  view on Meta::CPAN

      undef $parser;
    }

    if ( defined $self->{defaultArguments}->{numberOfMatches} and $self->{defaultArguments}->{numberOfMatches} ) {
      $$asnmtapInherited->pluginValues ( { alert => $self->{defaultArguments}->{numberOfMatches} .' '. ( defined $parms{perfdataLabel} ? $parms{perfdataLabel} : 'email(s) received' ) }, $TYPE{APPEND} );
    } else {
      $returnCode = $parms{receivedState} ? $ERRORS{OK} : $ERRORS{CRITICAL};
      $$asnmtapInherited->pluginValues ( { stateValue => $returnCode, alert => 'No '. ( defined $parms{perfdataLabel} ? $parms{perfdataLabel} : 'email(s) received' ) }, $TYPE{APPEND} );
    }

    if ( defined $self->{_IMAP4}->{imap4} ) {
      $email->quit;
    } elsif ( defined $self->{_POP3}->{pop3} ) {
      $email->Close;
    }

    $$asnmtapInherited->appendPerformanceData ( "'". $parms{perfdataLabel} ."'=". $self->{defaultArguments}->{numberOfMatches} .';;;;' ) if ( defined $parms{perfdataLabel} );
    return ( $returnCode, $self->{defaultArguments}->{numberOfMatches} );
  }
}

lib/ASNMTAP/Asnmtap/Plugins/Mail.pod  view on Meta::CPAN

prints stuff to STDERR. Current maximum is 6, which prints the whole SMTP session, except data exceeding 500 bytes.

optional, scalar value, default: inherited from the parent object command line option -d or --debug

=back

=item _IMAP4

=over 4

=item imap4

IMAP4 host to connect to.

=item port (reserved)

port used when none is specified in the server name.

optional, scalar value, default: 143

=item username

lib/ASNMTAP/Asnmtap/Plugins/NPTest.pm  view on Meta::CPAN

(C<$desiredExitStatus> and C<$desiredOutput>) results in a invocation
of either C<Test::ok(...)> or C<Test::skip(...)>, so remember this
when counting the number of tests to place in the C<Test::plan(...)>
call.

Many Nagios Plugins test network services, some of which may not be
present on all systems. To cater for this, C<checkCmd(...)> allows the
tester to define exceptions based on the command's exit status. These
exceptions are provided to skip tests if the test case developer
believes the service is not being provided. For example, if a site
does not have a POP3 server, the test harness could map the
appropriate exit status to a useful message the person running the
tests, telling the reason the test is being skipped.

Example:

my %exceptions = ( 2 =E<gt> "No POP Server present?" );

$t += checkCmd( "./check_pop I<some args>", 0, undef, %exceptions );

Thus, in the above example, an exit status of 2 does not result in a

lib/ASNMTAP/Asnmtap/Plugins/NPTest.pm  view on Meta::CPAN

=item *

Firstly, if C<$desiredExitStatus> is a reference to an array of exit
stati, if the actual exit status of the command is present in the
array, it is used in the call to C<Test::ok(...)> when testing the
exit status.

=item *

Alternatively, if C<$desiredExitStatus> is a reference to a hash of
exit stati (mapped to the strings "continue" or "skip"), similar
processing to the above occurs with the side affect of determining if
any generated output testing should proceed. Note: only the string
"skip" will result in generated output testing being skipped.

=back

=item C<skipMissingCmd(...)>

If a command is missing and the test harness must C<Test::skip()> some
or all of the tests in a given test harness this function provides a

lib/ASNMTAP/Asnmtap/Plugins/WebTransact.pm  view on Meta::CPAN

                   download_images  => FALSE,
                   fail_if_1        => TRUE );

  my %parms = (%defaults, @_);

  my $debug         = ${$self->{asnmtapInherited}}->getOptionsValue ( 'debug' );
  my $onDemand      = ${$self->{asnmtapInherited}}->getOptionsValue ( 'onDemand' );
  my $debugfile     = ${$self->{asnmtapInherited}}->getOptionsArgv ( 'debugfile' );
  my $openAppend    = $parms{openAppend};
  my $triesTiming   = $parms{triesTiming};
  my %triesCodesToDeterminate = map { $_ => 1 } ( $parms{triesCodes} =~ m<(\d+(?:\.\d+)*)>g );

  my $proxyServer   = ${$self->{asnmtapInherited}}->proxy ( 'server' );
  my $proxyUsername = ${$self->{asnmtapInherited}}->proxy ( 'username' );
  my $proxyPassword = ${$self->{asnmtapInherited}}->proxy ( 'password' );

  $self->{newAgent} = $parms{newAgent} if ( defined $parms{newAgent} and defined $ua );

  if ( $self->{newAgent} or ! defined $ua ) {
    $self->{newAgent} = 0;
    LWP::Debug::level('+') if ( $debug );

lib/ASNMTAP/Asnmtap/Plugins/WebTransact.pm  view on Meta::CPAN


  my $cb = sub {
    my ($tag, %attr) = @_;
    return if $tag ne 'img';           # we only look closer at <img ...>
    push (@imgs, $attr{src});
  };

  my $p = HTML::LinkExtor->new($cb);
  $p->parse($response->as_string);
  my $base = $response->base;
  my @imgs_abs = grep ! $downloaded_hr->{$_}++, map { my $x = url($_, $base)->abs; } @imgs;
  my @img_urls = map { Method => 'GET', Url => $_->as_string, Qs_var => [], Qs_fixed => [], Exp => '.', Exp_Fault => 'NeverInAnImage', Msg => '.', Msg_Fault => 'NeverInAnImage', Perfdata_Label => $_->as_string }, @imgs_abs;

  # url() returns an array ref containing the abs url and the base.
  if ( my $number_of_images_not_already_downloaded = scalar @img_urls ) {
    my $img_trx = __PACKAGE__->new( $self->{asnmtapInherited}, \@img_urls );
    my %image_dl_parms = (%$parms_hr, fail_if_1 => FALSE, download_images => FALSE);
    return ( $img_trx->check( {}, %image_dl_parms), 'Downloaded not all '. $number_of_images_not_already_downloaded .' images found in '. $response->base, $number_of_images_not_already_downloaded );
  } else {
    return ( $ERRORS{OK}, 'Downloaded all __zero__ images found in '. $response->base, 0 );
  }
}



( run in 1.063 second using v1.01-cache-2.11-cpan-49f99fa48dc )