http://qs1969.pair.com?node_id=11109318


in reply to invoking module functions from a test script

Can't locate object method "create_query" via package "My::NEW::Module" at ../lib/My/NEW/Module.pm line 46.

My::NEW::Module::get_unpublished('My::NEW::Module', 'My::OLD::Module::Connect=HASH(0x45dcd98)', 10, 250) called at module_test.t line 44

So a function that takes (and has been called with) three parameters is actually (somehow) winding up with four instead.

Sounds like you accidentally wrote My::NEW::Module->get_unpublished(...) when you meant My::NEW::Module::get_unpublished(...)?

Otherwise, try reducing the code down to the bare minimum needed to reproduce the problem, so you can post it here - see Short, Self-Contained, Correct Example.

Replies are listed 'Best First'.
Re^2: invoking module functions from a test script
by chexmix (Hermit) on Nov 27, 2019 at 18:37 UTC

    Well, um. Right you are!

    Thanks and sorry for ... well, for too many words ;)

    G

      if rubber ducks had ears ...

      (bottom line is: in calling an object's method, $object->method(1,2,3), 1st received param is always the object ref, followed by all other params you called that method with, the 1,2,3. That's not the same when calling a class method "statically", e.g. class::method(1,2,3) -- you get 1,2,3 as params, no object ref this time as there is none.)