0
Herding a Cat with
        Antlers
New toys for writing a modern Catalyst application




  Tomas Doran (t0m) <bobtfish@bob...
Who am I?



     (Mostly)
“Catalyst 5.80
Chainsaw delegate”
Said mst




(I’m sure he’s regretted this a time or two)
So, basically:
   I add all the bugs..


        Got it?
        Great!
This talk

• 25% rant / ramble about Catalyst 5.80
• 50% rapid run through new Catalyst
  extensions and Moose features
• ...
Theme fail
  This doesn’t really fit into ‘beginning perl’.




  I’ll be happy to try for ‘Beginning being a
Catalyst dev’...
Catalyst 5.80
• Released April 2009
• Next major release series - 18 months
  work
• 15 stable releases this year
• Backwa...
Moose port
• Catalyst is not designed for trivial
  applications.
• Serious apps (iPlayer, rambler.ru, youporn),
  serious...
Extensions!
• Catalyst is all about customisation.
• Moose Roles are much better than multiple
  inheritance.
• Catalyst w...
Moose

• Attributes (automatically filled from config)
• Type constraints (config validation)
• Method modifiers
• Powerful de...
Component attributes

• Models/Views/Controllers can require
  attributes (with types).
• This data is supplied from config...
Component attributes
Delegation

• Attributes and the ‘handles’ feature are as
  powerful, if not more powerful than roles.
• Delegation is oft...
Delegation
Roles Roles Roles
• Application class roles
• Controller roles (with method attributes)
• Request / Response roles
• Actio...
Method modifiers


• Run code before / after methods, or wrap
  them with around.
• Composable
Method modifiers
Another example
App class roles

• Things which used to be plugins can now
  be roles.
• Affect things application wide as they
  change t...
App class roles
New CPAN shiny!

• Catalyst::Controller::ActionRole
• CatalystX::RoleApplicator
• MooseX::MethodAttributes::Role
• Catalys...
Action Roles

•   Everyone has seen :ActionClass(‘RenderView’)

•   You can only have 1 ActionClass

•   This sucks

•   C...
Catalyst::Controller::ActionRole
CatalystX::RoleApplicator

• Use it in your app to apply roles to
  Request/Response/Engine/Dispatcher etc
• Use it in you...
CatalystX::RoleApplicator
MooseX::MethodAttributes::Role


• Controller actions can be in roles.
• Use for common path end-points (E.g.
  CRUD)
• Us...
MooseX::MethodAttributes::Role
MooseX::MethodAttributes::Role
CatalystX::Components::Traits


• Apply (or remove) roles for your
  application components with config.
• E.g. Change ACLs...
CatalystX::Component:
Catalyst::TraitFor::XXX:YYY

•   CatalystX::SimpleLogin::TraitFor::Controller::Login::WithRedirect

•   Catalyst::TraitFor...
That’s what we did
     this year!
This week

• I’m pleased to announce Catalyst-Runtime
  5.80015 and Catalyst-Devel 1.22
• New scripts system from the Goog...
The future
• More docs (yes, the tutorial still needs
  updating)
• More deprecations (sorry!)
• Continual improvement of ...
Thanks


Tomas Doran (t0m) <bobtfish@bobtfish.net>

               #catalyst
Redux


• Sorry, I was lieing.
• I haven’t finished.
U R DOIN IT RONG

• I’ve just shown off lots of fancy tricks.
• This DOES NOT MEAN you use only
  those.
• This DOES NOT M...
Beware your app
 getting too fat
CATALYST IS JUST
        GLUE
• ALL of your business logic should exist
  OUTSIDE CATALYST

• If you’re doing heavy liftin...
This does mean

• You develop independent components
  using Moose / Roles / etc
• You tie these into Catalyst as models w...
Obligatory pony
Upcoming SlideShare
Loading in...5
×

Herding a Cat with Antlers - Catalyst 5.80

2,480

Published on

