Re: [Catalyst] Which Form Validation Libs?

2010-11-30 Thread Mike Raynham

On 30/11/10 03:34, Eric Berg wrote:

I see that there are a number of form validation libraries that purport
to work with Catalyst. I've been using CGI::Formbuilder for years and
have been relatively happy with it.

I need something for my new Catalyst app. I have already created my
forms in my TT templates, but I need validation for most of the regular
stuff, including zip codes, states, credit card info, etc.

You guys got any recommendations?

Thanks.

Eric



I have just started to look at Data::FormValidator:

"Data::FormValidator lets you define profiles which declare the required 
and optional fields and any constraints they might have."


You can use the built-in constraints, use existing CPAN modules (e.g., 
Email::Valid), and add your own custom constraints - maybe incorporating 
MooseX::Types and MooseX::Types::Structured, as suggested by Darren Duncan.


It doesn't generate form HTML for you, but I prefer to manually create 
this anyway.



Regards,

Mike

___
List: Catalyst@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/


Re: [Catalyst] Which Form Validation Libs?

2010-11-30 Thread David Schmidt
another great module which from my perception is used the most lately is

HTML::FormHandler
http://search.cpan.org/~gshank/HTML-FormHandler-0.32005/

greetings
david

On Tue, Nov 30, 2010 at 9:24 AM, Mike Raynham
 wrote:
> On 30/11/10 03:34, Eric Berg wrote:
>>
>> I see that there are a number of form validation libraries that purport
>> to work with Catalyst. I've been using CGI::Formbuilder for years and
>> have been relatively happy with it.
>>
>> I need something for my new Catalyst app. I have already created my
>> forms in my TT templates, but I need validation for most of the regular
>> stuff, including zip codes, states, credit card info, etc.
>>
>> You guys got any recommendations?
>>
>> Thanks.
>>
>> Eric
>
>
> I have just started to look at Data::FormValidator:
>
> "Data::FormValidator lets you define profiles which declare the required and
> optional fields and any constraints they might have."
>
> You can use the built-in constraints, use existing CPAN modules (e.g.,
> Email::Valid), and add your own custom constraints - maybe incorporating
> MooseX::Types and MooseX::Types::Structured, as suggested by Darren Duncan.
>
> It doesn't generate form HTML for you, but I prefer to manually create this
> anyway.
>
>
> Regards,
>
> Mike
>
> ___
> List: Catalyst@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/
>

___
List: Catalyst@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/


Re: [Catalyst] Which Form Validation Libs?

2010-11-30 Thread Hernan Lopes
formhandler and formbuilder have some syntax similarities. shouldnt be hard
to move from one to the other.
Just in case you are curiousm, here are some examples:
FormBuilder: http://www.formbuilder.org/tutor/index.pl?c=1&s=5
FormHandler:
http://search.cpan.org/~gshank/HTML-FormHandler-0.32005/lib/HTML/FormHandler/Manual/Catalyst.pod

--Hernan

On Tue, Nov 30, 2010 at 9:26 AM, Shlomi Fish  wrote:

> On Tuesday 30 November 2010 11:31:56 David Schmidt wrote:
> > another great module which from my perception is used the most lately is
> >
> > HTML::FormHandler
> > http://search.cpan.org/~gshank/HTML-FormHandler-0.32005/
> >
>
> I can recommend *against* HTML-FormHandler.
>
> For my day job's Perl and Catalyst project, we initially decided to go with
> HTML-FormHandler, only to discover it was buggy, quirky and had severe
> memory
> leaks. We ended up doing many workarounds and recently made a transition
> from
> it to HTML-FormFu, which while by no means perfect, is much saner.
>
> My co-worker "nothingmuch" who has done many of the workarounds can provide
> further comments on it. Recently I had to over-ride a role in the login
> form
> (for which we need to use HTML-FormHandler due to CatalystX::SimpleLogin)
> that
> will accept an empty string as the 'action=""' attribute because it only
> placed true values of the attribute there, which ruled out empty strings.
> But
> I recall many other fun hours debugging HTML-FormHandler.
>
> Stay away if you can.
>
> Regards,
>
>Shlomi Fish
>
> --
> -
> Shlomi Fish   http://www.shlomifish.org/
> What does "Zionism" mean? - http://shlom.in/def-zionism
>
>  She's a hot chick. But she smokes.
>  She can smoke as long as she's smokin'.
>
> Please reply to list if it's a mailing list post - http://shlom.in/reply .
>
> ___
> List: Catalyst@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/
>
___
List: Catalyst@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/


Re: [Catalyst] Which Form Validation Libs?

2010-11-30 Thread Ashley Pond V
> HTML::FormHandler

