If you've defined your $DBH in common.pm, then to access it you have to
include the namespace:
my $sth = $common::DBH->prepare("..");
And in your common.pm, use our instead of my to share the variable:
our $DBH = DBI->connect ( "DBI:mysql:database=sample;
host=127.0.0.1","root", "password")
- Original Message -
From: "Jaime Teng" <[EMAIL PROTECTED]>
To:
Sent: Friday, March 03, 2006 11:10 AM
Subject: Need help with variables
> Hi,
>
> In my current web project, I group common functions and global variables
> into a separate file;
>
> my
At 11:10 AM 3/3/2006, Jaime Teng wrote:
>Hi,
>
>In my current web project, I group common functions and global variables
>into a separate file;
>
>my problem is, I could not seem to be able to access these variables
Make it $common::DBH; $DBH is living in another namespace than ur main
script so
Hi,
In my current web project, I group common functions and global variables
into a separate file;
my problem is, I could not seem to be able to access these variables
##
common.pm
use strict;
use DBI;
my $HTTP;
my $DBH = DBI->connect ( "DBI:mysql:database=sample; host=127.0.0.1",