|
From: A. P. <pag...@gm...> - 2005-09-02 15:37:23
|
* Terrence Brannon <ba...@me...> [2005-09-02 16:20]: > Can you make the PathInfo stuff you are doing available on > sourceforge or elsewhere? Yes, I shall, though it might take me a few days. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/> |
|
From: Terrence B. <ba...@me...> - 2005-09-04 18:19:29
|
"A. Pagaltzis" <pag...@gm...> writes: > * Terrence Brannon <ba...@me...> [2005-09-02 16:20]: >> Can you make the PathInfo stuff you are doing available on >> sourceforge or elsewhere? > > Yes, I shall, though it might take me a few days. I really need this now, even if it's just a tarfile emailed to ba...@me.... Will your module work with plain CGI? I have avoided using REST vocabulary in my URLs for something I'm working on because I don't have your module: <li> <a href="/gb/x.cgi?task=sign_book"> Sign Guestbook </a> </li> <li> <a href="/gb/x.cgi?task=view_book"> View Guestbook </a> </li> <li> <a href="/gb/x.cgi?task=book_stats"> Guestbook Stats </a> </li> I want to be jet-set like you and use paths: <li> <a href="/gb/x/sign"> Sign Guestbook </a> </li> <li> <a href="/gb/x/view"> View Guestbook </a> </li> <li> <a href="/gb/x/stats"> Guestbook Stats </a> </li> So much cleaner > > Regards, > -- > Aristotle Pagaltzis // <http://plasmasturm.org/> What a cute use of icons! -- Carter's Compass: I know I'm on the right track when, by deleting something, I'm adding functionality. |
|
From: A. P. <pag...@gm...> - 2005-09-04 19:41:47
Attachments:
PathInfo.pm
|
* Terrence Brannon <ba...@me...> [2005-09-04 20:25]: > "A. Pagaltzis" <pag...@gm...> writes: > > Yes, I shall, though it might take me a few days. > > I really need this now, even if it's just a tarfile emailed to > ba...@me.... Okay, the .pm is attached. I wanted to write a couple of tests, but haven’t gotten to those (it’ll be a while before I get in the habit of working by writing those first…), so this is offered at your own risk. I’m also unsure about some of the design. So I’d welcome any comments. > Will your module work with plain CGI? Of course – what else? Regards, -- Aristotle “If you can’t laugh at yourself, you don’t take life seriously enough.” |
|
From: A. P. <pag...@gm...> - 2005-09-02 16:08:15
|
* Randal L. Schwartz <me...@st...> [2005-09-02 17:40]: > And especially if you could organize it something along the > line of my proposal, or explain to me what isn't good about > that. No discussion on that after my pitch. :( I just don’t currently see a way to cleanly implement the design I want using that approach, so I’ve fallen back to my usual stance that solving the problem a couple of times over and then extracting abstractions from code is better than designing in the abstract. Of course I haven’t helped that along either, since I haven’t put my code anywhere yet… PS.: merlyn, your mailer is misconfigured. It’s sending UTF-8, but the headers claim it’s UTF-16BE. The end result is that your mail literally looked like a bunch of chinese. I was surprised for a moment… Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/> |
|
From: Ryan T. <li...@ry...> - 2005-09-02 21:41:26
|
On 9/2/05, A. Pagaltzis <pag...@gm...> wrote: > The end result is that your > mail literally looked like a bunch of chinese.=20 I could not read it either, on gmail. RT |
|
From: Terrence B. <ba...@me...> - 2005-09-02 23:38:26
|
"A. Pagaltzis" <pag...@gm...> writes: > PS.: merlyn, your mailer is misconfigured. Itâs sending UTF-8, Aristotle, what sort of control characters are in your mail? I see little boxes and hex characters every so often, making the messages harder to read... I read mail with plain text Xemacs/Gnus under Debian. |
|
From: A. P. <pag...@gm...> - 2005-09-03 00:32:21
|
* Terrence Brannon <ba...@me...> [2005-09-03 01:40]: > "A. Pagaltzis" <pag...@gm...> writes: > > > PS.: merlyn, your mailer is misconfigured. Itâs > > sending UTF-8, > > Aristotle, what sort of control characters are in your mail? There aren’t any control characters. It’s perfectly good plaintext in UTF-8 encoding. > I see little boxes and hex characters every so often, making > the messages harder to read... I read mail with plain text > Xemacs/Gnus under Debian. I read and write mine on the console using mutt and vim. I also know for a fact that Gnus can handle UTF-8. That means your mailer is also misconfigured… Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/> |
|
From: <me...@st...> - 2005-09-03 13:09:06
|
>>>>> "A" =3D=3D A Pagaltzis <pag...@gm...> writes: A> PS.: merlyn, your mailer is misconfigured. It=E2=80=99s sending UTF-8, A> but the headers claim it=E2=80=99s UTF-16BE. The end result is that your A> mail literally looked like a bunch of chinese. I was surprised A> for a moment=E2=80=A6 I've been having trouble for the past 24 hours with my existing emacs session with regard to email. I have rebooted emacs... let's see if this helps. I run "screen emacs", connecting to the same emacs session for up to four or five months at a time. --=20 Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <me...@st...> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl trainin= g! |
|
From: <me...@st...> - 2005-08-07 21:40:22
|
>>>>> "Terrence" == Terrence Brannon <ba...@me...> writes: Terrence> I have added Aristotle (sf.net id: apag) as a developer with Terrence> plenty of liberal admin rights to the whole project - let me Terrence> know if you need more. I couldn't find Randal Schwartz in Terrence> the sf.net user list and someone has the name merlyn Terrence> already. I'm "sourcemerlyn" there. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <me...@st...> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! |
|
From: Terrence B. <ba...@me...> - 2005-08-08 02:39:47
|
me...@st... (Randal L. Schwartz) writes: >>>>>> "Terrence" == Terrence Brannon <ba...@me...> writes: > > Terrence> I have added Aristotle (sf.net id: apag) as a developer with > Terrence> plenty of liberal admin rights to the whole project - let me > Terrence> know if you need more. I couldn't find Randal Schwartz in > Terrence> the sf.net user list and someone has the name merlyn > Terrence> already. > > I'm "sourcemerlyn" there. added: https://sourceforge.net/projects/cgi-prototype/ |
|
From: Terrence B. <ba...@me...> - 2005-09-05 12:52:41
|
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. terry@Abulafia:~/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 => \@qual + ); } =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:bug...@rt...>, 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:pag...@gm...> +contributions from Terrence Brannon and Randal Schwartz. + =head1 COPYRIGHT AND LICENSE Copyright (C) 2005 by Aristotle Pagaltzis terry@Abulafia:~/perl/dl$ |