[cgiapp] add_callback problem when using Plugin::JSON
Hi I get this message when trying to use Plugin:JSON. Can anyone advise? Can't locate object method add_callback via package MyPackage at /usr/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/JSON.pm line 232 This is my code: use CGI::Application::Plugin::JSON ':all'; $JSON::Any::UTF8 = 1; return$self-json_body({text = 'test', fail = (my $filefail ? 'fail' : 'ok')}); Thanks Kropotkin -- View this message in context: http://www.nabble.com/add_callback-problem-when-using-Plugin%3A%3AJSON-tp21728780p21728780.html Sent from the cgiapp@lists.erlbaum.net mailing list archive at Nabble.com. # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####
Re: [cgiapp] add_callback problem when using Plugin::JSON
kropotkin wrote: 't locate object method add_callback via package MyPackage at /usr/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/JSON.pm line 232 This is my code: use CGI::Application::Plugin::JSON ':all'; $JSON::Any::UTF8 = 1; return$self-json_body({text = 'test', fail = (my $filefail ? 'fail' : 'ok')}); You need to use a CGI::Application::Plugin::* module within a CGI::Application based object. Otherwise it can't add the appropriate methods or callbacks. -- Michael Peters Plus Three, LP # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####
Re: [cgiapp] add_callback problem when using Plugin::JSON
Hi Michael I am. my Class inherits from CGI::Application. All the other CGI::Application methods work. Your answer feels right but my class really is based on CGI::Application. Any other ideas? Kropotkin Michael Peters wrote: kropotkin wrote: 't locate object method add_callback via package MyPackage at /usr/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/JSON.pm line 232 This is my code: use CGI::Application::Plugin::JSON ':all'; $JSON::Any::UTF8 = 1; return$self-json_body({text = 'test', fail = (my $filefail ? 'fail' : 'ok')}); You need to use a CGI::Application::Plugin::* module within a CGI::Application based object. Otherwise it can't add the appropriate methods or callbacks. -- Michael Peters Plus Three, LP # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## #### -- View this message in context: http://www.nabble.com/add_callback-problem-when-using-Plugin%3A%3AJSON-tp21728780p21729794.html Sent from the cgiapp@lists.erlbaum.net mailing list archive at Nabble.com. # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####
Re: [cgiapp] add_callback problem when using Plugin::JSON
kropotkin wrote: I am. my Class inherits from CGI::Application. All the other CGI::Application methods work. Your answer feels right but my class really is based on CGI::Application. Any other ideas? The show us your real code. Obviously that snippet you showed us isn't real, so we can't really diagnose the problem. My initial thought is that you're loading CAP::JSON before you set your base class to be CGI::Application. -- Michael Peters Plus Three, LP # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####
Re: [cgiapp] add_callback problem when using Plugin::JSON
Hi Michael I didn't show you the real code because I didn't have a clue where the error was and I didn't want to paste the whole file. But your answer was an inspired guess. Thanks very much regards Kropotkin Michael Peters wrote: kropotkin wrote: I am. my Class inherits from CGI::Application. All the other CGI::Application methods work. Your answer feels right but my class really is based on CGI::Application. Any other ideas? The show us your real code. Obviously that snippet you showed us isn't real, so we can't really diagnose the problem. My initial thought is that you're loading CAP::JSON before you set your base class to be CGI::Application. -- Michael Peters Plus Three, LP # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## #### -- View this message in context: http://www.nabble.com/add_callback-problem-when-using-Plugin%3A%3AJSON-tp21728780p21731688.html Sent from the cgiapp@lists.erlbaum.net mailing list archive at Nabble.com. # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####