Here is my unified diff of the attachment you emailed earlier. I like
this module a lot and will be retooling my simple guestbook app to use
it. This is our first step towards a CGI::Prototype on Rails type
thing. Maybe we could publish a Perl Review article if everything is
clean and easy to follow. 

I am going to play with DBIx::SQLEngine for the database part of this
based on a recent discussion between Simon and Sebastien about their
interests in it.

[EMAIL PROTECTED]:~/perl/dl$ diff -u PathInfo.pm.orig PathInfo.pm
--- PathInfo.pm.orig    2005-09-05 11:34:56.000000000 +0000
+++ PathInfo.pm 2005-09-05 12:46:14.000000000 +0000
@@ -57,38 +57,73 @@
 
 =head2 ENVIRONMENT INFORMATION SLOTS
 
+These slots provide access to information about the request loosely modelled
+on the REST architectural elements described in sectoin 5.2 of Fielding's
+seminal Ph.D disseration on the subject:
+
+http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_2
+
 =over 4
 
-=item resource_type
+=item resource_name
+
+The resource name is, to quote Fielding, "the intended conceptual target of 
+a hypertext reference." This would imply that such a target is a noun but in
+practical terms it may not be. In practical terms, the C<resource_name> is the
+first thing after the domain name and the cgi-script in the URL. Examples:
+
+http://metaperl.org/guestbook/sign has domain metaperl.org, cgi-script
+C<guestbook> and C<resource_name> sign
+Here we are providing a resource to sign the guestbook.
 
-FIXME
+=item resource_qualifiers
 
-=item resource_id
+path elements after the the resource name. Example:
 
-FIXME
+http://www.livingcosmos.org/meditation/ernest-wood/notes/
+
+would bind @resource_qualifiers to qw(ernest-wood notes)
+and of course resource_name would be 'meditation'
+
+This was initially a scalar named C<resource_id> but it is clear that many
+websites use more than one element after the resource_name, Drupal for 
+instance:
+http://sequence.complete.org/node/add/blog
 
 =back
 
+It is important to note that some resources just use paths to logically
+categorize all of its information. Taking the livingcosmos.org URL above, 
+meditation is not a "service" or "resource" as much as it is just an area on a 
+website. However, having access the path info is useful for dynamically 
+rendering the look-and-feel of a website without resorting to things like
+HTML::Mason and its autohandler.
+
 =cut
 
 sub prototype_enter {
-       my $self = shift;
+  my $self = shift;
 
-       $self->SUPER::prototype_enter();
+  $self->SUPER::prototype_enter();
 
-       my ( $resource, $id ) = $self->parse_path( $self->CGI->path_info() );
-       $self->reflect->addSlot( resource_type => $resource, resource_id => $id 
);
+  my ( $resource, @qual ) = $self->parse_path( $self->CGI->path_info() );
+  $self->reflect->addSlot( 
+    resource_name => $resource, 
+    resource_qual => [EMAIL PROTECTED] 
+   );
 }
 
 =head2 MANAGEMENT SLOTS
 
-This is where the real changes over L<CGI::Prototype::Hidden> lie.
+This is where CGI::Prototype::PathInfo is quite different from 
+L<CGI::Prototype::Hidden>
 
 =over 4
 
-=item name_to_page
+=item resource_name_to_page
 
-Called with a page name, translates it to a package name, and returns a page
+Called with a resource name, translates it to a package name, and 
+returns a page
 object. Will also autoload the package.
 
 This module expects page names to look like relative URLs and will translate to
@@ -98,22 +133,23 @@
 =cut
 
 sub name_to_page {
-       my $self = shift;
-       my ( $name ) = @_;
+  my $self = shift;
+  my ( $name ) = @_;
 
-       my $pkg = join '::', (
-               $self->config_class_prefix,
-               split( m{/}, $self->validate_name( $name ) ),
-       );
+  my $pkg = join '::', (
+    $self->config_class_prefix,
+    split( m{/}, $self->validate_name( $name ) ),
+   );
+
+  if ( do { no strict 'refs'; not defined ${ $pkg . '::' } } ) {
+    eval "require $pkg";
+    die $@ if $@;
+  }
 
-       if( do { no strict 'refs'; not defined ${ $pkg . '::' } } ) {
-               eval "require $pkg";
-               die $@ if $@;
-       }
-
-       return $pkg->reflect->object;
+  return $pkg->reflect->object;
 }
 
+
 =item dispatch
 
 Overridden from L<CGI::Prototype::Hidden>. Selects either the page named
@@ -127,7 +163,7 @@
 
        my $prefixes = join '|', map quotemeta, $self->config_valid_pages;
 
-       return $self->name_to_page( $self->resource_type || 
$self->config_default_page );
+       return $self->name_to_page( $self->resource_name || 
$self->config_default_page );
 }
 
 =item render_enter
@@ -186,17 +222,38 @@
 
 L<CGI::Prototype::Hidden>, L<CGI::Prototype>, L<Template::Manual>
 
+=over 4
+
+=item Paul Prescod's REST resources
+
+L<http://www.prescod.net/rest/>
+
+=item the REST wiki
+
+L<http://rest.blueoxen.net/cgi-bin/wiki.pl?FrontPage>
+
+=item The REST discussion email list
+
+L<http://groups.yahoo.com/group/rest-discuss/>
+
+
+=back
+
+
+
 =head1 BUG REPORTS
 
-Please report any bugs or feature requests to
-L<mailto:[EMAIL PROTECTED]>, or through the web interface
-at L<http://rt.cpan.org/>. I will be notified, and then you'll automatically
-be notified of progress on your bug as I make changes.
+Please report any bugs or feature requests to the CGI::Prototype users mailing
+list on Sourceforge (L<http://cgi-prototype.sf.net)
+so that all 3 authors of the package (sourcemerlyn, apag, metaperl) can 
+be notified.
 
 =head1 AUTHOR
 
 Aristote Pagaltzis, L<mailto:[EMAIL PROTECTED]>
 
+contributions from Terrence Brannon and Randal Schwartz.
+
 =head1 COPYRIGHT AND LICENSE
 
 Copyright (C) 2005 by Aristotle Pagaltzis
[EMAIL PROTECTED]:~/perl/dl$ 



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
cgi-prototype-users mailing list
cgi-prototype-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cgi-prototype-users

Reply via email to