[Catalyst] Multiple Views in Catalyst (FW: Catalyst-dev Digest, Vol 29, Issue 14)

Emily Heureux emily at burnham.org
Thu Nov 29 21:43:38 GMT 2007


Ok, I think I've gotten the correct mailing list now.  Unfortunately, my
company does not allow irc, so...

I would like to have more than one module in View, but I have not found how
to set that up properly.  I have spent a lot of time on cpan, reading the
tutorial, and coding examples, experimented on my project, but my lack of
experience with Catalyst makes it hard to find what I am missing.  It looks
like, from the suggestions I've gotten so far, that somewhere a default view
is set (RenderView? end method?) that I need to alter.  What I think would
be a correct way of starting is,
1.  Use the helper script to create a second TT View.
2.  Somewhere, do something about the default behavior. (and what if in the
future I want more than 2 views?)

Thanks,
Emily

-----Original Message-----
From: catalyst-dev-request at lists.scsys.co.uk
[mailto:catalyst-dev-request at lists.scsys.co.uk] 
Sent: Thursday, November 29, 2007 4:00 AM
To: catalyst-dev at lists.scsys.co.uk
Subject: Catalyst-dev Digest, Vol 29, Issue 14

Send Catalyst-dev mailing list submissions to
	catalyst-dev at lists.scsys.co.uk

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev
or, via email, send a message with subject or body 'help' to
	catalyst-dev-request at lists.scsys.co.uk

You can reach the person managing the list at
	catalyst-dev-owner at lists.scsys.co.uk

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Catalyst-dev digest..."


Today's Topics:

   1. porting from another MVC framework (Emily Heureux)
   2. Re: porting from another MVC framework (Kieren Diment)
   3. Re: porting from another MVC framework (J. Shirley)
   4. Re: porting from another MVC framework (Matt S Trout)


----------------------------------------------------------------------

Message: 1
Date: Wed, 28 Nov 2007 14:24:52 -0800
From: "Emily Heureux" <emily at burnham.org>
Subject: [Catalyst-dev] porting from another MVC framework
To: <catalyst-dev at lists.scsys.co.uk>
Message-ID: <013501c8320d$7f01b0c0$d8fa10ac at burnham.org>
Content-Type: text/plain; charset="us-ascii"

Hi, we are trying to port from a homemade MVC framework to Catalyst, but we
are new to Catalyst.  The old setup had logic written in Model and View, and
very little in the Controller.  I do not understand how Catalyst is set up
by default.  I cannot seem to have several perl modules within View, but I
can put all the logic and perl modules I want into Controller.  My
understanding is that you don't want to put a bunch of logic in Controller,
but instead in Model and View.  Is that not a typical way of going about
designing in Catalyst?

 

Thank you for any insights or opinions,

Emily

-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.scsys.co.uk/pipermail/catalyst-dev/attachments/20071128/db86751
d/attachment.html

------------------------------

Message: 2
Date: Thu, 29 Nov 2007 09:47:48 +1100
From: Kieren Diment <diment at gmail.com>
Subject: Re: [Catalyst-dev] porting from another MVC framework
To: Development of the elegant MVC web framework
	<catalyst-dev at lists.scsys.co.uk>
Message-ID: <DBEEC580-2FF1-4E70-9A4E-97708E6E416D at gmail.com>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed


On 29 Nov 2007, at 09:24, Emily Heureux wrote:

> Hi, we are trying to port from a homemade MVC framework to  
> Catalyst, but we
> are new to Catalyst.  The old setup had logic written in Model and  
> View, and
> very little in the Controller.  I do not understand how Catalyst is  
> set up
> by default.  I cannot seem to have several perl modules within  
> View, but I
> can put all the logic and perl modules I want into Controller.  My
> understanding is that you don't want to put a bunch of logic in  
> Controller,
> but instead in Model and View.  Is that not a typical way of going  
> about
> designing in Catalyst?
>

Yes that is correct.

I think it will be tricky for us to help you without more details.   
Can I suggest that you pop onto #catalyst at irc.perl.org and have a  
chat with people there.  How easy it is to move your old stuff over  
to catalyst depends on how clean the design of your existing code is,  
e.g. can you run your existing code without a web server, how does  
the url/action dispatch work, how are sessions/other state dealt with  
and so on.

Also Matt Trout did some work on getting existing CGI scripts working  
under catalyst (Catalyst::Controller::WrapCGI - in catalyst svn - not  
on cpan yet due to lack of documentation) in order to get legacy  
maypole applications working under catalyst.  This might be of some  
help to you, but without more details it's difficult to say.

