ASNMTAP

 view release on metacpan or  search on metacpan

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


=back

=back

=back

A new ASNMTAP::Asnmtap::Plugins::WebTransact object must be created with the I<new> method. Once
this has been done, the check of the Web Transaction is done with the I<check> method.

=over 4

=item ASNMTAP::Asnmtap::Plugins::WebTransact->new (ref_to_array_of_hash_refs)

A new ASNMTAP::Asnmtap::Plugins::WebTransact object must be created with the I<new> method.

A reference to array of hash references ( \@URLS ) is required.

The field urls contains a reference to a list of (hashes) records representing the Web Transaction.

This is the constructor for a ASNMTAP::Asnmtap::Plugins::WebTransact->new object. C<ref_to_array_of_hash_refs> is a reference to an array of records (anon hash refs) in the format :-

I<Structure of the array of hash references:>

 {
   Method         => HEAD|GET|POST,
   Url            => 'http://...',
   Qs_var         => [ cgi_var_name_1 => val_at_run_time, ... ],
   Qs_fixed       => [ cgi_var_name_1 => val_1, ... ],
   Exp            => blah,
   Exp_Fault      => blurb,
   Exp_Return     => { var_label_1 => EXP_VAR_LABEL_1, ... },
   Msg            => 'Status error when not all Exp found',
   Msg_Fault      => 'Status error when Exp_Fault found',
   Timeout        => 30,
   Perfdata_Label => 'Label x'
 }

Qs_fixed and Qs_var are used to generate a query string.

Exp, Exp_Fault and Exp_Return are normal Perl patterns without pattern match delimiters. Most often they are strings.

=over 4

=item Method

scalar, possible values: GET, HEAD or POST

=over 4

=item GET

The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and n...

=item HEAD

The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GE...

=item POST

The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line.

=back

=item Url

scalar, any valid URL: RFC 1738

Request for Comments document (RFC) for Uniform Resource Locators (URL).

=item Qs_var

B<Qs_var> contains placeholders for values that are not known until run time.

In both cases, the format of these fields is a reference to an array containing alternating CGI
variable names and values eg \(name1, v1, name2, v2, ...) produces a query string name1=v1&name2=v2&..

Qs_var allows values to be specified in three ways :-

=over 4

=item *

a string that will be used as a key in the hash of arguments passed to the check method.

=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.



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