[jifty-devel] Dispatcher: difficulties with it beyond the doco and example 1-liners

Steve H s_t_e_v_e_h at hotmail.com
Sun Oct 14 10:35:15 EDT 2007


I'm still having difficulty with Jifty design. Seems as though I should be using the Dispatcher to architect and manage the flow between the various windows/fragments. Please correct me if I'm making wrong assumptions and/or help with some detail.  There are bits of it that don't appear to function as I'd have anticipated.
I figured on having Dispatcher code that would leverage 'before', 'on', etc code blocks, within which I'd peek at the 'request' and any submit vars for context and then 'show' the various fragments that were relevant... for example a Search form from one fragment, when submitted, might rewrite the search entry field/fragment and then display the searched/found summary data into a different fragment that uses a Collection/pager;  clicking a link on one of those summary lines in that fragment could a different fragment to update showing details.
So I follow what seems to be implied by the docs and examples...  firstly outputting debug from the Dispatcher to verify I'd trapped the correct Jifty->web->request->path  ... then I wanted to ensure the correct context, so I tried a get('Srch') .. which Data::Dumper indicated was undef.  ...so I had a look at the Dispatcher.pm module, and it indicated the get() was a call to Jifty->web->request->argument ... so I called that, and similarly got undef.  I do however see the Srch arg buried in the data dumped from Jifty->web->request->arguments 
>From debug statements in the Dispatcher, per:
before '*' => run {
        print STDERR "DBG: ...

DBG: REQUEST: before *  get Srch: $VAR1 = \undef;
DBG: REQUEST: before *  request->argument(Srch): $VAR1 = \undef;
DBG: REQUEST: before *  request->arguments: $VAR1 = [
            'J:A-auto-3c0293afb5c946d01eb6ca2b4df038f3-1' => 'COS::Action::vsr_main',
            '' => 'Search',
            'region' => bless( {
                                 'default_path' => '/fragments/vsr/im_pgr',
                                 'parent' => undef,
                                 'default_arguments' => {
                                                          'Launch' => 1
                                 'name' => 'vsr/im_pgr',
                                 'force_arguments' => {},
                                 'qualified_name' => 'vsr/im_pgr',
                                 'force_path' => undef,
                                 'region_wrapper' => 1,
                                 'arguments' => {}
                               }, 'Jifty::Web::PageRegion' ),
            'J:A:F-Srch-auto-3c0293afb5c946d01eb6ca2b4df038f3-1' => 'HP',
            'Launch' => 1

This is all pretty confusing.  The more I look at it, the more cross-eyed I get, and possibly digging myself deeper into the wrong hole.  What seems to be the way to do things per the doco, doesn't give me the expected/desired results, making me wonder whether I'm encountering:   a) the wrong approach in the first place,  b) misinterpreted behaviour/expectation,  c) broken code,  d) on it goes.

(presuming the Dispatcher is the correct place for me to be managing the flow within the overall app)... pretty simply what I was trying to do was to watch what data was presenting itself at the Dispatcher (from my various submits and links, and use the appropriate data to manage what fragments got called.  Can someone please let me know how I'd best do that.


It's simple! Sell your car for just $30 at CarPoint.com.au

More information about the jifty-devel mailing list