ASNMTAP

 view release on metacpan or  search on metacpan

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


=item *

a positive integer (0, 1, ...)

=back

In the latter case, the integer will be used as an index of the array of matches found from the
last set of patterns with memory (specified by the Exp field). So [ cgi_var_name => 0 ] leads to
a query string cgi_var_name = <the_first_match_in_the_set_of_Exp_patterns>

=over 4

=item *

an array ref of the form [ match_index => code_ref ]

In this case, the subroutine referred to by coderef is a subroutine with one parameter and it will be called with that parameter set to the first element in the array (the index of a former match). One may choose to do this with very dynamic web syst...

An example may make this more comprehensible !

 use constant CmrDetailPat       => [ qw( name="addr1_data-name1\[1\]"\s+value="(.*?)" ) ];
 use constant Stars              => '*' x 8;
 my $star_pat = quotemeta( Stars ) . '$';
 use constant AddStars_to_Name   => [ 'addr1_data-name1[1]' => [0, sub { $_[0] . Stars }] ];
 use constant DelStars_from_Name => [ 'addr1_data-name1[1]' => [0, sub { $_[0] =~ s#$star_pat##; $_[0] }] ];

If 'CmrDetailPat' is used as an Exp field, then a subsequent GET or POST can make use of
Qs_var values 'AddStars_to_Name' and 'DelStars_from_Name' to either append some asterisks to the value of the
web form name addr1_data-name1[1] or remove the stars.

=back

In this case, the subroutine referred to by coderef is a subroutine with one parameter and it will be
called with that parameter set to the first element in the array (the index of a former match).
One may choose to do this with very dynamic web systems such as the SAP R3 module for IIS in which the
CGI names and values may need to be dragged out of former responses.

Is an array reference containing the name value pairs of any parameters whose value is known only at run time.

The format is [ cgi_parm_name => val_at_run_time, ... ] where cgi_parm_name is the name of a fill out form parameter and val_at_run_time is a string used as a key to get the value of the cgi parameter.

Qs_var = [ form_name_1 => 0, form_name_2 => 1 ..] will lead to a query_string like
form_name_1 = $matches[0], form_name_2 = $matches[1] ... in $self->_make_req() by
@matches = $self->matches() and using 0, 1 etc as indices of @matches.

=item Qs_fixed

B<Qs_fixed> contains the name value pairs that are known at compile time whereas.

Is an array reference containing name value pairs.

The format is [ cgi_var_name => val, ... ] where cgi_var_name is the name of a fill out form parameter and val is a string with the value of the cgi parameter

=item Exp .

B<Exp> is the pattern that when matched against the respose to the URL (in the same hash) indicates success.

Is an scalar (value is a string) or an array

$objectWebTransact->matches() will updated with the set of matches it finds by matching
patterns with memory (ie patterns in paren) from the Exp field against the request response.

=item Exp_Fault

B<Exp_Fault> is the pattern that indicates the response is a failure.

If these patterns contain parentheses eg 'match a lot (.*)', then the match is saved for use by
Qs_var. Note that there should be only B<one> pattern per element of the Exp list. Nested patterns
( C<yada(blah(.+)blurble(x|y|zz(top.*))> ) will not work as expected.

Is an scalar (value is a string), ex. blurb

=item Exp_Return

B<Exp_Return> is the pattern that indicates the response is a return.

Is an hash, { var_label_1 => EXP_VAR_LABEL_1, ... }

=item Msg .

This message is added to the error field when not all Exp found.

Is an scalar (value is a string), ex. 'Status error when not all Exp found'

=item Msg_Fault

This message is added to the error field when Exp_Fault found.

Is an scalar (value is a string), ex. 'Status error when Exp_Fault found'

=item Timeout

This means that for this URL the specified timeout will be used.

Is an scalar (value is a integer greater then 0), ex. 30

=item Perfdata_Label

This means that for this URL there performance data will be created and the name for the label equals the value from Perfdata_Label.

Is an scalar (value is a string), ex. 'Label x'

=back

I<Example:>

  use ASNMTAP::Asnmtap::Plugins::WebTransact;

  my @URLS = (
    { Method => 'GET',  Url => 'http://www.citap.be/', Qs_var => [], Qs_fixed => [], Exp => "Consulting Internet Technology Alex Peeters", Exp_Fault => ">>>NIHIL<<<", Msg => "Consulting Internet Technology Alex Peeters", Msg_Fault => "Consulting Inte...
  );

  my $objectWebTransact = ASNMTAP::Asnmtap::Plugins::WebTransact->new ( \$objectPlugins, \@URLS );

equals to:

  use ASNMTAP::Asnmtap::Plugins::WebTransact;

  my @URLS = ();
  my $objectWebTransact = ASNMTAP::Asnmtap::Plugins::WebTransact->new ( \$objectPlugins, \@URLS );



( run in 0.436 second using v1.01-cache-2.11-cpan-39bf76dae61 )