Catalyst 5.80 - the new major version allows you lots of new ways to build applications. This talk looks at some of the technologies you may want to use, and points out some examples and other modules you might want to look at on CPAN.

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,480
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
33
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide
  • Transcript of "Herding a Cat with Antlers - Catalyst 5.80"

    1. 1. Herding a Cat with Antlers New toys for writing a modern Catalyst application Tomas Doran (t0m) <bobtfish@bobtfish.net>
    2. 2. Who am I? (Mostly)
    3. 3. “Catalyst 5.80 Chainsaw delegate”
    4. 4. Said mst (I’m sure he’s regretted this a time or two)
    5. 5. So, basically: I add all the bugs.. Got it? Great!
    6. 6. This talk • 25% rant / ramble about Catalyst 5.80 • 50% rapid run through new Catalyst extensions and Moose features • 25% new developments and the future. • NOT a Catalyst intro, sorry.
    7. 7. Theme fail This doesn’t really fit into ‘beginning perl’. I’ll be happy to try for ‘Beginning being a Catalyst dev’ by handing commit bits out later
    8. 8. Catalyst 5.80 • Released April 2009 • Next major release series - 18 months work • 15 stable releases this year • Backward compatible with 5.71, 5.70 etc.. • New features! Less bugs!?!
    9. 9. Moose port • Catalyst is not designed for trivial applications. • Serious apps (iPlayer, rambler.ru, youporn), serious OO. Needs a serious framework. • Class::Accessor::Doesn’t::Cut::The::Mustard • Antlers are awesome!!
    10. 10. Extensions! • Catalyst is all about customisation. • Moose Roles are much better than multiple inheritance. • Catalyst without CatalystX == perl5 without CPAN - not so useful. • Getting (even) more extensible == big win.
    11. 11. Moose • Attributes (automatically filled from config) • Type constraints (config validation) • Method modifiers • Powerful delegation • Did I mention roles?
    12. 12. Component attributes • Models/Views/Controllers can require attributes (with types). • This data is supplied from config • Access it as $self->attribute • YES - you could do this before!
    13. 13. Component attributes
    14. 14. Delegation • Attributes and the ‘handles’ feature are as powerful, if not more powerful than roles. • Delegation is often better than inheritance or composition • Delegate all of the methods required in an ‘interface’ role
    15. 15. Delegation
    16. 16. Roles Roles Roles • Application class roles • Controller roles (with method attributes) • Request / Response roles • Action roles • CPAN modules to help with most of these. • Prior art to steal!
    17. 17. Method modifiers • Run code before / after methods, or wrap them with around. • Composable
    18. 18. Method modifiers
    19. 19. Another example
    20. 20. App class roles • Things which used to be plugins can now be roles. • Affect things application wide as they change the $c object. • Useful, but don’t make a god object!
    21. 21. App class roles
    22. 22. New CPAN shiny! • Catalyst::Controller::ActionRole • CatalystX::RoleApplicator • MooseX::MethodAttributes::Role • CatalystX::Components::Traits • Catayst::Traitfor::XXX::YYY
    23. 23. Action Roles • Everyone has seen :ActionClass(‘RenderView’) • You can only have 1 ActionClass • This sucks • Catalyst::Controller::ActionRole gives you :Does(‘ActionRoleName’) • (You don’t really need action classes at all)
    24. 24. Catalyst::Controller::ActionRole
    25. 25. CatalystX::RoleApplicator • Use it in your app to apply roles to Request/Response/Engine/Dispatcher etc • Use it in your components/plugins rather than monkey patching or subclassing.
    26. 26. CatalystX::RoleApplicator
    27. 27. MooseX::MethodAttributes::Role • Controller actions can be in roles. • Use for common path end-points (E.g. CRUD) • Use for common controller functionality
    28. 28. MooseX::MethodAttributes::Role
    29. 29. MooseX::MethodAttributes::Role
    30. 30. CatalystX::Components::Traits • Apply (or remove) roles for your application components with config. • E.g. Change ACLs applied in different environments.
    31. 31. CatalystX::Component:
    32. 32. Catalyst::TraitFor::XXX:YYY • CatalystX::SimpleLogin::TraitFor::Controller::Login::WithRedirect • Catalyst::TraitFor::Model::DBIC::Schema::Replicated • Catalyst::TraitFor::Controller::DBIC::DoesPaging • Don’t have to use CatalystX::Component::Traits - just roles, with is fine if you don’t need to set them via config..
    33. 33. That’s what we did this year!
    34. 34. This week • I’m pleased to announce Catalyst-Runtime 5.80015 and Catalyst-Devel 1.22 • New scripts system from the Google Summer of code. • Moose ‘native’ application generation
    35. 35. The future • More docs (yes, the tutorial still needs updating) • More deprecations (sorry!) • Continual improvement of the 5.80XXX series. • Core features - Action roles? Unicode handling? • 5.81 - App / ctx split - branch underway
    36. 36. Thanks Tomas Doran (t0m) <bobtfish@bobtfish.net> #catalyst
    37. 37. Redux • Sorry, I was lieing. • I haven’t finished.
    38. 38. U R DOIN IT RONG • I’ve just shown off lots of fancy tricks. • This DOES NOT MEAN you use only those. • This DOES NOT MEAN all your logic goes in Catalyst, especially not in controllers.
    39. 39. Beware your app getting too fat
    40. 40. CATALYST IS JUST GLUE • ALL of your business logic should exist OUTSIDE CATALYST • If you’re doing heavy lifting, it should happen outside your web application process. • Your availability being AT BEST that of remote services is a bad world.
    41. 41. This does mean • You develop independent components using Moose / Roles / etc • You tie these into Catalyst as models with a thin layer of glue. • You reuse common workflows in Catalyst between your apps
    42. 42. Obligatory pony
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×