in reply to Identify the package a subroutine is being called from

The code snippet you posted does not execute for me.

Undefined subroutine &Calling::package_name called

It runs if I change Blah::package_name() to Blah->package_name(). The former will look for package_name only in the package you specify. The latter will look for it in the inheritance tree in the way you're talking about.

That being the case, moritz is correct. The package name you're looking for is the first thing in @_. If it's not there, then maybe you want __PACKAGE__.

If there's something I'm missing, please post some working code that shows the problem.

Replies are listed 'Best First'.
Re^2: Identify the package a subroutine is being called from
by Herkum (Parson) on Jun 06, 2008 at 17:55 UTC

    No, you are correct, I made a bad assumption evidently. You HAVE to call the subroutine with a package name( or blessed reference) or it will blow up(at least when you are using inheritance).

    It was not the answer I expected, but it is an answer.