I stopped using FindBin a few years back after I was bitten by one of its
issues.
Instead, I use the following block in my perl scripts (not modules) that I
borrowed from some blog or article that I cannot recall...

## Cannot use Find::Bin because script may be invoked as an
## argument to another script, so instead we use __FILE__
use File::Basename qw(dirname fileparse basename);
use File::Spec;
## Add script directory
use lib join('/', File::Spec->splitdir(dirname(__FILE__)));
## Add script directory/lib
use lib join('/', File::Spec->splitdir(dirname(__FILE__)), 'lib');
## Add script directory/../lib
use lib join('/', File::Spec->splitdir(dirname(__FILE__)), '..', 'lib');


This has worked great for me in Linux and Windows.

You might be able to use similar technique to locate your migration files
as long as you know their path relative to your main script.

Hope this helps.


On Tue, Apr 14, 2015 at 11:47 AM, Nacho B <[email protected]> wrote:

> Thank you!, Tekki,
>
> In the Mojolicious script I have hardcoded the lib path and it works!
>
> The only drawback for now is that the relative paths used inside the App
> now must be absolute. For example the path lo load the migrations.sql file.
>
> Maybe I can define multiple places for Mojolicious to search, as I used to
> do with Catalyst and Template Toolkit. If a file isn“t in the main place,
> it searches in other place, like cascading, or something like this.
>
> Regards:
> Nacho B.
>
>
>
> On Tuesday, April 14, 2015 at 12:03:55 PM UTC+2, Tekki wrote:
>>
>> Obviously not the path to 5.20, but the path to your application
>> (TiendasAdmin.pm) is missing. Try to hard-code it in the startup script.
>> Instead of
>> use lib "$FindBin::Bin/../lib";
>> write
>> use lib "/media/psf/w/tiendas/tiendas_admin/lib";
>> (I just guess the content of your script and the path.)
>> If it works define it as an environment variable as it's described in the
>> Redhat link you posted above.
>>
>>
>> Am Montag, 13. April 2015 18:50:16 UTC+2 schrieb Nacho B:
>>>
>>> The error log  from syslog says:Apr 13 18:28:17 foo tiendas_admin:
>>> Can't load application from file 
>>> "/media/psf/w/tiendas/tiendas_admin/script/tiendas_admin":
>>> *Can't find application class* *"TiendasAdmin"* *in* *@INC. (lib *
>>> /home/tester/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1/x86_64-linux
>>> /home/tester/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1
>>> /home/tester/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux
>>> /home/tester/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1 .)
>>>
>>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to