[ic] Open and 'run' a page from within another page? -- even more info

Kevin Walsh interchange-users@icdevgroup.org
Thu Nov 7 12:31:01 2002


marc.brevoort [marc.brevoort@armazemdedados.com] wrote:
> >
> > You should find that it all works.  If it
> > doesn't then perhaps there's something wrong with the contents of your
> > file.
> >
> I overlooked the global log file, this file says 'Attempt to call perl from 
> within Safe.' which explains why the [calc] tag is executed properly while 
> the [perl] tag doesn't work. 
> 
[calc] is treated the same as [perl] as far as the Safe-mode rules are
concerned.  The error message was probably referring to an attempt to
call a subroutine that you should not be attempting to call.

>
> If I open the page as regular HTML, interchange runs in normal mode and all 
> is cool, but if it is included from another page, the include tag decides 
> that it should run in Safe mode now, and interchange no longer accepts [perl] 
> tags. This breaks both my code and the header template. 
> 
> If I use [calc] tags instead of [perl] tags, my code breaks as well (Safe: 
> Undefined subroutine &Vend::Interpolate::some_sub_i_defined), and the header 
> template will still be broken too. It's said that "Using AllowGlobal is never 
> necessary", any clues how to solve this the 'right' way?
> 
I've just run the following tests:

catalog.cfg file:

    Sub <<EOS
    sub testsub {
        return 'success';
    }
    EOS

new file called 'testfile':

    inside include subs=0: [perl] testsub(); [/perl]<br>
    inside include subs=1: [perl subs=1] testsub(); [/perl]<br>
    Test calc: [calc] return 'success'; [/calc]<br>
    Test perl: [perl] return 'success'; [/perl]<br>

new page called test.html:

    outside include subs=0: [perl] testsub(); [/perl]<br>
    outside include subs=1: [perl subs=1] testsub(); [/perl]<br>
    [include testfile]

Results:

    outside include subs=0:
    outside include subs=1: success
    inside include subs=0: success
    inside include subs=1: success
    Test calc: success
    Test perl: success

No drama, although I was surprised that the subs=1 wasn't necessary
when [perl] was called from within [include].

Try the above tests on your system to see what happens.  I imagine that
the problem will be traced to your &Vend::Interpolate::blahblah() calls.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/