Hi All, After Pedro's feedback, I extended the Mason::Plugin::SliceFilter so it can be easily adapted to any framework's parameter getting mechanism.
It's on it's way to the CPAN, and it's also here: https://github.com/jeteve/Mason-Plugin-SliceFilter/tree/v0.02 One great thing about Mason is that we can easily curry filters, and that's exactly how to solve this problem in a general way: <%class> ## Replace scalar($c->req->param(shift)) by whatever your framework exposes as a parameter getting method. has 'MySlice' => ( default => sub{ my $self = shift; return sub{ my (%args) = @_; return $self->Slice(get_slice => sub{ scalar($c->req->param(shift)); } , %args ); }; } ); </%class> % ## Then later: % ## Notice the -> arrow % $.MySlice->(slice_id => 'aslice' ){{ SliceA % }} Hope it'll make your life (a bit) easier :) Cheers, Jerome. On 23 August 2013 17:20, Pedro Melo <m...@simplicidade.org> wrote: > Hi, > > the same is true for Dancer2. I can manually give the slice param to each > template call and it will be passed to Mason run(). > > Bye, > > > On Fri, Aug 23, 2013 at 4:41 PM, Jérôme Étévé <jerome.et...@gmail.com> > wrote: >> >> Hi! >> >> Thanks for that! Looking forward to giving a go at your Dancer2/Mason2 >> glue :) >> >> Apparently with Dancer (1), you just have to give slice => param >> 'slice' to the 'template' call to have 'slice' going to the Mason2 >> 'run' method. >> >> Will give it a go. That'll be a good occasion to try Dancer :) >> >> Cheers, >> >> J. >> >> >> On 23 August 2013 16:17, Pedro Melo <m...@simplicidade.org> wrote: >> > Hi, >> > >> > on Dancer2, with the Mason plugin I'm using (and will soon release to >> > CPAN) >> > all parameters appear on the mason site as a 'params' param. That's not >> > what >> > Mason expects but it is consistent with the other Dancer2 template >> > plugins. >> > >> > You can manually at the Dancer2 controller level move a param slice into >> > a >> > proper Mason parameter though, but it is manual, per route. >> > >> > So out of the box it will not work. A workaround could be to add >> > something >> > like this to Base.mp: >> > >> > method slice () { $self->params->{slice} } >> > >> > Need to re-check Poet, my memory is foggier on that one. >> > >> > Bye, >> > >> > >> > On Fri, Aug 23, 2013 at 3:19 PM, Jérôme Étévé <jerome.et...@gmail.com> >> > wrote: >> >> >> >> Hi, >> >> >> >> Thanks! >> >> >> >> I read that you use Dancer and Poet as mvc's framework. Do you mind >> >> giving a go at >> >> SliceFilter with them and see if/how the '?slice=whatever' parameter >> >> is (or is not) transfered to mason? >> >> >> >> I'll add a 'Thanks' section to the next release :) >> >> >> >> Hope it's not too much bother. >> >> >> >> Cheers! >> >> >> >> Jerome. >> >> >> >> >> >> On 23 August 2013 14:33, Pedro Melo <m...@simplicidade.org> wrote: >> >> > Nice…. >> >> > >> >> > >> >> > On Fri, Aug 23, 2013 at 11:52 AM, Jérôme Étévé >> >> > <jerome.et...@gmail.com> >> >> > wrote: >> >> >> >> >> >> Hi all, >> >> >> >> >> >> I have released a new Mason filter plugin: >> >> >> https://metacpan.org/module/Mason::Plugin::SliceFilter >> >> >> >> >> >> It doesn't depend on any funky stuff. Just plain Mason dependencies >> >> >> like other popular plugins. >> >> >> >> >> >> What it does is quite simple: >> >> >> >> >> >> It outputs only slices of your page content on demand, according to >> >> >> a >> >> >> URL >> >> >> param. >> >> >> >> >> >> I use it to dynamically populate my pages in ajax with slices of >> >> >> fresh >> >> >> content, but there's probably other uses for it. >> >> >> >> >> >> Any feedback is welcome :) >> >> >> >> >> >> Cheers, >> >> >> >> >> >> Jerome. >> >> >> >> >> >> -- >> >> >> Jerome Eteve >> >> >> +44(0)7738864546 >> >> >> http://www.eteve.net/ >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> >> >> Introducing Performance Central, a new site from SourceForge and >> >> >> AppDynamics. Performance Central is your source for news, insights, >> >> >> analysis and resources for efficient Application Performance >> >> >> Management. >> >> >> Visit us today! >> >> >> >> >> >> >> >> >> >> >> >> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk >> >> >> _______________________________________________ >> >> >> Mason-users mailing list >> >> >> Mason-users@lists.sourceforge.net >> >> >> https://lists.sourceforge.net/lists/listinfo/mason-users >> >> > >> >> > >> >> > >> >> > >> >> > -- >> >> > Pedro Melo >> >> > @pedromelo >> >> > http://www.simplicidade.org/ >> >> > xmpp:m...@simplicidade.org >> >> > mailto:m...@simplicidade.org >> >> >> >> >> >> >> >> -- >> >> Jerome Eteve >> >> +44(0)7738864546 >> >> http://www.eteve.net/ >> > >> > >> > >> > >> > -- >> > Pedro Melo >> > @pedromelo >> > http://www.simplicidade.org/ >> > xmpp:m...@simplicidade.org >> > mailto:m...@simplicidade.org >> >> >> >> -- >> Jerome Eteve >> +44(0)7738864546 >> http://www.eteve.net/ > > > > > -- > Pedro Melo > @pedromelo > http://www.simplicidade.org/ > xmpp:m...@simplicidade.org > mailto:m...@simplicidade.org -- Jerome Eteve +44(0)7738864546 http://www.eteve.net/ ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users