Grokbase
Topics Posts Groups | in
x
[ help ]

Thomas Klausner (d...@cpan.org)

Profile | Posts (18)

User Information

Display Name:Thomas Klausner
Partial Email Address:d...@cpan.org
Posts:
18 total
12 in Catalyst Framework
6 in DBIx::Class
1 in Perl 5 Porters

5 Most Recent

All Posts
1) Thomas Klausner [Catalyst] How much chain?
| +1 vote
... do I need to hang myself? I'm (finally) playing around with chained, and like it very much. But...
catalyst@lists.scsys.co.uk
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
... do I need to hang myself?

I'm (finally) playing around with chained, and like it very much.
But now I have some sort of design question, on which I'd like to
collect some feedback:

Say, you want to edit things. The general way of editing is the same for
most things, only the thingies you want to edit differ (i.e. their
fields).

(slightly OT, but some background: We want to use HTML::FormFu
for actual form generation, but do not want to use the config-file
aproach, but something like a 'registry' where each field and it's
definition is stored (basically we have several different things using
similar fields...))


What to you think is better:

A) lots of chain

package Thing:
use base 'Generic';
sub base : Chained('/') PathPart('thing') CaptureArgs(0) {}
sub setup_fields : Chained('item') CaptureArgs(0) {
    # define a list of fields and store them in stash
}

package Generic;
sub item : Chained('base') PathPart('') CaptureArgs(1) {
    # load thing and store in stash
}
sub show_form : Chained('setup_fields') Args(0) {
    # take field list, make form, etc 
}

I'd end up with an URL like
  /thing/123/setup_fields/show_form


B) Plain Old Methods

package Thing:
use base 'Generic';
sub base : Chained('/') PathPart('thing') CaptureArgs(0) {}
sub edit : Chained('item') Args(0) {
    my ($self, $c) = @_;
    $self->setup_fields($c, ... );
    $self->make_form;
    # 
}

package Generic;
sub item : Chained('base') PathPart('') CaptureArgs(1) {
    # load thing and store in stash
}
sub setup_fields {}
sub make_form {}
sub handle_form {}

I'd end up with an URL like
  /thing/123/edit
which IMO looks nicer.


So, is A) just overdoing chained? B) looks ok, but is it using chained
to it's full potential?

I'd really like to hear some of your thoughts...

--
#!/usr/bin/perl http://domm.plix.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}
2) Thomas Klausner [Catalyst] Anybody who fancies some LWP poking ...
| +1 vote
Hi! Hm, actually I only notified Leon about the patches. I will also submit the patches directly to...
catalyst@lists.scsys.co.uk
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Hi!

On Thu, May 15, 2008 at 10:20:23AM -0400, John Goulah wrote:

> Since these fix tests, will these modules get patched and released
> with this applied?

Hm, actually I only notified Leon about the patches. I will also submit
the patches directly to Andy (for WWW::Mechanize)

--
#!/usr/bin/perl http://domm.plix.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}
3) Thomas Klausner [Catalyst] Anybody who fancies some LWP poking ...
paperclip | +1 vote
Hi! Today we where hit by this, and I dug into the code... The problems seems to lie in...
catalyst@lists.scsys.co.uk
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Hi!

On Sun, May 11, 2008 at 07:10:27PM +0100, Leon Brocard wrote:
> 2008/5/10 Daniel McBrearty <danielmcbrearty@gmail.com>:
>
> > I'd like Leon's opinion on this. Forwarding to him again.
>
> I understand many bits of it but have given up trying to get it
> working. I would love a patch which passes tests on both old and new
> lib-www-perls.

Today we where hit by this, and I dug into the code...

The problems seems to lie in WWW::Mechanize and
Test::WWW::Mechanize::Catalyst.

I was able to (sort of) fix it with the attached two patches.

T:W:M:C tests work after those patches (as do our tests...), but
WWW::Mechanize spews some "Parsing of undecoded UTF-8 will give garbage
when decoding entitie" warnings. And I'm not in the mood for utf8
debugging ...

I have to say that I did not analyse the whole problem, and in fact we
just downgrade to libwww-perl-5.808. But if these findings help someone
with deeper knowledge to really solve the problem, I'd be delighted!

--
#!/usr/bin/perl http://domm.plix.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}

Attachment: WWW-Mechanize-1.34.patch

Attachment: Test-WWW-Mechanize-Catalyst-0.42.patch
4) Thomas Klausner [Catalyst] uri_for problem
| +1 vote
Hi! The docs say: $c->uri_for( $path, @args?, \%query_values? ) translated to TT that should read...
catalyst@lists.scsys.co.uk
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Hi!

On Wed, Mar 05, 2008 at 10:50:07AM +0100, Emmanuel Quevillon wrote:

> I am trying to build some url from TT using uri_for sub but I encounter
> some problem with it.
>
> When in my tt I have :
> [%- ourl = Catalyst.uri_for('/search?stype=seqid&query=') -%]
>
> when I click on it, I get an url that looks like :
> search%5C%3Fstype=seqid&query=
>
> Is there a way to get the proper url produce in the HTML page without
> '%5C%3F' ?

The docs say:
  $c->uri_for( $path, @args?, \%query_values? )

translated to TT that should read
  [%  Catalyst.uri_for('search', { stype=>'seqid' } ) %]
(I think, but I constantly mix up how to defines hashes in TT)


--
#!/usr/bin/perl http://domm.plix.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}
5) Thomas Klausner Re: [Catalyst] uri_for problem
| +1 vote
Hi! The docs say: $c->uri_for( $path, @args?, \%query_values? ) translated to TT that should read...
catalyst@lists.scsys.co.uk
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Hi!

On Wed, Mar 05, 2008 at 10:50:07AM +0100, Emmanuel Quevillon wrote:

> I am trying to build some url from TT using uri_for sub but I encounter
> some problem with it.
>
> When in my tt I have :
> [%- ourl = Catalyst.uri_for('/search?stype=seqid&query=') -%]
>
> when I click on it, I get an url that looks like :
> search%5C%3Fstype=seqid&query=
>
> Is there a way to get the proper url produce in the HTML page without
> '%5C%3F' ?

The docs say:
  $c->uri_for( $path, @args?, \%query_values? )

translated to TT that should read
  [%  Catalyst.uri_for('search', { stype=>'seqid' } ) %]
(I think, but I constantly mix up how to defines hashes in TT)


--
#!/usr/bin/perl http://domm.plix.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}

_______________________________________________
List: [email protected: Cat...@lists.scsys.co.uk]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

spacer
Profile | Posts (18)
Home > People > Thomas Klausner