http://www.perlmonks.org?node_id=584865

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

Can't locate object method "new" via package "Class::DBI::SQL::Transformer" at C lass/DBI.pm line 153.

I get this message when I execute my program (myprogram.exe) after I package it with tkpp. I can run the pl file fine from the command line. It's only when I pp it and then try to execute the exe.

I tried to make sure that Class DBI SQL Transformer.pm is installed and it is. Can anyone suggest what I can do to put this package where it needs to be?

I do not know what part of my code is causing this error therefore I can't post anything. It's only when i use the exe file.

  • Comment on Can't locate object method "new" via package "Class::DBI::SQL::Transformer" at C

Replies are listed 'Best First'.
Re: Can't locate object method "new" via package "Class::DBI::SQL::Transformer" at C
by rinceWind (Monsignor) on Nov 18, 2006 at 18:01 UTC

    The mechanism PAR uses to pick up all the modules your program needs (Module::ScanDeps), is not perfect. This is especially so with .pm modules that are indirectly required by Class::DBI - I've been bitten by this one.

    If you unzip -l the exe, you can see what's inside it (on Windows, you can browse the contents with winzip and suchlike).

    If your Transformer.pm is missing, you can explicitly add it by using the Modules textarea in tkpp. Or, you can fix the problem in code by putting an explicit use Class::DBI::SQL::Transformer, and any other modules that are missing, into your .pl script.

    --

    Oh Lord, won’t you burn me a Knoppix CD ?
    My friends all rate Windows, I must disagree.
    Your powers of persuasion will set them all free,
    So oh Lord, won’t you burn me a Knoppix CD ?
    (Missquoting Janis Joplin)

      Thanks for your reply. I included the Class::DBI::SQL::Transformer in my script but then I got the following warnings. Did these warnings ever appear for you?

      Subroutine new redefined at C:/Perl/site/lib/Class/DBI/SQL/Transformer.pm line 3 2.
      Subroutine sql redefined at C:/Perl/site/lib/Class/DBI/SQL/Transformer.pm line 5 5.
      Subroutine args redefined at C:/Perl/site/lib/Class/DBI/SQL/Transformer.pm line 61.
      Subroutine _expand_table redefined at C:/Perl/site/lib/Class/DBI/SQL/Transformer .pm line 67.
      Subroutine _expand_join redefined at C:/Perl/site/lib/Class/DBI/SQL/Transformer. pm line 77.
      Subroutine _do_transformation redefined at C:/Perl/site/lib/Class/DBI/SQL/Transf ormer.pm line 108.

        Looks like the Transformer.pm module code is being pulled in twice. Are you using "use" or "require"? "use" has an internal mechanism which stops this duplicate loading from happening.

        If you post the code, I should be able to tell what is wrong.

        --

        Oh Lord, won’t you burn me a Knoppix CD ?
        My friends all rate Windows, I must disagree.
        Your powers of persuasion will set them all free,
        So oh Lord, won’t you burn me a Knoppix CD ?
        (Missquoting Janis Joplin)