millan123 has asked for the wisdom of the Perl Monks concerning the following question:

In a perl script i can see some methods like ODBC_Connect, ODBC_Disconnect, ODBC_Execute, ODBC_Fetch. Can someone please tell me which module is being used here I mean what is the module name which contains the above methods.
$DSN = "DSN=" . $db . ";UID=" . $ui . ";PWD=" . $pwd; ($n, $err, $errtext) = ::ODBC_Connect($DSN); @{$self->{'fnames'}} = ::ODBC_Execute($self->{'connection'},$sql); @r = ::ODBC_Fetch($self->{'connection'}); if ($ENV{OS} eq 'Windows_NT') { ::ODBC_Disconnect($self->{'connection'}); }

Replies are listed 'Best First'.
Re: ODBC related perl module
by marto (Cardinal) on Aug 13, 2014 at 11:12 UTC
      I dont understand why it is written ::ODBC_Connect , it should be modulename::ODBC_Connect. In that script nowhere ODBC_Connect method is defined.so obviously it from a module then why only ::ODBC_Connect is used instead of modulename::ODBC_Connect .
        ::ODBC_Connect($DSN) will call the subroutine ODBC_Connect in the empty (main) namespace.

        If no such subroutine exists there, maybe one of the other modules exports such a subroutine?

Re: ODBC related perl module
by ww (Archbishop) on Aug 13, 2014 at 11:37 UTC

    Don't you have access to the main package? The module is listed there:
    From the first (narrative) paragraph of PerlMod:

    If the package name is null, the main package is assumed. That is, $::sail is equivalent to $main::sail .

    check Ln42!

      In this codebase only one module has been called that is Oraperl.pm. this module is being used for Unix OS .For example for db connectivity from unix,the code is
      $n = &ora_login($db, $ui, $pwd);
      for db connectivity from windows NT,the code is
      ($n, $err, $errtext) = ::ODBC_Connect($DSN);
      From this code, i understood ora_login is from Oraperl.pm but cannot understand where ODBC_Connect is coming from.
Re: ODBC related perl module
by digglife (Acolyte) on Aug 13, 2014 at 15:37 UTC
    These methods should be user-written subs, not built-in modules or modules from CPAN. According to your code, they should be wrap-ups that using DBI and DBD::ODBC.
Re: ODBC related perl module
by bulrush (Scribe) on Aug 14, 2014 at 18:11 UTC
    Can't you grep through your source file and look for where ODBC is used in a use statement?

    grep -nP 'use.+ODBC' file.pl

    Or just show all use statements:

    grep -in '^use ' dailysumm.pl
    Perl 5.8.8 on Redhat Linux RHEL 5.5.56 (64-bit)