Commits

Fabrice Gabolde committed f27f5a0

Component documentation.

Still missing Controller documentation for coverage to be complete.

  • Participants
  • Parent commits c6a0e60

Comments (0)

Files changed (1)

File lib/Floop/Component.pm

     }
 
 }
+
+__END__
+=pod
+
+=head1 NAME
+
+Floop::Component -- Building block for Floop apps
+
+=head1 SYNOPSIS
+
+  use Floop::Component;
+  my $app = Floop->new(...);
+  $app->add_route(...);
+  
+  # build it just like a top level app
+  my $component = Floop::Component->new;
+  $component->add_route(...);
+  
+  $app->floop('/mountpoint' => $component);
+
+=head1 DESCRIPTION
+
+Components are lightweight, reusable apps.  They share a lot of
+functionality with the L<Floop> class: they have their own dispatcher
+to handle requests, they can declare routes, and they can use plugins
+installed by the top-level app.
+
+=head2 FLOOPING A COMPONENT
+
+Flooping a component activates its special ability.
+
+A flooped component does not install its routes into the parent app
+(or component; components can floop other components).  The parent
+dispatcher instead stores a reference to the flooped component's own
+dispatcher.  If it is ever handed a request that its local routes do
+not match, it will call the flooped dispatchers, thus performing a
+BFS.
+
+The flooper chooses where the floopee's routes will be installed by
+specifying a fixed namespace, so e.g. all the authentication routes
+could be flooped under "/auth", or they could be mounted directly on
+the root if "/" was provided (they will still be called only through
+the floopee's dispatcher).
+
+While non-app components can technically survive even harsh
+environments without having a parent (or grand-parent) app, they are
+mostly useless and the methods provided by this class will not be
+useful.
+
+=head1 ATTRIBUTES
+
+See also the attributes installed by the L<Floop::Controller> role.
+
+=head2 app
+
+(read-only object)
+
+This is the parent app (or component, if the current component has
+been flooped into a component).
+
+=head1 METHODS
+
+See also the methods installed by the L<Floop::Controller> role, and
+the methods in L<Floop> that are being delegated to.
+
+=head2 configuration
+
+Delegates to the flooper's C<configuration> method.
+
+=head2 get_default_view
+
+Delegates to the flooper's C<get_default_view> method.
+
+=head2 logger
+
+Delegates to the flooper's C<logger> method.
+
+=head2 registered_plugins
+
+Delegates to the flooper's C<registered_plugins> method.
+
+=head2 static_files_directory
+
+Delegates to the flooper's C<static_files_directory> method.
+
+=head2 check_plugin_available
+
+  say $self->check_plugin_available('Floop::Plugin::Session') ? "yay" : "nuh";
+
+Returns true if the parent (grand-parent, ...) app has installed a
+plugin of the corresponding class, false otherwise.
+
+=head1 SEE ALSO
+
+TODO links to other pods and documentation
+
+=head1 AUTHOR
+
+Fabrice Gabolde <fabrice.gabolde@gmail.com>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2014 Fabrice Gabolde
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.10.0 or,
+at your option, any later version of Perl 5 you may have available.
+
+=cut