[ic] Interesting Failure Reading Scratch Variables from Session

John C. Beima interchange-users@icdevgroup.org
Thu Jul 18 12:34:01 2002


Kevin Walsh wrote:
> 
> > >
> > > BTW, this can easily be tested.  Using the following data on your ic
> > > server,
> > > retrieve with a newer browser and an older browser if you have it the
> > > following files in this order:
> > >
> > > test_putvar.html
> > > test_getvar.html  (should show ABC)
> > > test_putvar_noimage.html
> > > test_getvar.html  (should fail to show DEF on newer browser because the
> > > session switched)
> > >
> > >
> > > test_putvar.html:
> > > ---------------------------------------------------
> > > <html>
> > > <body>
> > >
> > > [set whatever]ABC[/set]
> > > <p>
> > > This is a test.
> > > </p>
> > >
> > > </body>
> > > </html>
> > > ---------------------------------------------------
> > >
> > > test_getvar.html:
> > > ---------------------------------------------------
> > > <html>
> > > <body>
> > >
> > > <p>
> > > This is a test - retrieve the value:
> > > [perl]
> > > $Scratch->{whatever};
> > > [/perl]
> > > </p>
> > >
> > > </body>
> > > </html>
> > > ---------------------------------------------------
> > >
> > > test_putvar_noimage.html:
> > > ---------------------------------------------------
> > > <html>
> > > <body>
> > >
> > > [set whatever]DEF[/set]
> > > <IMG SRC="/im_not_here.jpg">
> > > <p>
> > > This is a test.
> > > </p>
> > >
> > > </body>
> > > </html>
> > >
> > Actually your test shouldn't show ABC... It is done wrong...
> >
> > [set test]ABC[/set]
> >
> > [perl]
> >   my $out = '';
> >   $out = $Scratch->{test};
> >   return $out;
> > [/perl]
> >
> > Would return an output of you scratch variable. Not what you are doing.
> >
> I can't see anything that's done wrong there.  That 'corrected' Perl
> block does the same job as the original test code, but with a couple
> of extra lines of code and an unnecessary variable.  Of course, using
> [perl] in that context is an overkill anyway, but it's just a test
> after all.

What is wrong with the original Perl tag is the Perl tag dose not return
anything unless it is told to return it. His use of the tag is wrong. So
unless something stupid has been done to the perl tag like the [calcno] tag,
the return should be there.

A shorter version could of been:

[perl]
  return $Scratch->{test};
[/perl]

But that would be a complete waste of using the Perl tag. Since that does the
same thing as just putting a [scracth test] tag in the middle of you page.


> Back to the reported problem:  As far as I can see, the only thing
> that would prevent the session being passed from one page to the next
> would be if cookies were disabled and the tester typed in the page
> names, such as "test_getvar.html", in turn and with no session ID.
> 
> I've not been able to recreate the session problem using the above
> code with cookies switched on.  With cookies switched off, a new
> session is created for every page, as would be expected.  Images,
> broken or otherwise, can't have any effect on Interchange sessions
> as they shouldn't be served by Interchange at all.
> 
> Test results:
> 
>   test_putvar.html         - This is a test.
>   test_getvar.html         - This is a test - retrieve the value: ABC
>   test_putvar_noimage.html - This is a test.
>   test_getvar.html         - This is a test - retrieve the value: DEF
> 
> Browsers:
> 
>   Opera 6.01
>   Internet Explorer 5.5
>   Netscape 6.1
>   Mozilla 1.0
> 
> I'm reasonably sure that at least some of those browsers are considered
> to be new.
> 
> --
>    _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
>   _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
>  _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
> _/   _/  _/_/_/_/      _/    _/_/_/  _/    _/
> 
> _______________________________________________
> interchange-users mailing list
> interchange-users@icdevgroup.org
> http://www.icdevgroup.org/mailman/listinfo/interchange-users