Hi,

Nested includes don't work as you would expect (well, at least they
don't work as *I* expected :).  Given files

/PATH/A
/PATH/DIR/B
/PATH/DIR/C

Say file A includes "DIR/B".  This works fine.

Say file B includes "C".  This works fine when file B is accessed
directly, but fails when it is included in A as above.  Apache::ASP
considers the "current directory" to be /PATH, not /PATH/DIR

This was brought up a few months ago by by Marko Friedeman, and although
Josh said it was supposed to work this way, I would ask that perhaps the
issue could be reconsidered.  I was bitten badly by this while
refactoring a monolithic page into many smaller files using includes.  I
believe the current behaviour is rather counter-intuititve.

As a workaround, I'm using an include wrapper that looks sort of like 
this (irrelevant code excluded):

sub include {
  my $file = shift;
  my $shift = 0;
  if ( $file =~ m(^([^/].*)/[^/]+) ) {
    unshift @{$Response->{asp}{includes_dir}}, "./$1";
    $shift = 1;
  }
  my $ref = $Response->TrapInclude($file, @_);
  shift @{$Response->{asp}{includes_dir}} if $shift;
  $$ref;
}

This lets my code work the way I want, though perhaps a more proper
implementation would consider the "current directory" to be that of the
currently executing include rather than muck about with the includes_dir 
path.

Any thoughts appriciated, even if its just "go away and use Mason if you
want that behaviour".  :)

-- 
_ivan
Open-source billing, ticketing and provisioning
for ISPs, VoIP providers and online businesses
http://www.sisd.com/freeside/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to