By the way, if you do end up on irc, note that it can be a slightly  
unforgiving environment, but bear with us, listen to advice, and you  
should get some good quality help.



------------------------------

Message: 3
Date: Wed, 28 Nov 2007 16:23:27 -0800
From: "J. Shirley" <jshirley at gmail.com>
Subject: Re: [Catalyst-dev] porting from another MVC framework
To: "Development of the elegant MVC web framework"
	<catalyst-dev at lists.scsys.co.uk>
Message-ID:
	<756703690711281623n7285d5aau9c0860eb45f9a21c at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

On Nov 28, 2007 2:47 PM, Kieren Diment <diment at gmail.com> wrote:

>
> On 29 Nov 2007, at 09:24, Emily Heureux wrote:
>
> > Hi, we are trying to port from a homemade MVC framework to
> > Catalyst, but we
> > are new to Catalyst.  The old setup had logic written in Model and
> > View, and
> > very little in the Controller.  I do not understand how Catalyst is
> > set up
> > by default.  I cannot seem to have several perl modules within
> > View, but I
> > can put all the logic and perl modules I want into Controller.  My
> > understanding is that you don't want to put a bunch of logic in
> > Controller,
> > but instead in Model and View.  Is that not a typical way of going
> > about
> > designing in Catalyst?
> >
>
> Yes that is correct.
>
> I think it will be tricky for us to help you without more details.
> Can I suggest that you pop onto #catalyst at irc.perl.org and have a
> chat with people there.  How easy it is to move your old stuff over
> to catalyst depends on how clean the design of your existing code is,
> e.g. can you run your existing code without a web server, how does
> the url/action dispatch work, how are sessions/other state dealt with
> and so on.
>
> Also Matt Trout did some work on getting existing CGI scripts working
> under catalyst (Catalyst::Controller::WrapCGI - in catalyst svn - not
> on cpan yet due to lack of documentation) in order to get legacy
> maypole applications working under catalyst.  This might be of some
> help to you, but without more details it's difficult to say.
>
> By the way, if you do end up on irc, note that it can be a slightly
> unforgiving environment, but bear with us, listen to advice, and you
> should get some good quality help.
>


And say that you did post to the mailing list and were pointed to IRC
specifically.  There are a lot of people who join the IRC channel looking
for us to write their app for them :)

To quickly address the original question... you should have multiple views
that do a single thing, and the controller dispatches to each of them as
necessary.  The model should contain everything you need to do.

If you need more than one module in a view, you should probably use
different views... there is no limit on how many views you can use.

-J

-- =

J. Shirley :: jshirley at gmail.com :: Killing two stones with one bird...
http://www.toeat.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst-dev/attachments/20071128/5=
0fd4667/attachment-0001.htm

------------------------------

Message: 4
Date: Thu, 29 Nov 2007 00:59:09 +0000
From: Matt S Trout <dbix-class at trout.me.uk>
Subject: Re: [Catalyst-dev] porting from another MVC framework
To: Development of the elegant MVC web framework
	<catalyst-dev at lists.scsys.co.uk>
Message-ID: <20071129005909.GK3434 at jules.scsys.co.uk>
Content-Type: text/plain; charset=us-ascii

On Wed, Nov 28, 2007 at 02:24:52PM -0800, Emily Heureux wrote:
> Hi, we are trying to port from a homemade MVC framework to Catalyst

Then you want the users' list, not this one (which is development -of-
Catalyst
not -using- Catalyst).

>, but we
> are new to Catalyst.  The old setup had logic written in Model and View,
and
> very little in the Controller.  I do not understand how Catalyst is set up
> by default.  I cannot seem to have several perl modules within View

MyApp::View::Foo
MyApp::View::Bar

MyApp->config->{default_view} = 'Foo';

$c->stash(current_view => 'Bar');

> , but I
> can put all the logic and perl modules I want into Controller.  My
> understanding is that you don't want to put a bunch of logic in
Controller,
> but instead in Model and View.

Varies with the interpretation of MVC.

I prefer thin controllers that just handle request workflow ala a trad
smalltalk MVC.

I'll happily elaborate on all this on the main catalyst users' list once
you've moved the thread.

-- 
      Matt S Trout       Catalyst and DBIx::Class consulting and support -
   Technical Director      http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Christmas fun in collectable card game form -
 
http://www.shadowcat.co.uk/resources/2007_trading/



------------------------------

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev at lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev


End of Catalyst-dev Digest, Vol 29, Issue 14
********************************************





More information about the Catalyst mailing list