czarfred has asked for the wisdom of the Perl Monks concerning the following question:
package bluebox; use base 'CGI::Application'; use CGI::Carp qw(fatalsToBrowser); use DBI; use strict; sub setup { my $self = shift; $self->mode_param('mode'); $self->start_mode('list'); $self->run_modes( 'list' => \&list, 'view' => \&view, 'edit' => \&edit, 'new' => \&new, 'del' => \&del ); $self->param('dbh' => DBI->connect('dbi:mysql:adb, 'user', 'pass', { +RaiseError => 1, AutoCommit => 0 })); } sub teardown { my $self = shift; $self->param('dbh')->disconnect(); } sub list { my $self = shift; my $q = $self->query(); my $output; my $dbh = $self->param('dbh'); $output .= $q->header(); $output .= $q->start_html(); $output .= "This is the list page.\n"; $output .= $q->end_html; return $output; } sub view { my $self = shift; my $q = $self->query(); my $output; my $dbh = $self->param('dbh'); return $output; } sub edit { my $self = shift; my $q = $self->query(); my $output; my $dbh = $self->param('dbh'); return $output; } sub new { my $self = shift; my $q = $self->query(); my $output; my $dbh = $self->param('dbh'); return $output; } sub del { my $self = shift; my $q = $self->query(); my $output; my $dbh = $self->param('dbh'); return $output; } 1;
#!/usr/bin/perl -w use bluebox; use strict; my $book = bluebox->new(); $book->run();
Can't use string ("bluebox") as a HASH ref while "strict refs" in use +at /usr/lib/perl5/site_perl/5.6.0/CGI/Application.pm line 361.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: CGI::Application Error
by chipmunk (Parson) on Nov 18, 2001 at 10:11 UTC | |
by czarfred (Beadle) on Nov 19, 2001 at 06:51 UTC | |
Re: CGI::Application Error
by rob_au (Abbot) on Nov 18, 2001 at 10:13 UTC | |
Re: CGI::Application Error
by demerphq (Chancellor) on Nov 18, 2001 at 18:37 UTC | |
Re: CGI::Application Error
by data64 (Chaplain) on Nov 18, 2001 at 10:04 UTC | |
by rob_au (Abbot) on Nov 18, 2001 at 10:17 UTC | |
by data64 (Chaplain) on Nov 18, 2001 at 10:21 UTC |