At wits end CG::unescape

2014-11-25 Thread Patton, Billy N
OS : mac 10.10.1 Yosemite
Perl version : 5.16.0 (perlbrew)
I have file cp.cgi that is the top level
It uses CP.pm
which inherits Base.pm
which inherits CGI::Application
CGI::Application Requires CGI.pm
CGI.pm has a use CGI::Util qw(… unescape …);

When I try and run cp.cgi I get a timeout.
The erro log only tells me that I get a timeout
[Tue Nov 25 09:13:53.677383 2014] [cgi:warn] [pid 461] [client ::1:63053] 
AH01220: Timeout waiting for output from CGI script 
/Library/WebServer/Documents/cportal/html/cp.cgi, referer: 
http://localhost/index.html

when I try and run it from the command line : perl cp.cgi
I get
h1Software error:/h1
preUndefined subroutine CGI::unescape
 at 
/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application.pm
 line 1951.
/pre
p
For help, please send mail to this site's webmaster, giving this error message
and the time and date of the error.

/p
[Tue Nov 25 09:34:59 2014] cp.cgi: Undefined subroutine CGI::unescape
[Tue Nov 25 09:34:59 2014] cp.cgi:  at 
/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application.pm
 line 1951.

unescape exists in CGI::Util.pm and is exported.

When I put a Dumper \%INC I get: Making sure that I wasn’t mixing too many 
version

'CGI/Application.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application.pm’,
'CGI/Application/Plugin/Redirect.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application/Plugin/Redirect.pm',
'CGI/Application/Plugin/TT.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application/Plugin/TT.pm’,
'CGI/Application/Plugin/ValidateRM.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application/Plugin/ValidateRM.pm’,
'CGI/Application/Plugin/LogDispatch.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application/Plugin/LogDispatch.pm',
'CGI/Carp.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Carp.pm’,
'CGI/Application/Plugin/Config/YAML.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application/Plugin/Config/YAML.pm',
'CGI/Application/Plugin/DBH.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application/Plugin/DBH.pm’,
'CGI/Util.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Util.pm’,
'CGI/Application/Plugin/Forward.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application/Plugin/Forward.pm’,

unescape does not exist in Application, even though it tells me line 1951
%INC shows me that it is including the right file.
Util.pm is exporting
package CGI::Util;
use base 'Exporter';
require 5.008001;
use strict;
use if $] = 5.019, 'deprecate';
our @EXPORT_OK = qw(rearrange rearrange_header make_attributes unescape escape
expires ebcdic2ascii ascii2ebcdic);

our $VERSION = '4.09’;


Testing my CGI

2014-11-04 Thread Patton, Billy N
I’m using WWW::Mechanize for testing my CGI.
I’m having trouble with the $mech-tick

Here’s my code :
  ok($mech-form_name('cdr_format'),getting form cdr_format);
