I have a controller subclassed from Catalyst::Controller::REST.

Most of my methods are happily ActionClass('REST')'d, but I have one where I want a file to be uploaded and NOT deserialized. Even if I did not include the ActionClass attribute, I would get a complaint about no deserialization method for the upload.

I couldn't figure out how to do it, so I backed out the RESTness from the controller and implemented a "straight" put method:

sub xxx :Local :Args(0) {
    my ( $self, $c ) = @_;

    return if $c->request->method ne 'PUT';

    my $filecontents = '';

    my ($fh) = $c->request->body;
    while ( my $line = <$fh> )
    {
        $filecontents .= $line;
    }

.... do something with it ...

    $c->response->status('202');
    $c->response->body( "stuff accepted" );

}

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.

(Incidentally, am I doing the right thing to get the file contents? It seems to work and I can't find any other doc/pointers)

FWIW I was using curl to test it:

curl -T somefile  http://localhost:3000/demo/xxx

Thanks very much!

Bruce

---
Bruce McKenzie
bru...@dynamicrange.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/

Reply via email to