App-Validation-Automation

 view release on metacpan or  search on metacpan

lib/App/Validation/Automation/Web.pm  view on Meta::CPAN

package App::Validation::Automation::Web;

use Moose;
use Carp;
use WWW::Mechanize;
use HTML::Form::ForceValue;
use English qw( -no_match_vars );
use namespace::autoclean;

=head1 NAME

App::Validation::Automation::Web - Base Class App::Validation::Automation

Stores utilities that perform web based validation

=head1 SYNOPSIS

App::Validation::Automation::Web browses the web urls stored in config or passed as arguments using WWW::Mechanize Logs into the web urls using the credentials stored in attributes.Handles password expiry and authentication failure along with DNS rou...

=head1 ATTRIBUTES

user_name houses the login name needed to login into the web url.password stores the decrypted password.

=cut 

has 'user_name' => (
    is       => 'rw',
    isa      => 'Str',
);

has 'password' => (
    is       => 'rw',
    isa      => 'Str',
);

has 'site' => (
    is       => 'rw',
    isa      => 'Str',
);

has 'zone' => (
    is       => 'rw',
    isa      => 'Str',
);

has 'web_msg' => (
    is       => 'rw',
    isa      => 'Str',
    clearer  => 'clear_web_msg',
); 

has 'mech_state' => (
    is       => 'rw',
    isa      => 'WWW::Mechanize',
); 

=head1 METHODS

=head2 validate_url

Browses the weblink passed as parameter using WWW::Mechanize.Tries to log into the weblink if user_name and password are defined.Tweak this method or override to fit your requirement.

=cut

sub validate_url {
    my $self    = shift;
    my $url     = shift;
    my $mech    = WWW::Mechanize->new();
    my ( $content,    $return,   $web_server,  $web_server_ip, $web_port,
         $app_server, $user,     $menu_tokens, $auto_tokens,   $site,
         $zone,       $slif_flag,$menu_url,    $req_string, $ret);

    $mech->get($url);
    $self->web_msg( $mech->status ) if (not ($ret = $mech->success));

    if($self->user_name && $self->password) {
        $self->mech_state($mech);
        $ret = $self->_login;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.446 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )