Hi All
I'm back using CGI::Application after what must be a year or more away doing
other stuff so feel free to flame me (gently!) if this is an obvious mistake
but ...
I'm writing a small CGI::Application based project. I have my runmodes
defined thus:
sub setup
{
my $self = shift;
$self->run_modes({
menu => "menu", # Initial menu page
error => "print_error", # Error handler
hostinfo => "host_info", # Host information page
imgindex => "img_index", # Images index
});
$self->start_mode('menu');
$self->param('dbh' => DBI->connect('dbi:mysql:platform', 'webadm',
'web123', {PrintError => 0})); # Store a db handle for later
}
The problem I have is in the img_index sub. I've cut it back to the following
:
sub img_index
# Show index of images for a particular hostid
{
my $self = shift;
my $query = $self->query();
my $hostid = $query->param('host');
my $ouptut = '';
my $dbh = $self->param('dbh');
my $hostname = $dbh->selectrow_array("SELECT hostname FROM hosts WHERE
hostid=?", undef, $hostid);
}
It seems that anytime I do a $dbh->prepare (which is explicitly called inside
the DBI selectrow_array method) I get the output of the prepare in the
browser and nothing else.
If I access the above via
http://myhost/cgi-perl/AEPWeb.pl?rm=imgindex&host=00004 I get the word
'aurora' in the browser. Now while this is the right answer since I'm not
actually asking it to output I'm a little confused as to how it gets there.
If I write something like $dbh->prepare("SELECT updated, updatedby FROM
images WHERE hostid=?"); I get something along the lines of
DBI::st=HASH(xxxxxx) in the browser.
Does anyone have any idea why this is happening ?
Many thanks!
Paul Barker
********************************************************************
Important.
Confidentiality: This communication is intended for the above-named
person and may be confidential and/or legally privileged.
Any opinions expressed in this communication are not necessarily
those of the company. If it has come to you in error you must
take no action based on it, nor must you copy or show it to anyone;
please delete/destroy and inform the sender immediately.
Monitoring/Viruses.
Orange may monitor all incoming and outgoing emails in line with
current legislation. Although we have taken steps to ensure that
this email and attachments are free from any virus, we advise that
in keeping with good computing practice the recipient should ensure
they are actually virus free.
Orange PCS Limited is a subsidiary of Orange SA and is registered
in England No 2178917, with its address at St James Court,
Great Park Road, Almondsbury Park, Bradley Stoke, Bristol BS32 4QJ.
********************************************************************
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.