[dancer-users] Trouble with DBIC in Plugins

Matthew Mallard matt at Q-technologies.com.au
Mon May 4 09:53:52 BST 2015


On 4 May 2015, at 12:46 pm, Naveed Massjouni <naveed at vt.edu> wrote:

> What version of the DBIC plugin are you using? If you are not using the latest, can you upgrade and let me know if you still get the same warning.

Hi Naveed,

I am using 0.0009 which I believe is the latest.  Now that I have put Andy’s work around in I only get the DEPRECATED massage on startup, not each time the global is used:

DEPRECATED: QTechLib::Plugin calls 'dsl' instead of '$dsl->dsl'. at /perf/perl/lib/perl5/Dancer2/Plugin/DBIC.pm line 13.
DEPRECATED: QTechLib::Plugin calls 'dsl' instead of '$dsl->dsl'. at /perf/perl/lib/perl5/Dancer2/Plugin/DBIC.pm line 13.
DEPRECATED: QTechLib::Plugin calls 'dsl' instead of '$dsl->dsl'. at /perf/perl/lib/perl5/Dancer2/Plugin/DBIC.pm line 13.
DEPRECATED: QTechLib::Plugin calls 'dsl' instead of '$dsl->dsl'. at /perf/perl/lib/perl5/Dancer2/Plugin/DBIC.pm line 13.
DEPRECATED: QTechLib::Plugin calls 'dsl' instead of '$dsl->dsl'. at /perf/perl/lib/perl5/Dancer2/Plugin/DBIC.pm line 13.
2015/05/04-18:44:16 Starman::Server (type Net::Server::PreFork) starting! pid(94405)
Resolved [*]:3004 to [0.0.0.0]:3004, IPv4
Binding to TCP port 3004 on host 0.0.0.0 with IPv4
Setting gid to "1000 1000 10 1000"
Starman: Accepting connections at http://*:3004/

(My plugin gets loaded multiple times as it’s referenced in multiple files making up my app.)

And here’s the work around code in my plugin:
my $schema;

on_plugin_import {
    my $dsl = shift;
    # Grab a handle to the Plugin::DBIC schema
    die "No schema method in app. Did you load DBIC::Plugin::DBIC before QTechLib::Plugin?" unless $dsl->can('schema');
    $schema = $dsl->schema;
    $dsl->debug( "**** Got Schema **** ");
};

Let me know if you need more info.  Thanks for the plugin!

Cheers,
Matt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20150504/48aca030/attachment.html>


More information about the dancer-users mailing list