[Jifty-commit] r2794 - in jifty: trunk/lib trunk/lib/Jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Thu Feb 15 09:51:57 EST 2007
Author: sterling
Date: Thu Feb 15 09:51:56 2007
New Revision: 2794
Modified:
jifty/ (props changed)
jifty/trunk/lib/Jifty.pm
jifty/trunk/lib/Jifty/API.pm
Log:
r2853 at riddle: andrew | 2007-02-15 08:50:26 -0600
Adding more flesh to documentation.
Modified: jifty/trunk/lib/Jifty.pm
==============================================================================
--- jifty/trunk/lib/Jifty.pm (original)
+++ jifty/trunk/lib/Jifty.pm Thu Feb 15 09:51:56 2007
@@ -13,6 +13,37 @@
Jifty - an application framework
+=head1 SYNOPSIS
+
+ # Object containing lots of web related goodies...
+ my $web = Jifty->web;
+ my $request = Jifty->web->request;
+ my $response = Jifty->web->response;
+ my $link = Jifty->web->link( label => _('W00t'), url => '/whatsit' );
+
+ # Retrieve information from your application's etc/config.yml file.
+ my $config = Jifty->config;
+
+ # Retrieve the Jifty::DBI handle
+ my $handle = Jifty->handle;
+
+ # Load an application class, very handy in plugins
+ my $class = Jifty->app_class('Model', 'Foo');
+ my $foo = $class->new;
+ $foo->create( frobnicate => 42 );
+
+ # Configure information related to your application's actions
+ my $api = Jifty->api;
+
+ # Make parts of your page "subscribe" to information in a fragment
+ my $subs = Jifty->subs;
+
+ # Share information via IPC::PubSub in your application
+ my $bus = Jifty->bus;
+
+ # Retrieve general information about Mason
+ my $handler = Jifty->handler;
+
=head1 DESCRIPTION
Yet another web framework.
@@ -184,6 +215,9 @@
An accessor for our L<Jifty::Logger> object for the application.
+You probably aren't interested in this. See L</log> for information on how to
+make log messages.
+
=cut
sub logger {
@@ -196,6 +230,9 @@
An accessor for our L<Jifty::Handler> object.
+This is another method that you usually don't want to mess with too much.
+Most of the interesting web bits are handled by L</web>.
+
=cut
sub handler {
@@ -386,7 +423,7 @@
=head1 SEE ALSO
-L<http://jifty.org>
+L<http://jifty.org>, L<Jifty::Manual::Tutorial>, L<Jifty::Everything>, L<Jifty::Config>, L<Jifty::Handle>, L<Jifty::Logger>, L<Jifty::Handler>, L<Jifty::Web>, L<Jifty::API>, L<Jifty::Subs>, L<IPC::PubSub>, L<Jifty::Plugin>, L<Jifty::ClassLoader>
=head1 AUTHORS
Modified: jifty/trunk/lib/Jifty/API.pm
==============================================================================
--- jifty/trunk/lib/Jifty/API.pm (original)
+++ jifty/trunk/lib/Jifty/API.pm Thu Feb 15 09:51:56 2007
@@ -8,6 +8,42 @@
Jifty::API - Manages and allow reflection on the Jifty::Actions that
make up a Jifty application's API
+=head1 SYNOPSIS
+
+ # A nice way to run actions in your application
+ my $class = Jifty->api->qualify('SomeAction');
+ $class->require;
+ $action = $class->new(
+ moniker => 'my_action',
+ argument => {
+ foo => 1,
+ bar => 'baz',
+ },
+ );
+ $action->run;
+
+ # Logged users with an ID greater than 10 have restrictions
+ if (Jifty->web->current_user->id > 10) {
+ Jifty->api->deny('Foo');
+ Jifty->api->allow('FooBar');
+ Jifty->api->deny('FooBarDeleteTheWorld');
+ }
+
+ # Fetch the class names of all the allowed actions
+ my @actions = Jifty->api->actions;
+
+ # Check to see if an action is allowed
+ if (Jifty->api->is_allow('TrueFooBar')) {
+ # do something...
+ }
+
+ # Undo all allow/deny/restrict calls
+ Jifty->api->reset;
+
+=head1 DESCRIPTION
+
+You can fetch an instance of this class by calling L<Jifty/api> in your application. This object can be used to examine the actions available within your application and manage access to those actions.
+
=cut
@@ -20,7 +56,9 @@
=head2 new
-Creates a new C<Jifty::API> object
+Creates a new C<Jifty::API> object.
+
+Don't use this, see L<Jifty/api> to access a reference to C<Jifty::API> in your application.
=cut
@@ -47,8 +85,8 @@
Returns the fully qualified package name for the given provided
action. If the C<ACTIONNAME> starts with C<Jifty::> or
-C<ApplicationClass>::Action, simply returns the given name; otherwise,
-it prefixes it with the C<ApplicationClass>::Action.
+C<ApplicationClass::Action>, simply returns the given name; otherwise,
+it prefixes it with the C<ApplicationClass::Action>.
=cut
@@ -222,4 +260,15 @@
return sort grep { $self->is_allowed($_) } $self->_actions;
}
+=head1 SEE ALSO
+
+L<Jifty>, L<Jifty::Web>, L<Jifty::Action>
+
+=head1 LICENSE
+
+Jifty is Copyright 2005-2006 Best Practical Solutions, LLC.
+Jifty is distributed under the same terms as Perl itself.
+
+=cut
+
1;
More information about the Jifty-commit
mailing list