You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Patton, Billy N" <bi...@h3net.com> on 2014/10/21 17:54:07 UTC

[users@httpd] WWW::Mechanize for testing

Trying to use WWW::Mechanize for my unit testing of an app.
I requires a login, but this is something that comes before it hits my .cgi.

I believe it is using the .htaccess to get it’s data.

Here is my script using WWW::Mechanize.

#!/usr/bin/perl -w
use strict;
use warnings;
use Data::Dumper;
$Data::Dumper::Indent   = 1;
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Deepcopy = 1;
use Test::More qw (no_plan);
use Cwd;
use WWW::Mechanize;

my $loginID   = 'dogs';
my $password  = 'pigs';
my $url       = 'http://cats.sheep/cp.cgi';
my $mech      = WWW::Mechanize->new(); # start off the whole enchilada
$mech->set_visible($loginID, $password);  # enter in the loginid and password
$mech->get($url);



The documentation I have read tells me to use set_visible.

When I have it before the get I get the following error.
HTML::Form::parse: No $base_uri provided at /Library/Perl/5.16/WWW/Mechanize.pm line 2759.

if I move it after the get I get the following error.

Error GETing http://billys-cportal-test.dfw0.hypercube-llc.com/cp.cgi: Authorization Required at t/cportal.t line 31.


So how do I do a get when the login stuff is not controlled by my App?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] WWW::Mechanize for testing

Posted by "Patton, Billy N" <bi...@h3net.com>.
Got it
On Oct 21, 2014, at 10:54 AM, Patton, Billy N <Bi...@h3net.com> wrote:

> Trying to use WWW::Mechanize for my unit testing of an app.
> I requires a login, but this is something that comes before it hits my .cgi.
> 
> I believe it is using the .htaccess to get it’s data.
> 
> Here is my script using WWW::Mechanize.
> 
> #!/usr/bin/perl -w
> use strict;
> use warnings;
> use Data::Dumper;
> $Data::Dumper::Indent   = 1;
> $Data::Dumper::Sortkeys = 1;
> $Data::Dumper::Deepcopy = 1;
> use Test::More qw (no_plan);
> use Cwd;
> use WWW::Mechanize;
> 
> my $loginID   = 'dogs';
> my $password  = 'pigs';
> my $url       = 'http://cats.sheep/cp.cgi';
> my $mech      = WWW::Mechanize->new(); # start off the whole enchilada
> $mech->set_visible($loginID, $password);  # enter in the loginid and password
> $mech->get($url);
> 
> 
> 
> The documentation I have read tells me to use set_visible.
> 
> When I have it before the get I get the following error.
> HTML::Form::parse: No $base_uri provided at /Library/Perl/5.16/WWW/Mechanize.pm line 2759.
> 
> if I move it after the get I get the following error.
> 
> Error GETing http://billys-cportal-test.dfw0.hypercube-llc.com/cp.cgi: Authorization Required at t/cportal.t line 31.
> 
> 
> So how do I do a get when the login stuff is not controlled by my App?
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org