Chiming in: FormHandler has been getting the most questions lately,
IIRC, but I suspect FormFu is more often used. It has its own
excellent mailing list (made excellent by the main dev, Carl Franks,
who is very responsive and helpful) so the questions don't tend to end
up here. Except for speed (it's quite slow) I like it very well and it
has excellent hooks/extensions for DBIC.

___
List: Catalyst@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/


Re: [Catalyst] Re: superuser "switch-user" session function?

2010-11-30 Thread Peter Karman
will trillich wrote on 11/29/2010 05:37 PM:
> Aha! It looks like a sneaky, evil, wrong, mean, horrid way to
> switch-user in the middle of a session is to
> 
> $c->session->{__user}{id} = $new_id_here; # since "id" = PK
> 
> But that's undoubtedly bad form of the worst kind.
> 
> What's the canonical non-sneaky above-board friendly golden way to do this?
> 

I don't know that there is a canonical way. This is Perl.

As I mentioned in my reply to this thread in July[0], one way is to
login as the new user and store the original username in the new user's
session. That way the app knows that the new user is allowed to revert
to the original user, but otherwise the app treats the current session
just as it would if the new user had logged in normally.


[0] http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg09968.html

-- 
Peter Karman  .  http://peknet.com/  .  pe...@peknet.com

___
List: Catalyst@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/


Re: [Catalyst] Which Form Validation Libs?

2010-11-30 Thread Peter Karman
Eric Berg wrote on 11/29/2010 09:34 PM:

> You guys got any  recommendations?
> 

Rose::HTML::Objects

-- 
Peter Karman  .  http://peknet.com/  .  pe...@peknet.com

___
List: Catalyst@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/


[Catalyst] C::E::HTTP::PreFork deployment

2010-11-30 Thread Edmund von der Burg
Hello,

Currently I run several Catalyst apps under lighttpd using fastcgi.
I'd like to switch to them being HTTP::Prefork.


Are there any sample setups that I can refer to - especially that illustrate:

* several apps on one IP address (hostname based routing)

* restarting app when new code is available

* serving static assets (or is C::P::Static the way to go)

I'm not really fussed what the frontend is - it could be lighttpd or
nginx or perlbal or ...

My main aim is to make my dev and production environments more similar
and get greater control over the number of processes running.

Cheers,
  Edmund.

PS I've read http://wiki.catalystframework.org/wiki/deployment but
want an example running on a non-standard port.

-- 
Edmund von der Burg - e...@ecclestoad.co.uk
mob: +44 7903 420 689
web: http://www.ecclestoad.co.uk/

___
List: Catalyst@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/


Re: [Catalyst] Re: superuser "switch-user" session function?

2010-11-30 Thread Hernan Lopes
Indeed, i think it should login as a new user not changing the actual
session.
maybe something like:

admin clicks "login as joeuser">open a new browser window as admin>verify
its admin and re-login as a new user. register on session user is admin so
he can log back in.
Then add button "terminate session, close window and logout and log back in
with adminfoologin on parent.window"


--Hernan

On Tue, Nov 30, 2010 at 1:01 PM, Peter Karman  wrote:

> will trillich wrote on 11/29/2010 05:37 PM:
> > Aha! It looks like a sneaky, evil, wrong, mean, horrid way to
> > switch-user in the middle of a session is to
> >
> > $c->session->{__user}{id} = $new_id_here; # since "id" = PK
> >
> > But that's undoubtedly bad form of the worst kind.
> >
> > What's the canonical non-sneaky above-board friendly golden way to do
> this?
> >
>
> I don't know that there is a canonical way. This is Perl.
>
> As I mentioned in my reply to this thread in July[0], one way is to
> login as the new user and store the original username in the new user's
> session. That way the app knows that the new user is allowed to revert
> to the original user, but otherwise the app treats the current session
> just as it would if the new user had logged in normally.
>
>
> [0] http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg09968.html
>
> --
> Peter Karman  .  http://peknet.com/  .  pe...@peknet.com
>
> ___
> List: Catalyst@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/
>
___
List: Catalyst@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/


[Catalyst] FormHandler -- pro or con?

2010-11-30 Thread will trillich
Anybody else *dissing* FormHandler? We've started developing based on
FormHandler lately and haven't had troubles... yet?


On Tue, Nov 30, 2010 at 5:26 AM, Shlomi Fish  wrote:

> I can recommend *against* HTML-FormHandler.
>
> For my day job's Perl and Catalyst project, we initially decided to go with
> HTML-FormHandler, only to discover it was buggy, quirky and had severe
> memory
> leaks. We ended up doing many workarounds and recently made a transition
> from
> it to HTML-FormFu, which while by no means perfect, is much saner.
>
> My co-worker "nothingmuch" who has done many of the workarounds can provide
> further comments on it. Recently I had to over-ride a role in the login
> form
> (for which we need to use HTML-FormHandler due to CatalystX::SimpleLogin)
> that
> will accept an empty string as the 'action=""' attribute because it only
> placed true values of the attribute there, which ruled out empty strings.
> But
> I recall many other fun hours debugging HTML-FormHandler.
>
> Stay away if you can.
>
> Regards,
>
>Shlomi Fish
>
> --
> -
> Shlomi Fish   http://www.shlomifish.org/
> What does "Zionism" mean? - http://shlom.in/def-zionism
>
>  She's a hot chick. But she smokes.
>  She can smoke as long as she's smokin'.
>
> Please reply to list if it's a mailing list post - http://shlom.in/reply .
>
> ___
> List: Catalyst@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/
>



-- 
Failure is not important. How you overcome it, is.
-- Nick Vujicic
___
List: Catalyst@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/


Re: [Catalyst] Which Form Validation Libs?

2010-11-30 Thread Steve
My guess is that FormHandler is getting the attention that it is is due 
to two major things.  First of all, it is Moose based - like Catalyst.  
Secondly, the documentation of FormHandler seems more complete.  Unless 
the docs for FormFu have been updated recently (past 6 months or so), 
the author acknowledges this fact about the documentation.

On 11/30/2010 9:47 AM, Ashley Pond V wrote:

HTML::FormHandler

Chiming in: FormHandler has been getting the most questions lately,
IIRC, but I suspect FormFu is more often used. It has its own
excellent mailing list (made excellent by the main dev, Carl Franks,
who is very responsive and helpful) so the questions don't tend to end
up here. Except for speed (it's quite slow) I like it very well and it
has excellent hooks/extensions for DBIC.

___
List: Catalyst@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/




___
List: Catalyst@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/


Re: [Catalyst] C::E::HTTP::PreFork deployment

2010-11-30 Thread Ashley Pond V
On Tue, Nov 30, 2010 at 7:04 AM, Edmund von der Burg
 wrote:
> Hello,
>
> Currently I run several Catalyst apps under lighttpd using fastcgi.
> I'd like to switch to them being HTTP::Prefork.

A very incomplete answer but I'd suggest adding PSGI/Starman to the
list of things you look at. It's HUPable for restarts though I don't
think anyone has written a file-watcher style hook to do that (yet)
and can have workers added and removed with signals. With things like
Plack::Builder you can make all kinds of tremendously powerful
deployment choices pretty simple.

I have a stub git repo for a starman service script:
https://github.com/pangyre/p5-cat-starman-daemon (there is nothing
there now but I do have a good skeleton that isn't committed/pushed. I
was hoping to round out / generalize it in time for an advent entry.
As well as a P::Builder thing... anyone seen my tuits? They were
round, once.

-ashley

___
List: Catalyst@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/


Re: [Catalyst] FormHandler -- pro or con?

2010-11-30 Thread Hernan Lopes
Formhandler works like a charm, does many useful checks and you wont have
any trouble with it. i have been using it for a while without any problem.
As for the memory leaks, it can affect you when resources are limited or
when you are running out of ram. (no idea if there are any leaks on
formhandler)
If you decide to change, formbuilder is the closest option to formhandler.
--Hernan

On Tue, Nov 30, 2010 at 1:34 PM, will trillich
wrote:

> Anybody else *dissing* FormHandler? We've started developing based on
> FormHandler lately and haven't had troubles... yet?
>
>
> On Tue, Nov 30, 2010 at 5:26 AM, Shlomi Fish  wrote:
>
>> I can recommend *against* HTML-FormHandler.
>>
>> For my day job's Perl and Catalyst project, we initially decided to go
>> with
>> HTML-FormHandler, only to discover it was buggy, quirky and had severe
>> memory
>> leaks. We ended up doing many workarounds and recently made a transition
>> from
>> it to HTML-FormFu, which while by no means perfect, is much saner.
>>
>> My co-worker "nothingmuch" who has done many of the workarounds can
>> provide
>> further comments on it. Recently I had to over-ride a role in the login
>> form
>> (for which we need to use HTML-FormHandler due to CatalystX::SimpleLogin)
>> that
>> will accept an empty string as the 'action=""' attribute because it only
>> placed true values of the attribute there, which ruled out empty strings.
>> But
>> I recall many other fun hours debugging HTML-FormHandler.
>>
>> Stay away if you can.
>>
>> Regards,
>>
>>Shlomi Fish
>>
>> --
>> -
>> Shlomi Fish   http://www.shlomifish.org/
>> What does "Zionism" mean? - http://shlom.in/def-zionism
>>
>>  She's a hot chick. But she smokes.
>>  She can smoke as long as she's smokin'.
>>
>> Please reply to list if it's a mailing list post - http://shlom.in/reply.
>>
>> ___
>> List: Catalyst@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/
>>
>
>
>
> --
> Failure is not important. How you overcome it, is.
> -- Nick Vujicic
>
> ___
> List: Catalyst@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/
>
>
___
List: Catalyst@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/


[Catalyst] DBIx::Class many_to_many relationship

2010-11-30 Thread linuxsupport
Hi,

I am new to Catalyst and DBIx::Class, trying to use many_to_many
relationship.

I have 3 tables, users, user_groups, and group, table structure and
relationship are setup as follows.

User.pm

__PACKAGE__->add_columns(
  "id",
  { data_type => "integer", is_nullable => 0 },
  "username",
  { data_type => "text", is_nullable => 1 },
  "password",
  { data_type => "text", is_nullable => 1 },
  "email_address",
  { data_type => "text", is_nullable => 1 },
  "first_name",
  { data_type => "text", is_nullable => 1 },
  "last_name",
  { data_type => "text", is_nullable => 1 },
  "active",
  { data_type => "integer", is_nullable => 1 },
);
__PACKAGE__->set_primary_key("id");

__PACKAGE__->has_many("usergroups", "Example::Schema::Result::UserGroup",{
"foreign.user_id" => "self.id" },);
__PACKAGE__->many_to_many(group => 'usergroups', 'group');

UserGroup.pm

__PACKAGE__->add_columns(
  "user_id",
  { data_type => "integer", is_nullable => 0 },
  "group_id",
  { data_type => "integer", default_value => 0, is_nullable => 0 },
);
__PACKAGE__->set_primary_key("user_id", "group_id");

__PACKAGE__->belongs_to("user", "Example::Schema::Result::User", { id =>
"user_id" },{ join_type => "LEFT" },);
__PACKAGE__->belongs_to("group", "Example::Schema::Result::Group", { id =>
"group_id" },{ join_type => "LEFT" },);

Group.pm

__PACKAGE__->add_columns(
  "id",
  { data_type => "integer", is_nullable => 0 },
  "group",
  { data_type => "text", is_nullable => 0 },
);
__PACKAGE__->set_primary_key("id");

__PACKAGE__->has_many("usergroup","Example::Schema::Result::UserGroup",{
"foreign.group_id" => "self.id" },);

Can anyone tell me how I can retrieve all the users who are member of a
group called 'manager'?

Thanks
___
List: Catalyst@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/


Re: [Catalyst] DBIx::Class many_to_many relationship

2010-11-30 Thread Steve
I recommend you create a 'Example::Schema::ResultSet::Group' resultset 
class.  Presumably
you already have a 'Result' directory where your table classes reside, 
so create a ResultSet

directory (if you don't already have one).

Look here: 
http://search.cpan.org/~frew/DBIx-Class-0.08124/lib/DBIx/Class/ResultSet.pm 
for 
direction,
but essentially this is where you would set up queries pertaining to 
your 'Groups'.


You'll do a search of all the related Users having a group name = 
'manager' or something

similar.

Steve
On 11/30/2010 11:02 AM, linuxsupport wrote:

Hi,

I am new to Catalyst and DBIx::Class, trying to use many_to_many 
relationship.


I have 3 tables, users, user_groups, and group, table structure and 
relationship are setup as follows.


User.pm

__PACKAGE__->add_columns(
  "id",
  { data_type => "integer", is_nullable => 0 },
  "username",
  { data_type => "text", is_nullable => 1 },
  "password",
  { data_type => "text", is_nullable => 1 },
  "email_address",
  { data_type => "text", is_nullable => 1 },
  "first_name",
  { data_type => "text", is_nullable => 1 },
  "last_name",
  { data_type => "text", is_nullable => 1 },
  "active",
  { data_type => "integer", is_nullable => 1 },
);
__PACKAGE__->set_primary_key("id");

__PACKAGE__->has_many("usergroups", 
"Example::Schema::Result::UserGroup",{ "foreign.user_id" => "self.id 
" },);

__PACKAGE__->many_to_many(group => 'usergroups', 'group');

UserGroup.pm

__PACKAGE__->add_columns(
  "user_id",
  { data_type => "integer", is_nullable => 0 },
  "group_id",
  { data_type => "integer", default_value => 0, is_nullable => 0 },
);
__PACKAGE__->set_primary_key("user_id", "group_id");

__PACKAGE__->belongs_to("user", "Example::Schema::Result::User", { id 
=> "user_id" },{ join_type => "LEFT" },);
__PACKAGE__->belongs_to("group", "Example::Schema::Result::Group", { 
id => "group_id" },{ join_type => "LEFT" },);


Group.pm

__PACKAGE__->add_columns(
  "id",
  { data_type => "integer", is_nullable => 0 },
  "group",
  { data_type => "text", is_nullable => 0 },
);
__PACKAGE__->set_primary_key("id");

__PACKAGE__->has_many("usergroup","Example::Schema::Result::UserGroup",{ 
"foreign.group_id" => "self.id " },);


Can anyone tell me how I can retrieve all the users who are member of 
a group called 'manager'?


Thanks


___
List: Catalyst@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/


___
List: Catalyst@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/


Re: [Catalyst] FormHandler -- pro or con?

2010-11-30 Thread Sir Robert Burbridge

On 11/30/2010 10:34 AM, will trillich wrote:
Anybody else *dissing* FormHandler? We've started developing based on 
FormHandler lately and haven't had troubles... yet?



On Tue, Nov 30, 2010 at 5:26 AM, Shlomi Fish > wrote:


I can recommend *against* HTML-FormHandler.

For my day job's Perl and Catalyst project, we initially decided
to go with
HTML-FormHandler, only to discover it was buggy, quirky and had
severe memory
leaks. We ended up doing many workarounds and recently made a
transition from
it to HTML-FormFu, which while by no means perfect, is much saner.

My co-worker "nothingmuch" who has done many of the workarounds
can provide
further comments on it. Recently I had to over-ride a role in the
login form
(for which we need to use HTML-FormHandler due to
CatalystX::SimpleLogin) that
will accept an empty string as the 'action=""' attribute because
it only
placed true values of the attribute there, which ruled out empty
strings. But
I recall many other fun hours debugging HTML-FormHandler.

Stay away if you can.

Regards,

   Shlomi Fish



FWIW:

HTML::FormHandler has been working with no problems at all for us.  The 
structure isn't very intuitive to me, so I had some trouble making it do 
what I wanted in the beginning.  Once I understood the paradigms, all 
the troubles I was having dropped away.  To mitigate the awkwardness I 
felt about the API, use a pure-module approach (every form is a separate 
package/module, that inherits from a base form that's all rigged up the 
way I want it, along with a few really helpful roles that I drop in on 
forms here and there to do common stuff.  Those two "tricks" went a long 
way towards making HFH intuitive to me; now I can throw together a new 
form in 2 minutes and toss in a couple of roles to make it play nicely 
with jQuery (and jQuery-UI) and DBIC.  Pretty plug-n-play.


All in all, I like it.

-Sir

Note:  The above isn't a criticism of HFH; it's just an observation that 
the author and I have different approaches to some things =)
___
List: Catalyst@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/


Re: [Catalyst] DBIx::Class many_to_many relationship

2010-11-30 Thread Emmanuel OTTON
Le 30 nov. 2010 à 17:02, linuxsupport a écrit :

> Hi,
> I am new to Catalyst and DBIx::Class, trying to use many_to_many
> relationship.
> I have 3 tables, users, user_groups, and group, table structure and
> relationship are setup as follows.
> 
> User.pm
> __PACKAGE__->add_columns(
>  "id",
>  { data_type => "integer", is_nullable => 0 },
>  "username",
>  { data_type => "text", is_nullable => 1 },
>  "password",
>  { data_type => "text", is_nullable => 1 },
>  "email_address",
>  { data_type => "text", is_nullable => 1 },
>  "first_name",
>  { data_type => "text", is_nullable => 1 },
>  "last_name",
>  { data_type => "text", is_nullable => 1 },
>  "active",
>  { data_type => "integer", is_nullable => 1 },
> );
> __PACKAGE__->set_primary_key("id");
> 
> __PACKAGE__->has_many("usergroups", "Example::Schema::Result::UserGroup",{
> "foreign.user_id" => "self.id" },);
> __PACKAGE__->many_to_many(group => 'usergroups', 'group');
> 
> UserGroup.pm
> 
> __PACKAGE__->add_columns(
>  "user_id",
>  { data_type => "integer", is_nullable => 0 },
>  "group_id",
>  { data_type => "integer", default_value => 0, is_nullable => 0 },
> );
> __PACKAGE__->set_primary_key("user_id", "group_id");
> 
> __PACKAGE__->belongs_to("user", "Example::Schema::Result::User", { id =>
> "user_id" },{ join_type => "LEFT" },);
> __PACKAGE__->belongs_to("group", "Example::Schema::Result::Group", { id =>
> "group_id" },{ join_type => "LEFT" },);
> 
> Group.pm
> 
> __PACKAGE__->add_columns(
>  "id",
>  { data_type => "integer", is_nullable => 0 },
>  "group",
>  { data_type => "text", is_nullable => 0 },
> );
> __PACKAGE__->set_primary_key("id");
> 
> __PACKAGE__->has_many("usergroup","Example::Schema::Result::UserGroup",{
> "foreign.group_id" => "self.id" },);
> 
> Can anyone tell me how I can retrieve all the users who are member of a
> group called 'manager'?

1 - DECLARATION
---
First, declare your N:M link from group to user, using the method many_to_many, 
i.e. in your Group.pm, manually add this (at the end of the file, AFTER the 
line that says "DO NOT MODIFY THIS OR ANYTHING ABOVE" if you generated your 
classes using the DBIx::Class::Schema::Loader method "make_schema_at", which I 
highly recommend over the tedious manual method ):

__PACKAGE__->many_to_many('users','usergroup','user');

This many_to_many method adds to any Group object an accessor called "users", 
giving directly access to the linked users.
The 3 arguments are a name and two accessors constituting the path to be used:
 - the accessor name, chosed by you (I tend to recommand the plural, which by 
the way you did not use for your "has_many" accessors)
 - the has_many accessor leading from Group to UserGroup,
 - the belongs_to accessor leading from UserGroup to User.

2 - USE
---
Then, when you need your users (supposing there is only one group called 
'manager'), you just have to get your Group object, and apply the just created 
accessor on it:

my $manager_group = $schema->resultset('Group')->search( { group => 'manager' } 
)->next;
my @users_belonging_to_manager_group = $manager_group->users;

And voila.

By the way, the many_to_many method has also created a "add_to_users" method:
Suppose Joe was just promoted as manager:
my $joe = $schema->resultset('User')->find('Joe');
my $manager_group = $schema->resultset('Group')->search( { group => 'manager' } 
)->next;
$manager_group->add_to_users($joe);

The last line does the right thing(s) to link joe to the manager group.

I've been using it since a long time, it works like a charm.
--
Emmanuel OTTON - Responsable informatique - Ecole des mines d'Albi-Carmaux - 
Tél: 05 63 49 30 86


___
List: Catalyst@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/


Re: [Catalyst] FormHandler -- pro or con?

2010-11-30 Thread Zbigniew Lukasiak
On Tue, Nov 30, 2010 at 4:55 PM, Sir Robert Burbridge
 wrote:
> To mitigate the awkwardness I felt
> about the API, use a pure-module approach (every form is a separate
> package/module, that inherits from a base form that's all rigged up the way
> I want it, along with a few really helpful roles that I drop in on forms
> here and there to do common stuff.

To be fair - this is the way Gerda always used it.  The actions
attribute with the possibility of having different functionality per
form (and field) *instance* were all my additions (copied by they way
from Data::FormValidator and FormFu).   I am starting to regret coding
that - it seems that it complicates the machinery too much.

Cheers,
Zbigniew
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/

___
List: Catalyst@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/


Re: [Catalyst] DBIx::Class many_to_many relationship

2010-11-30 Thread linuxsupport
Thanks Emmanuel, worked as I wanted to, much appreciated.

On Tue, Nov 30, 2010 at 10:25 PM, Emmanuel OTTON wrote:

> Le 30 nov. 2010 à 17:02, linuxsupport a écrit :
>
> > Hi,
> > I am new to Catalyst and DBIx::Class, trying to use many_to_many
> > relationship.
> > I have 3 tables, users, user_groups, and group, table structure and
> > relationship are setup as follows.
> >
> > User.pm
> > __PACKAGE__->add_columns(
> >  "id",
> >  { data_type => "integer", is_nullable => 0 },
> >  "username",
> >  { data_type => "text", is_nullable => 1 },
> >  "password",
> >  { data_type => "text", is_nullable => 1 },
> >  "email_address",
> >  { data_type => "text", is_nullable => 1 },
> >  "first_name",
> >  { data_type => "text", is_nullable => 1 },
> >  "last_name",
> >  { data_type => "text", is_nullable => 1 },
> >  "active",
> >  { data_type => "integer", is_nullable => 1 },
> > );
> > __PACKAGE__->set_primary_key("id");
> >
> > __PACKAGE__->has_many("usergroups",
> "Example::Schema::Result::UserGroup",{
> > "foreign.user_id" => "self.id" },);
> > __PACKAGE__->many_to_many(group => 'usergroups', 'group');
> >
> > UserGroup.pm
> >
> > __PACKAGE__->add_columns(
> >  "user_id",
> >  { data_type => "integer", is_nullable => 0 },
> >  "group_id",
> >  { data_type => "integer", default_value => 0, is_nullable => 0 },
> > );
> > __PACKAGE__->set_primary_key("user_id", "group_id");
> >
> > __PACKAGE__->belongs_to("user", "Example::Schema::Result::User", { id =>
> > "user_id" },{ join_type => "LEFT" },);
> > __PACKAGE__->belongs_to("group", "Example::Schema::Result::Group", { id
> =>
> > "group_id" },{ join_type => "LEFT" },);
> >
> > Group.pm
> >
> > __PACKAGE__->add_columns(
> >  "id",
> >  { data_type => "integer", is_nullable => 0 },
> >  "group",
> >  { data_type => "text", is_nullable => 0 },
> > );
> > __PACKAGE__->set_primary_key("id");
> >
> > __PACKAGE__->has_many("usergroup","Example::Schema::Result::UserGroup",{
> > "foreign.group_id" => "self.id" },);
> >
> > Can anyone tell me how I can retrieve all the users who are member of a
> > group called 'manager'?
>
> 1 - DECLARATION
> ---
> First, declare your N:M link from group to user, using the method
> many_to_many, i.e. in your Group.pm, manually add this (at the end of the
> file, AFTER the line that says "DO NOT MODIFY THIS OR ANYTHING ABOVE" if you
> generated your classes using the DBIx::Class::Schema::Loader method
> "make_schema_at", which I highly recommend over the tedious manual method ):
>
> __PACKAGE__->many_to_many('users','usergroup','user');
>
> This many_to_many method adds to any Group object an accessor called
> "users", giving directly access to the linked users.
> The 3 arguments are a name and two accessors constituting the path to be
> used:
>  - the accessor name, chosed by you (I tend to recommand the plural, which
> by the way you did not use for your "has_many" accessors)
>  - the has_many accessor leading from Group to UserGroup,
>  - the belongs_to accessor leading from UserGroup to User.
>
> 2 - USE
> ---
> Then, when you need your users (supposing there is only one group called
> 'manager'), you just have to get your Group object, and apply the just
> created accessor on it:
>
> my $manager_group = $schema->resultset('Group')->search( { group =>
> 'manager' } )->next;
> my @users_belonging_to_manager_group = $manager_group->users;
>
> And voila.
>
> By the way, the many_to_many method has also created a "add_to_users"
> method:
> Suppose Joe was just promoted as manager:
> my $joe = $schema->resultset('User')->find('Joe');
> my $manager_group = $schema->resultset('Group')->search( { group =>
> 'manager' } )->next;
> $manager_group->add_to_users($joe);
>
> The last line does the right thing(s) to link joe to the manager group.
>
> I've been using it since a long time, it works like a charm.
> --
> Emmanuel OTTON - Responsable informatique - Ecole des mines d'Albi-Carmaux
> - Tél: 05 63 49 30 86
>
>
> ___
> List: Catalyst@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/
>
___
List: Catalyst@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/


Re: [Catalyst] DBIx::Class many_to_many relationship

2010-11-30 Thread Kutbuddin Doctor
In the classes you have written, you are using the same name for the 
many_to_many method from ("group") in User.pm as you have used in method 
between UserGroup to Group.


__PACKAGE__->many_to_many(group => 'usergroups', 'group');

I have seen this cause problems in my hands when using it for User Role 
relationships (Authorization::Role and ACL).. I would recommend avoiding 
reusing the relationship accessor names.



On 11/30/10 8:02 AM, linuxsupport wrote:

Hi,

I am new to Catalyst and DBIx::Class, trying to use many_to_many 
relationship.


I have 3 tables, users, user_groups, and group, table structure and 
relationship are setup as follows.


User.pm

__PACKAGE__->add_columns(
  "id",
  { data_type => "integer", is_nullable => 0 },
  "username",
  { data_type => "text", is_nullable => 1 },
  "password",
  { data_type => "text", is_nullable => 1 },
  "email_address",
  { data_type => "text", is_nullable => 1 },
  "first_name",
  { data_type => "text", is_nullable => 1 },
  "last_name",
  { data_type => "text", is_nullable => 1 },
  "active",
  { data_type => "integer", is_nullable => 1 },
);
__PACKAGE__->set_primary_key("id");

__PACKAGE__->has_many("usergroups", 
"Example::Schema::Result::UserGroup",{ "foreign.user_id" => "self.id 
" },);

__PACKAGE__->many_to_many(group => 'usergroups', 'group');

UserGroup.pm

__PACKAGE__->add_columns(
  "user_id",
  { data_type => "integer", is_nullable => 0 },
  "group_id",
  { data_type => "integer", default_value => 0, is_nullable => 0 },
);
__PACKAGE__->set_primary_key("user_id", "group_id");

__PACKAGE__->belongs_to("user", "Example::Schema::Result::User", { id 
=> "user_id" },{ join_type => "LEFT" },);
__PACKAGE__->belongs_to("group", "Example::Schema::Result::Group", { 
id => "group_id" },{ join_type => "LEFT" },);


Group.pm

__PACKAGE__->add_columns(
  "id",
  { data_type => "integer", is_nullable => 0 },
  "group",
  { data_type => "text", is_nullable => 0 },
);
__PACKAGE__->set_primary_key("id");

__PACKAGE__->has_many("usergroup","Example::Schema::Result::UserGroup",{ 
"foreign.group_id" => "self.id " },);


Can anyone tell me how I can retrieve all the users who are member of 
a group called 'manager'?


Thanks



--
Kutbuddin Doctor, PhD
Bioinformatics Shared Resource,
Sanford-Burnham Medical Research Institute
http://www.sanfordburnham.org/

___
List: Catalyst@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/


Re: [Catalyst] FormHandler -- pro or con?

2010-11-30 Thread Benjamin Hitz
I suppose my issues were not with HFH itself but rather the DBIC interface.

I had some meh experience with it when I was writing a demo CRUD app (project 
was eventually dropped for external reasons).
It was fine as far as the basic stuff went, but when I tried to extend it to 
some complicated forms across DBIC relationships (that did not behave as HFH 
expected), I ended up having to hack on 
DBIx::Class::ResultSet::RecursiveUpdate.  (This was not a bug per se, but more 
of an edge case)

That was not particularly fun.  On the other hand if I used FormFu I would have 
had to essentially write the (recursive) update logic myself anyway.
I checked my notes on this (and it's possible that issued have been fixed since 
then, this dates from 6/15/2010).

Without too much gory detail:

given:
table colleague has_many colleague_keywords belongs_to keywords
so colleague has_many keywords

* if I set the forms up with a m2m pseudorel (like docs suggest) then when I 
deleted a keyword from the Form it would instead UPDATE it setting all columns 
to NULL. 
* If I changed the kw (attempted UPDATE) to a new keyword that didn't exist, 
then it UPDATES the keyword record, instead of deleting the linking table 
record and creating a new keyword record.  It also deletes all the linking 
table entries and recreates them ... which I suppose technically works (but 
annoys my DBA)
* If I had a colleague and tried to add a keyword (that was already linked to 
another colleague) it would fail.  Because the form didn't know the primary key 
of the keyword.
* If I added a brand new keyword to a colleague it would work but did strange 
things with the linking table.

Probably the schema could have been refactored to work with HFH, but that was 
not really an option.  There also could have been bugs in my forms, although I 
was working with GShank a little on this.


Ben



On Nov 30, 2010, at 7:34 AM, will trillich wrote:

> Anybody else *dissing* FormHandler? We've started developing based on 
> FormHandler lately and haven't had troubles... yet?
> 
> 
> On Tue, Nov 30, 2010 at 5:26 AM, Shlomi Fish  wrote:
> I can recommend *against* HTML-FormHandler.
> 
> For my day job's Perl and Catalyst project, we initially decided to go with
> HTML-FormHandler, only to discover it was buggy, quirky and had severe memory
> leaks. We ended up doing many workarounds and recently made a transition from
> it to HTML-FormFu, which while by no means perfect, is much saner.
> 
> My co-worker "nothingmuch" who has done many of the workarounds can provide
> further comments on it. Recently I had to over-ride a role in the login form
> (for which we need to use HTML-FormHandler due to CatalystX::SimpleLogin) that
> will accept an empty string as the 'action=""' attribute because it only
> placed true values of the attribute there, which ruled out empty strings. But
> I recall many other fun hours debugging HTML-FormHandler.
> 
> Stay away if you can.
> 
> Regards,
> 
>Shlomi Fish
> 
> --
> -
> Shlomi Fish   http://www.shlomifish.org/
> What does "Zionism" mean? - http://shlom.in/def-zionism
> 
>  She's a hot chick. But she smokes.
>  She can smoke as long as she's smokin'.
> 
> Please reply to list if it's a mailing list post - http://shlom.in/reply .
> 
> ___
> List: Catalyst@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/
> 
> 
> 
> -- 
> Failure is not important. How you overcome it, is.
> -- Nick Vujicic
> ___
> List: Catalyst@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/

--
Ben Hitz 
Senior Scientific Programmer ** Saccharomyces Genome Database ** GO Consortium
Stanford University ** h...@genome.stanford.edu



___
List: Catalyst@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/


RE: [Catalyst] Overriding Catalyst::View::TT WRAPPER

2010-11-30 Thread Mesdaq, Ali
Worked like a charm. I agree that this is a cleaner way as well. However it 
might be useful if we had the ability to override added to catalyst something 
like
$c->stash
(
WRAPPER => undef,
template => 'src/mypage.tt2',
);

Or something along those lines.

Thanks,
--
Ali Mesdaq (CISSP, GIAC-GREM)
Sr. Security Researcher
Websense Security Labs
http://www.WebsenseSecurityLabs.com
--

From: Hernan Lopes [mailto:hernanlo...@gmail.com]
Sent: Monday, November 29, 2010 6:38 PM
To: The elegant MVC web framework
Subject: Re: [Catalyst] Overriding Catalyst::View::TT WRAPPER

I personally think that [% IF no_wrapper %] etc is not clean enough so
i would create a new view and call it View::NoWrapper
then you can set
$c->stash(
current_view => 'NoWrapper',
template => 'src/mypage.html',
);

and then, you will need to set a wrapper.tt.
But you can choose to leave it with [% content %] only, or add some html 
headers.. or whatever you need.

--Hernan
On Mon, Nov 29, 2010 at 11:27 PM, Sam Kaufman 
mailto:samuel.c.kauf...@gmail.com>> wrote:
I've found the easiest way is to have some logic in your wrapper:
something like this:
[%
 IF no_wrapper;
 content;
 ELSE;
 content WRAPPER site/html + site/layout;
END;
%]
so $c->stash(no_wrapper => 1) and it won't be wrapped.
-Sam

On Mon, Nov 29, 2010 at 8:16 PM, Mesdaq, Ali 
mailto:ames...@websense.com>> wrote:
> Hey Everyone,
>
> Got a question about how I can override my application's TT wrapper. The 
> closest thing I found was 
> http://search.cpan.org/~abraxxa/Catalyst-View-TT-0.36/lib/Catalyst/View/TT.pm#CONFIGURATION
>  . But what I am trying to do is basically have the wrapper turned off for a 
> specific public method where I will create a new TT file that I want used 
> without it being wrapped.
>
> Thanks,
> ALI MESDAQ
> Sr. Security Researcher
>
> WEBSENSE, INC.
> ph: +1.858.320.9466
> fax: +1.858.784.4466
> www.websense.com
>
> Websense TRITON™
> For Essential Information Protection™
> Web Security | Data Security | Email Security
>
>
>
>
>  Protected by Websense Hosted Email Security -- 
> www.websense.com
>
> ___
> List: Catalyst@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/
>
>

___
List: Catalyst@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/



Click 
here
 to report this email as spam.
___
List: Catalyst@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/


Re: [Catalyst] Overriding Catalyst::View::TT WRAPPER

2010-11-30 Thread Bill Moseley
On Mon, Nov 29, 2010 at 5:27 PM, Sam Kaufman wrote:

> I've found the easiest way is to have some logic in your wrapper:
> something like this:
> [%
>  IF no_wrapper;
>  content;
>  ELSE;
>  content WRAPPER site/html + site/layout;
> END;
> %]
>

I tend to use a CASE statement in my wrapper to allow for different layouts.

so $c->stash(no_wrapper => 1) and it won't be wrapped.
>

Yes, but I also allow templates to specify their layout.  So for an action
/foo/bar  I might have /foo/bar.tt and in bar.tt:

[%   page.layout = 'cms'; # override default layout %]




-- 
Bill Moseley
mose...@hank.org
___
List: Catalyst@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/


[Catalyst] Re: Converting a GET request to a POST request

2010-11-30 Thread Aristotle Pagaltzis
* Ronald J Kimball  [2010-11-29 18:30]:
> This is for a widget that will be hosted on third party
> websites. The widget will allow users of those sites to
> interact with our content. The widget will be written in
> JavaScript and HTML. The widget will retrieve content and
> submit user interactions using Ajax and JSONP (supposedly via
> a REST API :). Users will not be required to log in to interact
> with the content in the widget.

An obvious idea would be to serve the client-side code from your
own domain so it can use XMLHttpRequest – so I have to assume you
considered and rejected that approach. Is that so? If yes, it
would be useful to hear the considerations behind that rejection.

Regards,
-- 
Aristotle Pagaltzis // 

___
List: Catalyst@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/


Re: [Catalyst] Overriding Catalyst::View::TT WRAPPER

2010-11-30 Thread David Stevenson

On 1 Dec 2010, at 00:39, Bill Moseley wrote:
> 
> Yes, but I also allow templates to specify their layout.  So for an action 
> /foo/bar  I might have /foo/bar.tt and in bar.tt:
> 
> [%   page.layout = 'cms'; # override default layout %]

Yes, that's what I do. The template is deciding the view. IMO that's the right 
place for it.

It's like setting page titles, which (I assume) most people do the same way.

___
List: Catalyst@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/