Hola, gracias por ver mi "
thread". Tengo un problema con CGI::Application y quiero ver qué estoy haciendo mal.
Este es el
script con el que cargo la clase y hago el objeto:
Using perl Syntax Highlighting
#!C:/Perl/bin/perl.exe
use warnings;
use strict;
use lib('./lib');
use Personalized;
use Data::Dumper;
my $prog = Personalized->new();
$prog->run();
y esta es la clase (módulo):
Using perl Syntax Highlighting
package Personalized;
use warnings;
use strict;
use CGI;
use base qw( CGI::Application );
sub setup{
my $self = shift;
$self->run_modes(
'Mode_1' => 'Home_Page',
'Mode_2' => 'Do_Request'
);
$self->mode_param('action');
$self->start_mode('Mode_1');
}
sub Home_Page{
my $self = shift;
my $tmpl = $self->load_tmpl('./Templates/Home Page/home_page.htm');
return $tmpl->output;
}
sub Do_Request{
my $self = shift;
my $q = $self->query();
my %Vars = $q->Vars;
my $radio = $Vars{'find'};
my $text_find = $Vars{'text_find'};
my $tmpl = $self->load_tmpl('./Templates/Home Page/Home_Page.htm');
my $URL;
$text_find =~ s/ /+/g;
if (!$radio){
$tmpl->param('error' => 1);
return $tmpl->output;
}
if (!$text_find){
$tmpl->param('search_err' => 1);
return $tmpl->output;
}
if ($radio eq 'Google'){
$URL = "http://www.google.com.mx/search?hl=es&source=hp&q=$text_find&meta=&aq=f&oq=";
}
elsif($radio eq 'Psk'){
$URL = "http://www.pskonejott.com/otc_display.php?character=$text_find";
}
elsif($radio eq 'W3'){
$URL = "http://www.google.com/search?sitesearch=www.w3schools.com&as_q=$text_find";
}
$self->header_add(-location => $URL);
}
1;
He estado queriendo ver qué esta mal, porque antes me decía error fatal en el intérprete, pero le cambie algo, no me acuerdo y funcionó bien, pero ahora me dice:
Citar:
CGI::Application::run('Personalized=HASH(0x239e4c))' called at run_home_page.cgi line 10
at run_home_page.cgi line 1