Re: [Mojolicious] Systemd "Can't locate Mojo/Base.pm in @INC"

2021-04-30 Thread Dan Book
The current working directory in Perl should be retrieved using Cwd, not $ENV{PWD}. Regardless, putting paths in your program based on CWD is a bug, since the program could be run with any CWD and that should not change its behavior. I wrote a similar module to the FindBin interface using the same

Re: [Mojolicious] Systemd "Can't locate Mojo/Base.pm in @INC"

2021-04-30 Thread llaro...@gmail.com
Thanks to both of you, I managed to get past loading modules while starting the service from systemd. Now there is another bug regarding relative paths and I wonder how to solve it, it seems lib::relative might not do the trick my $homedir = $ENV{'HOME'}; my $cwd = $ENV{'PWD'}; my $log = Mojo::L

Re: [Mojolicious] Systemd "Can't locate Mojo/Base.pm in @INC"

2021-04-29 Thread Dmitry L.
Here is my Service with perlbrew [Service] Type=forking User=backend Group=backend WorkingDirectory=/home/backend/app Environment=PERLBREW_ROOT=/home/backend/perl5/perlbrew ExecStart=/home/backend/perl5/perlbrew/bin/perlbrew exec -q --with perl-5.28.0 hypnotoad /home/backend/app/app_backend.pl ...

Re: [Mojolicious] Systemd "Can't locate Mojo/Base.pm in @INC"

2021-04-29 Thread Dan Book
Yes, or install and use https://metacpan.org/pod/lib::relative On Thu, Apr 29, 2021 at 1:55 PM llaro...@gmail.com wrote: > "curfile" is not exported by the Mojo::File module > > should I update Mojolicious ? > > On Thursday, 29 April 2021 at 09:45:05 UTC-4 llaro...@gmail.com wrote: > >> Thanks,

Re: [Mojolicious] Systemd "Can't locate Mojo/Base.pm in @INC"

2021-04-29 Thread llaro...@gmail.com
"curfile" is not exported by the Mojo::File module should I update Mojolicious ? On Thursday, 29 April 2021 at 09:45:05 UTC-4 llaro...@gmail.com wrote: > Thanks, I'll give it a try today ! Looks like FindBin but Mojolicious' way > > On Wednesday, 28 April 2021 at 20:55:21 UTC-4 gri...@gmail.com

Re: [Mojolicious] Systemd "Can't locate Mojo/Base.pm in @INC"

2021-04-29 Thread llaro...@gmail.com
Thanks, I'll give it a try today ! Looks like FindBin but Mojolicious' way On Wednesday, 28 April 2021 at 20:55:21 UTC-4 gri...@gmail.com wrote: > You have to add the path that contains the Methods directory, not the > Methods directory itself. > > If it's deployed relative to your script, consi

Re: [Mojolicious] Systemd "Can't locate Mojo/Base.pm in @INC"

2021-04-28 Thread Dan Book
You have to add the path that contains the Methods directory, not the Methods directory itself. If it's deployed relative to your script, consider adding it like in this example: https://metacpan.org/pod/Mojolicious::Guides::Growing#Script # add directory script is in use lib curfile->dir

Re: [Mojolicious] Systemd "Can't locate Mojo/Base.pm in @INC"

2021-04-28 Thread llaro...@gmail.com
I removed the first line and added the "Environment" entry in Service section, now I have a new issue ... home made modules Apr 28 20:10:45 vl-vm-sr824.lb systemd[1]: Started MY CCDAPI LAB. Apr 28 20:10:45 vl-vm-sr824.lb systemd[1]: Starting MY CCDAPI LAB... Apr 28 20:10:45 vl-vm-sr824.lb ccdapi[

Re: [Mojolicious] Systemd "Can't locate Mojo/Base.pm in @INC"

2021-04-28 Thread Dan Book
On Wed, Apr 28, 2021 at 5:28 PM llaro...@gmail.com wrote: > And I have added the path with "use lib qw(/my/path/) such as > > [ccdapi@vl-vm-sr824 ~]$ head ./VM01/PROD/v1/ccdapi.pl > use lib qw(/srv/ccdapi/perl5/lib/perl5/); > use Mojolicious::Lite; > Make sure to remove this. The local::lib you

Re: [Mojolicious] Systemd "Can't locate Mojo/Base.pm in @INC"

2021-04-28 Thread Dan Book
You have installed it to a local::lib in the perlbrew. The systemd service won't have that active. You could fix it by adding to the [Service] block: Environment="PERL5LIB=/srv/ccdapi/.perlbrew/libs/perl-5.24.0@ccdapi /lib/perl5" On Wed, Apr 28, 2021 at 5:28 PM llaro...@gmail.com wrote: > Hi, I

[Mojolicious] Systemd "Can't locate Mojo/Base.pm in @INC"

2021-04-28 Thread llaro...@gmail.com
Hi, I'm trying to register my hypnotoad daemon as a service in cat /lib/systemd/system/ccdapi.service [Unit] Description=MY CCDAPI LAB Requires=network.target After=network.target User=ccdapi Group=ccdapi # put here other service requirements [Service] User=ccdapi Group=ccdapi Type=simple R