print pAllFields =  . $mech-value('pAllFields') . \n;
219-  ok($mech-tick('pAllFields',1), 'Setting checkbox to native CDR format');
220-  ok($mech-tick('pAllFields’,0), 'Setting checkbox to native CDR format’);



Here’s a snippet of the html :
div id='myForm'
form name='cdr_format' method='POST' action='file_admin.cgi'
input type='hidden' name='rm' value='process_cdr_format'
input type='hidden' name='CGISESSID' 
value='ec4c3463d5a7f9d04d2924968413f240'
input type='hidden' name='cdr_format' value='1'
table border='0' cellpadding='3' cellspacing='0' width='100%'
tr
td class='fieldLabel' width='60%'
We would like the files in native CDR format:
/td
td class='field'
input type='checkbox' class='checkbox' name='pAllFields' value='1'

/td
/tr


When I execute I get this :
ok 40 - getting form cdr_format
Use of uninitialized value in concatenation (.) or string at ./test_cportal.pl 
line 218.
pAllFields =
not ok 41 - Setting checkbox to native CDR format
#   Failed test 'Setting checkbox to native CDR format'
#   at ./test_cportal.pl line 219.
not ok 42 - Setting checkbox to native CDR format
#   Failed test 'Setting checkbox to native CDR format'
#   at ./test_cportal.pl line 220.

Here’s the documentation from WWW::Mechanize
$mech-tick( $name, $value [, $set] )

Ticks the first checkbox that has both the name and value associated with it 
on the current form. Dies if there is no named check box for that value. 
Passing in a false value as the third optional argument will cause the checkbox 
to be unticked.


WWW::Mechanize question

2014-11-03 Thread Patton, Billy N
I’ve inherited an app that uses templates.
Most of the template contain multiple forms and tables within and buttons 
within that.
The order of the forms I can get from the template, most are not named forms so 
I have to get them with form_number(#)

Question:
Can I depend on the form number being the same each time it is loaded?
Or will it change.

Re: WWW::Mechanize question

2014-11-03 Thread Patton, Billy N
Thanks,
Some times it is conditional, depending on admin rights.  But your right I 
should add  a name to each of them, it would make things much easier.
Just can’t do it to the current production version.
Guess I need to make copy and test that one :)
 On Nov 3, 2014, at 8:50 AM, John SJ Anderson geneh...@genehack.org wrote:
 
 Hi Billy -
 
 Are any of the forms in the templates displayed conditionally? (I.e.,
 are there forms inside IF blocks in the templates.)
 
 If not -- if all the forms are always shown -- then yes, the numbers
 should be stable.
 
 My suggestion would be to just add unique identifiers to the forms,
 because then you won't have to worry about it.
 
 chrs,
 john.
 
 
 On Mon, Nov 3, 2014 at 6:41 AM, Patton, Billy N billy.pat...@h3net.com 
 wrote:
 I’ve inherited an app that uses templates.
 Most of the template contain multiple forms and tables within and buttons 
 within that.
 The order of the forms I can get from the template, most are not named forms 
 so I have to get them with form_number(#)
 
 Question:
Can I depend on the form number being the same each time it is loaded?
Or will it change.



Re: WWW::Mechanize question

2014-11-03 Thread Patton, Billy N
I’ve gotten everything copied and working from the Chrome, but when I execute 
my test script I get :
ok 1 - In sub main::login
ok 2 -: 49   : Credentials passed ok
Error GETing http://cportal-test.dfw0.hypercube-llc.com/html/cp.cgi: 
Authorization Required at /System/Library/Perl/Extras/5.18/LWP/Authen/Basic.pm 
line 56.

Here is my .htaccess :
AuthType Basic
AuthName HyperCube Customer Portal requires a username and password
AuthUserFile /var/www/passwords/cportal.passwd
Require valid-user


login/password is the same for all versions.


I know it is something just one step away, can’t get what it is?


 On Nov 3, 2014, at 8:50 AM, John SJ Anderson geneh...@genehack.org wrote:
 
 Hi Billy -
 
 Are any of the forms in the templates displayed conditionally? (I.e.,
 are there forms inside IF blocks in the templates.)
 
 If not -- if all the forms are always shown -- then yes, the numbers
 should be stable.
 
 My suggestion would be to just add unique identifiers to the forms,
 because then you won't have to worry about it.
 
 chrs,
 john.
 
 
 On Mon, Nov 3, 2014 at 6:41 AM, Patton, Billy N billy.pat...@h3net.com 
 wrote:
 I’ve inherited an app that uses templates.
 Most of the template contain multiple forms and tables within and buttons 
 within that.
 The order of the forms I can get from the template, most are not named forms 
 so I have to get them with form_number(#)
 
 Question:
Can I depend on the form number being the same each time it is loaded?
Or will it change.



cgi and inheritance

2014-10-06 Thread Patton, Billy
I’ve recently inherited some code that hasn’t been touched in over 5 years. 
It’s all cgi and OOPerl.
I’ve ran across this one statement that I don’t understand.

$self-log-error(*)

I know the self
and I’ve traced the error to CGI::Application through inheritance.
But it’s the -log- that has me confused.
I have no class named log
I find no place that is does a new on log anywhere in the family tree.
I cannot find any log class anywhere in the family tree of inheritance.

Is this just a method of using a perl hash that I’m not familiar with?
Could it be rewritten as 
$self-{‘log’}-error(*);

Using perl 5.16.2
on MAC 10.9.5
--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/