문제

When running under mod_perl Cwd's getcwd returns / When using Mojolicious, I can simply put $self->app->home in any controller to determine the absolute path to the base directory in which the application runs.

Is there something similar in Catalyst?

Regards, ldx

도움이 되었습니까?

해결책

Catalyst has $c->path_to( 'something' ), so you can directly ask it to give you a path to a file or resource.

Alternatively, you could use $c->config->{ home } to get your root directory. But that seems a bit hackish and is not guaranteed to work with the next release of Catalyst.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top