Is it possible to create route classes in a base module and then have all 
derived instance routes inherit from the parent class? Kinda like so --

    use Dance;
    
    get '/' => sub {
        my $name = param 'name';
        return "name is required for all GETs" unless $name;
    };
    
    
    post '/' => sub {
        my $id = param 'id';
        return "id is required for all POSTs" unless $id;
    };
    
    ----
    use MyDance;
    use base 'Dance';
    
    get '/' => sub {
        my $foo = param 'foo';
        .. do something with $foo and $name but only if $name is defined ..
    };


For bonus points, it would be nice to have base route classes only for routes 
that end with a '.:format'. For example, only for routes that request 
'resource.json'


Is the above possible?


--
Puneet Kishor
_______________________________________________
Dancer-users mailing list
[email protected]
http://www.backup-manager.org/cgi-bin/listinfo/dancer-users

Reply via email to