Bot-ChatBots

 view release on metacpan or  search on metacpan

lib/Bot/ChatBots/MojoPlugin.pod  view on Meta::CPAN

=head2 B<< app >>

   my $app = $obj->app;
   $self->app($new_app_object);

Accessor for the application object. It is initialized by L</register>.

=head2 B<< helper_name >>

   my $name = $obj->helper_name;

Get the default name for the helper set by L</register>. This name is
built by taking the last part of the package name (e.g. C<Whatever> in
package name C<Bot::ChatBots::Whatever>), lowercasing it and pre-pending
C<chatbots.> (in the example, the result would be C<chatbots.whatever>).
You can override this in your derived class.

This method can also be called as a class method, e.g.:

   my $name = Bot::ChatBots::Whatever->helper_name;

=head2 B<< register >>

   $obj->register($app, $conf);

L<Mojolicious::Plugin> method for registering the plugin.

The registration process adds a helper function based on C<<
$conf->{helper_name} >> (if present) or L</helper_name>. For example, if
the helper name is C<chatbots.whatever>, the helper can be accessed by the
application like this:

   my $obj = app->chatbots->whatever;

This will allow you to call the other methods explained in this documentation.

Argument C<$conf> is a hash reference supporting the following keys:

=over

=item C<helper_name>

to set the helper name, should you not like what L</helper_name> gives
back by default;

=item C<instances>

an array reference containing definitions of instances, each represented
as another array reference that is expanded to the arguments list for
L</add_instance>.

=back

=head2 B<< instances >>

   my $aref = $obj->instances;
   $obj->instances($array_ref);

Accessor for defined instances, stored in an array reference.

=head1 BUGS AND LIMITATIONS

Report bugs either through RT or GitHub (patches welcome).

=head1 SEE ALSO

L<Bot::ChatBots>.

=head1 AUTHOR

Flavio Poletti <polettix@cpan.org>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2016 by Flavio Poletti <polettix@cpan.org>

This module is free software. You can redistribute it and/or modify it
under the terms of the Artistic License 2.0.

This program is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.

=cut



( run in 1.021 second using v1.01-cache-2.11-cpan-39bf76dae61 )