title: Can't call method "disconnect" without a package..Perl
body: <p>I wrote a perl module:</p>
  
  <pre><code>package sql;
  use strict;
  use XML::Simple;
  use DBI;
  use DBD::mysql;
  
  require Exporter;
  our @ISA = qw(Exporter);
  our @EXPORT_OK = qw(DBImport DataFill);
  our @EXPORT = qw(DBImport DataFill);
  
  our $dbh;
  
  sub DBConnect() {
      my $platform = "mysql";
      my $database = "databasename";
      my $host = "localhost";
      my $user = "user";
      my $pw = "password";
      my $dsn = "dbi:mysql:$database:localhost";
      $dbh = DBI-&gt;connect($dsn, $user, $pw);
      $dbh-&gt;do('SET NAMES utf8');
      return $dbh;
  }
  
  sub Query($) {
      my $sth = $dbh-&gt;prepare(shift);
      $sth-&gt;execute;
      while (my $ref = $sth-&gt;fetchrow_hashref()) {
          print $ref-&gt;{'email'};
      }
      $sth-&gt;finish();
  }
  
  BEGIN{
      $dbh = &amp;DBConnect();
  }
  
  END{
      $dbh-&gt;disconnect();
  }
  1;
  </code></pre>
  
  <p>and i tried use it:</p>
  
  <pre><code>#!/usr/bin/perl
  use strict;
  use CGI qw/:standard/;
  use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;
  use sql;
  
  &amp;Query("SELECT * FROM users");
  </code></pre>
  
  <p>but it don't working.</p>
  
  <p>error message: Undefined subroutine &amp;main::Query called at /var/www/domains/gabordx.tauri.hu/www/main.pl line 7. -> "&amp;Query("SELECT * FROM users");"</p>
  
  <p>What is the problem with?</p>
  
  <p>Thanks!</p>