Subject: | bug when calling a procedure from within an anonymous sub |
Date: | Wed, 16 Feb 2011 11:54:42 +0100 |
To: | bug-DBIx-ProcedureCall [...] rt.cpan.org |
From: | "Ronald of Steiermark" <austria_rules [...] yepmail.net> |
Module Version: 0.10
Perl Version: 5.8.8 (ActiveState)
Platform: Windows 2000, Oracle
Assume that we have a stored procedure (*not* function) PACK.pr_myProc,
which I include in my Perl program with
use DBIx::ProcedureCall qw(PACK.pr_myProc);
When I invoke this procedure, and
- the invokation is the last statement in a Perl-block, and
- the block is contained in an anonymous Perl subroutine,
then Oracle complains
PLS-00222: no function with name 'PR_MYPROC' exists in this scope
Note that Oracle complains about a missing FUNCTION. Of course pr_myProc
is a procedure, and no function of this name exists. It seems that
ProcedureCall somehow believes that this procedure needs to be called as
a function, and passes this information to Oracle.
Example:
sub call_it(&) { $_[0]->() }
my $dbh=......; # get database handle
call_it { PACK_pr_myProc($dbh) } # This causes the error
END { PACK_pr_myProc($dbh) } # This too
Workaround: Ensure that the call is not the last statement in a block.
Example:
call_it { PACK_pr_myProc($dbh); undef } # This works
END { PACK_pr_myProc($dbh); undef } # This too
--
Ronald Fischer <austria_rules@yepmail.net>
There are 10 types of people in the world: those who understand binary and those who don't.