[Catalyst] How to do REST without deserializing uploaded files (PUT)

Hans Dieter Pearcey hdp.perl.catalyst.users at weftsoar.net
Wed Apr 1 06:54:33 BST 2009


On Tue, Mar 31, 2009 at 09:03:15PM -0700, Bruce McKenzie wrote:
> Is there a way to declare some paths as NOT subject to deserialization? The
> reason I ask is that I want it for most everything...just not for a few paths.

Instead of deserializing in begin() (as C::C::REST does for you), this might
work:

  sub deserialize : Chained(/) PathPart('') ActionClass(Deserialize) {}

  sub foo : Chained(deserialize) ActionClass(REST) {}
  sub foo_POST {...} # etc.

  sub bar : ActionClass(REST) {}
  sub bar_PUT {...} # etc.

foo comes from the deserialize action, bar doesn't, so a PUT to /bar won't
trigger deserialization. (note: totally untested.)

In the future, when we all have flying cars, REST and Deserialize will be
action roles, and you can do:

  sub foo : Does(REST) Does(Deserialize) {}
  sub foo_POST {...}

  sub bar : Does(REST) {}
  sub bar_PUT {...}

I'm open to other suggestions.

hdp.



More information about the Catalyst mailing list