AUTOLOADed methods in use'd Perl module not found
Hi All, Long time Perl coder but new to Modern Perl and Dancer. I am using Dancer to provide a RESTful API to an existing Perl module. The problem I have is that none of the AUTOLOADed methods appear to work when I use the module in Dancer. If I use the module in a CLI script the AUTOLOADed methods work. Any ideas why the AUTOLOADed methods are not found? The error message I get back is: Warning caught during route execution: funtion name not found for get_chassis_inventory at /Users/dgethings/git/Sloe/lib/Sloe.pm line 51 I've done some googling and have had no success in finding anyone with a similar problem. Nor can I find away to access the Perl debugger when using Dancer to see what my available object methods are. Any help in any area is greatly appreciated. -- Cheers Dg
On Thu, 05 Jul 2012 16:19:52 +0000 (GMT) David Gethings <dgethings@me.com> wrote:
Hi All,
Long time Perl coder but new to Modern Perl and Dancer.
Welcome! Are you the David Gethings I think you almost certainly are? If so, small world - howdy :)
I am using Dancer to provide a RESTful API to an existing Perl module. The problem I have is that none of the AUTOLOADed methods appear to work when I use the module in Dancer. If I use the module in a CLI script the AUTOLOADed methods work. Any ideas why the AUTOLOADed methods are not found?
I'm not sure OTTOMH; however I just tried a brief test case and confirmed that AUTOLOAD gets called in a basic Dancer app: #!/usr/bin/perl use strict; use Dancer; sub AUTOLOAD { print "AUTOLOAD got called\n"; } get '/' => sub { bar(); "bar() called"; }; dance(); Running the above, I see "AUTOLOAD got called" in the output. That's probably over-simplifying things a little, but does prove that (at least for me) Dancer doesn't clobber an AUTOLOAD.
I've done some googling and have had no success in finding anyone with a similar problem. Nor can I find away to access the Perl debugger when using Dancer to see what my available object methods are.
You should be able to set a breakpoint within a route handler or wherever you want to? -- David Precious ("bigpresh") <davidp@preshweb.co.uk> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github
On 5 Jul 2012, at 17:42, David Precious wrote:
Welcome!
Are you the David Gethings I think you almost certainly are? If so, small world - howdy :)
Hi David, Yes I am *that* David Gethings. It is indeed a small world. ;)
I'm not sure OTTOMH; however I just tried a brief test case and confirmed that AUTOLOAD gets called in a basic Dancer app:
Thanks for the tip about setting breakpoints. Never really needed to use them before but I was able to find what I needed. In the debugger I see the AUTOLOAD method is installed. I have no idea why AUTOLOAD is not working. I'm starting to come to conclusion that this suite of modules are not going to play well with Dancer. :( Thanks very much for the help. I'm sure I will be back. ;) -- Cheers Dg
participants (2)
-
David Gethings -
David Precious