App::Rad::Plugin(3pm)

πŸ“¦
version 1.05 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

🌸 App::Rad::Plugin β€” the manual page, bestie edition πŸ’–

okay so this is App::Rad::Plugin, straight out of the User Contributed Perl Documentation ✨ it's the glow-up guide for extending the App::Rad framework β€” think of it as the "how to build ur own plugin" bible πŸŽ€


✨ NAME ✨

App::Rad::Plugin β€” Extend the App::Rad framework! πŸ’… no cap, that's the whole point.


πŸ¦‹ SYNOPSIS πŸ¦‹

This doc is for developers who wanna write their own App::Rad plugins. That's it, that's the assignment 🫢 if u just want to use some existing plugin, go read that plugin's actual documentation instead, bestie. iykyk.


πŸ’€ WARNING! πŸ’€

The plugin API is very new, and ngl there might be some changes in the future 😭 so pls don't come for me.

If u feel like something could be done to make plugin creation even better β€” like fr fr better β€” drop me an email or an RT wishlist. Thanks bb πŸ™ˆπŸ’–


🌈 PLUGIN CREATION BASICS 🌈

Creating App::Rad plugins is very easy. Periodt.

Just start with this:

package App::Rad::Plugin::MyPlugin;

then write ur subs as if they were methods of App::Rad's $c variable πŸŽ€ like:

sub newmethod {
    my $c = shift;

    # ...
}

So when a user invokes ur plugin, she can call ur new methods at literally any point in her program πŸ‘‘

use App::Rad  qw(MyPlugin);
App::Rad->run();

sub default {
    my $c = shift;

    $c->newmethod();    # this works!
}

and you can also extend App::Rad's functionality by overriding methods, like getopt or config πŸ’… that's the main character move.


🧚 CREATING INTERNAL (HELPER) SUBS 🧚

App::Rad will only import methods not starting with an underscore. so subs named _whatever are ur lil private helpers, lowkey invisible to the outside world 🫢

package App::Rad::Plugin::YetAnother;

sub something {
    my $c = shift;

    _internal( $c->stash->{somevalue} );
}

sub _internal {
    my $value = shift;
    #...
}

So u can safely create several internal subs for ur plugin 🌸 no drama.

use App::Rad  qw(YetAnother);

sub default {
    my $c = shift;

    $c->something()    # this works!

    $c->_internal()    # this won't...
}
heads up bestie: see that last one? $c->_internal() does NOT work. underscore subs stay private. that's the vibe check and it passed πŸ’…

πŸ‘‘ RESERVED SUB NAMES πŸ‘‘

Currently there are no reserved names for ur plugin subs. iconic. free real estate πŸŽ€

But β€” plot twist β€” they might be added in the future, to be called at some predefined times in the App::Rad command workflow 😭 so like, stay tuned. Let me know if u feel this would improve ur plugin's usability. Thanks! πŸ’–


πŸ“ SUPPORT πŸ“

You can find documentation for this module with the perldoc command πŸ‘‡

perldoc App::Rad::Plugin

that's it, that's the support ✨


⭐ AUTHOR ⭐

Breno G. de Oliveira, <garu at cpan.org> 🫢 the legend herself.


πŸ’œ ACKNOWLEDGEMENTS πŸ’œ

Lots of thanks to Fernando Correa (FCO) for his help with this module πŸŽ€ bestie behavior fr fr.


Copyright 2009 Breno G. de Oliveira <garu at cpan.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.


πŸ’€ DISCLAIMER OF WARRANTY πŸ’€

okay this part is in ALL CAPS for a reason, bestie, pls actually read it 😭

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.


and that's the whole page, bestie πŸ’… this beauty shipped with perl v5.36.0 and landed on 2022-10-13 β€” go forth and write plugins, u got this πŸ¦‹βœ¨πŸ’–

πŸ“¦ where this page comes from