On 24 Feb 2010, at 15:33, Stuart Watt wrote:
Does anybody know if there any very good reason why the fastcgi.pl
(and other) scripts move the application's lib folder to the front
of @INC even if it is already in @INC but not at the front?
No.
I've just noticed that my carefully constructed path is being
trampled. I depend on occasionally overriding the main application's
lib folder with site-specific stuff, and I cannot do that with the
current scripts.
This is a workaround until we get certain old parts of the app
ported to Moose, but would it not be more appropriate to only add
the library on @INC if it is not there already.
The line concerned seems to be in ScriptRunner.pm
lib->import(File::Spec->catdir($FindBin::Bin, '..', 'lib'));
Would this be better along the lines of:
my $path = File::Spec->catdir($FindBin::Bin, '..', 'lib');
unless (grep { $path eq File::Spec->rel2abs($_) } @INC) {
lib->import($path);
}
This is not tested, but seems the kind of intent needed. Any
thoughts, feedback, alternative solutions welcome.
Looks totally reasonable to me.
Can you follow up with a patch which makes a change like the above and
adds some tests (as otherwise someone will later 'simplify' it again)..
Cheers
t0m
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/