Dancer2::Plugin::AppRole::Helper - helper functions for creating Dancer2 AppRole plugins


version 1.152121


In your plugin:

    package Dancer2::Plugin::Mine;

    use Dancer2::Plugin;
    use Dancer2::Plugin::AppRole::Helper;

    # short version
    on_plugin_import { ensure_approle_s "Mine", @_ };

    # OR long and/or customized version
    on_plugin_import { ensure_approle "Dancer2::Plugin::AppRole::Mine", @_ };

    # ...

In your Dancer module:

    package MyDancerApp;

    use Dancer2;

    use Dancer2::Plugin::Mine; # loads and applies the role to the app object
    use Dancer2::Plugin::Mine; # does *not* do it again

    use MyDancerSubModule;

In a submodule:

    package MyDancerSubModule;

    use Dancer2 appname => 'MyDancerApp';

    use Dancer2::Plugin::Mine; # does *not* do it again either, but would if
                               # the submodule is loaded on its own



Apply the given role to the app in the given Dancer2 DSL object, but don't apply it twice.


Same as ensure_approle, but Dancer2::Plugin::AppRole:: is prepended on the role name for shorter calling.


Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker at You will be notified automatically of any progress on your issue.

Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

  git clone


Christian Walde <>


Christian Walde has dedicated the work to the Commons by waiving all of his or her rights to the work worldwide under copyright law and all related or neighboring legal rights he or she had in the work, to the extent allowable by law.

Works under CC0 do not require attribution. When citing the work, you should not imply endorsement by the author.