Menu

#100 template::set_file unexpected behaviour

current_CVS
open
Template (13)
5
2002-08-30
2002-08-30
No

Reported via email by Joe Stewart:

If you call set_file twice with the same handle name
but different
filenames, the second file doesn't get loaded because
loadfile checks for
the existence of the varval and returns without loading
the file.

I was able to work around it by unsetting the varval
and varkey of the
handle before calling set_file. But it seems set_file
should do this if
$this->file[$varname] != $filename.

Discussion

  • Richard Archer

    Richard Archer - 2002-08-30

    Logged In: YES
    user_id=279311

    I imagine that in typical use set_file would only be called
    once per varname, and anything else would be unintended.

    Nevertheless, I can see that if you *do* want to override a
    previous file, the current system makes this inordinately
    difficult.

    How should this change?
    - leave as is with better documentation?
    - blindly overrwrite the filename?
    - throw an error if the same handle is set_file'd twice?
    - ...

    ...R.

     
  • Joe Stewart

    Joe Stewart - 2002-08-31

    Logged In: YES
    user_id=77269

    A little clarification:

    Regarding - blindly overrwrite the filename?

    That is not what I suggested. I only suggested that the
    contents of the file requested to be used in the call to
    set_file be used.

    The call to set_file does change the file to be used
    successfully now. It's just that loadfile checks for the
    variable and if it exists does not grab the contents of the
    new file and instead uses the current content ( old file).

    The behavior of loadfile is otherwise a good thing and don't
    suggest changing it.

    thanks,
    Joe

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.