[html-formfu] FormFu + Catalyst + load_config_file on Apache2
Mario Minati
mario.minati at googlemail.com
Fri Nov 2 23:09:49 GMT 2007
On Thursday 01 November 2007 16:18:26 Carl Franks wrote:
> On 11/10/2007, Mario Minati <mario.minati at googlemail.com> wrote:
> > I've got a problem bringing my app to production.
> >
> > I've a Catalyst app makeing havy use of FormFu with load_config_file and
> > trying to bring it to production on apache2.
> >
> > The forms are automatically loaded via :FormConfig, which works fine.
> > Now inside the form.yml files I load other .yml form configs.
> >
> > And here the problem arises. On my dev machine I'm working with relative
> > pathes (useing the catalyst builtin webserver) under the Catalyst root
> > directory which works fine.
> >
> > But on apache the current working directoy is '/' !!!
> > So my relative pathes doesn't work.
> >
> > Any ideas on how to tell apache to look in a different path???
>
> Did you get anywhere with this?
Better don't ask ;-)
I hacked ObjectUtil::load_config_file:
### original:
for (@filenames) {
croak "file not found: '$_'" if !-f $_;
}
### hack:
my @temp_filenames;
my $base_dir = "/var/www/glue/";
for (@filenames) {
#use Cwd;
#warn "looking for ".$_." in ". getcwd();
if (!-f $_) {
#warn "looking for ".$base_dir.$_." in ". getcwd();
if (!-f $base_dir.$_) {
croak "file not found: '$_'";
}
else {
push @temp_filenames, $base_dir.$_;
}
}
else {
push @temp_filenames, $_;
}
}
@filenames = @temp_filenames;
### end
The idea behind this was to introduce this as configurable path.
> Alternatively, you could expand the config-callback that
> Catalyst::Controller::HTML::FormFu sets, so that it supports expanding
> __path_to()__ in config files, as well as __uri_for()__.
This is probably more elegant.
I think I'll switch to this solution. What about non Catalyst users?
Greets,
Mario
More information about the HTML-FormFu
mailing list