Hi, I rewrite some perl code and I found a problem creating a new object here is my package

#!/usr/bin/perl -w package DB; use strict; use DBI; use SharedVariable qw ($action $dir $dirLang $dirError $imgdir $sessio +n_dir $session_id $can_do_gzip $current_ip $lang $LANG %ARTICLE %SES +SION %SERVER %USER $CGISESSID %LABEL %ERROR %VALUE $COMMANDID %COMMAN +D %DATE %PAYPALL $INDEX %LINK $query $session $host $t0 $client); our $dbh = DBI->connect( "DBI:mysql:recordz:localhost", "root", "passw +ord",{ RaiseError => 1, AutoCommit => 1 } ); sub new { my $class = shift; my ($opts)= @_; my $self = {}; return bless $self, $class; } sub sqlConnect { local our $dbname = shift || ''; local our $dbusername = shift || ''; local our $dbpassword = shift || ''; $dbh = DBI->connect($dbname, $dbusername, $dbpassword); if (!$dbh) { } kill 9, $$ unless $dbh; } sub sqlSelect { local our $select = shift || ''; local our $from = shift || ''; local our $where = shift || ''; local our $other = shift || ''; local our $sql="SELECT $select "; $sql.="FROM $from " if $from; $sql.="WHERE $where " if $where; $sql.="$other" if $other; #$sql = $dbh->quote ($sql); #print "Content-Type: text/html\n\n"; #print "sql : $sql\n"; local our ($c)=$dbh->prepare($sql) or die "Sql has gone to hell\n +"; if(not ($c->execute())) { local our $err=$dbh->errstr; return undef; } local our (@r)=$c->fetchrow(); $c->finish(); return @r; } sub sqlInsert { local our ($table,%data)=@_; local our ($names,$values); $dbh||=sqlConnect(); foreach (keys %data) { if (/^-/) {$values.="\n ".$data{$_}.","; s/^-//;} else { $values.="\n ".$dbh->quote($data{$_}).","; } $names.="$_,"; } chop($names); chop($values); local our $sql="INSERT INTO $table ($names) VALUES($values)\n"; #$sql = $dbh->quote ($sql); #print "Content-Type: text/html\n\n"; #print "$sql <br />"; if(!$dbh->do($sql)) { local our $err=$dbh->errstr; } } sub sqlUpdate { local our ($table, $where, %data)=@_; local our $sql="UPDATE $table SET"; foreach (keys %data) { if (/^-/) { s/^-//; $sql.=" $_ = $data{-$_} " . ","; } else { $sql.=" $_ = ".$dbh->quote($data{$_}).","; } } chop($sql); $sql.=" WHERE $where "; # $sql = $dbh->quote ($sql); # print "Content-Type: text/html\n\n"; # print "$sql"; if(!$dbh->do($sql)) { local our $err=$dbh->errstr; } } sub sqlSelectMany { local our $select = shift || ''; local our $from = shift || ''; local our $where = shift || ''; local our $other = shift || ''; local our $sql="SELECT $select "; $sql.="FROM $from " if $from; $sql.="WHERE $where " if $where; $sql.="$other" if $other; #print "Content-Type: text/html\n\n"; #print "$sql"; #$sql = $dbh->quote ($sql); local our $c=$dbh->prepare($sql); if($c->execute()) { return $c; } else { $c->finish(); local our $err=$dbh->errstr; return undef; kill 9,$$ } } sub sqlDelete { local our $fromtable = shift || ''; local our $condition = shift || ''; local our $sql = ''; if ($condition) { $sql = "DELETE from $fromtable WHERE $condition"; } else { $sql = "DELETE from $fromtable"; } #print "Content-Type: text/html\n\n"; #print "$sql"; #$sql = $dbh->quote ($sql); if (!$dbh->do($sql)) { local our $err=$dbh->errstr; } } BEGIN { use Exporter (); @DB::ISA = qw(Exporter); @DB::EXPORT = qw(); @DB::EXPORT_OK = qw(new sqlConnect sqlSelect sqlInsert sqlUpdate + sqlSelectMany sqlDelete); } 1;

And into another module I'm trying to create a DB object like this way
my $db = DB->new(); but I'm getting the following exception
Can't locate object method "new" via package "DB" at LoadProperties.pm line 8.

In reply to object creation by *alexandre*

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.