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


in reply to Re^4: Global symbol "$prepare" requires explicit package name
in thread Global symbol "$prepare" requires explicit package name

Placeholders cannot be used for table names or schema names or anything within the schema. They may only be used for data.

  • Comment on Re^5: Global symbol "$prepare" requires explicit package name

Replies are listed 'Best First'.
Re^6: Global symbol "$prepare" requires explicit package name
by tukusejssirs (Beadle) on Sep 19, 2019 at 14:52 UTC

    The problem was that the statement handle was not finished. Solution is to add $sth_test->finish(); before disconnecting the database (src).<\p>

    However, I never used this command before and never encountered this error. Should I use it always before disconnecting the database?

      The documentation for DBI is really good. I do recommend that you read it. In this case the documentation for the finish method goes into some detail about when you should call it and when you should not and the advantages and disadvantages of both.

      Also, what you have encountered on disconnection is not an error. It is a warning. You might think these 2 terms mean the same thing but they do not. See Re: Warnings vs. Errors. Warnings are good because they alert you to situations (such as disconnecting while there are active statement handles) which could be indicative of other problems.