"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 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, consider adding it like in this >> example: https://metacpan.org/pod/Mojolicious::Guides::Growing#Script >> >> # add directory script is in >> use lib curfile->dirname->to_string; >> >> -Dan >> >> On Wed, Apr 28, 2021 at 8:52 PM llaro...@gmail.com <llaro...@gmail.com> >> wrote: >> >>> 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[63913]: Can't load application >>> from file "/srv/ccdapi/VM01/PROD/v1/ccdapi.pl": Can't locate Methods/ >>> cmtsc.pm in @INC (you may need to install the Methods::cmtsc module...x >>> /srv/ccdapi/. >>> Apr 28 20:10:45 vl-vm-sr824.lb ccdapi[63913]: BEGIN failed--compilation >>> aborted at /srv/ccdapi/VM01/PROD/v1/ccdapi.pl line 10. >>> Apr 28 20:10:45 vl-vm-sr824.lb ccdapi[63913]: Compilation failed in >>> require at (eval 80) line 1. >>> Apr 28 20:10:45 vl-vm-sr824.lb systemd[1]: ccdapi.service: main process >>> exited, code=exited, status=2/INVALIDARGUMENT >>> >>> They are in the path of my application. I tried "use lib >>> qw(/path/Methods/) but it failed too >>> >>> I tried a list in environement separated by ";" but it failed too. >>> >>> What am I missing ? >>> >>> On Wednesday, 28 April 2021 at 17:33:23 UTC-4 gri...@gmail.com wrote: >>> >>>> 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 <llaro...@gmail.com> >>>> wrote: >>>> >>>>> 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 >>>>> Restart=always >>>>> SyslogIdentifier=ccdapi >>>>> PIDFile=/home/srv/ccdapi/v1/etc/ccdapi.pid >>>>> ExecStart=/srv/ccdapi/.perlbrew/libs/perl-5.24.0@ccdapi/bin/hypnotoad >>>>> /srv/ccdapi/VM01/PROD/v1/ccdapi.pl -f >>>>> ExecStop=/srv/ccdapi/.perlbrew/libs/perl-5.24.0@ccdapi/bin/hypnotoad >>>>> -s /srv/ccdapi/VM01/PROD/v1/ccdapi.pl >>>>> ExecReload=/srv/ccdapi/.perlbrew/libs/perl-5.24.0@ccdapi/bin/hypnotoad >>>>> /srv/ccdapi/VM01/PROD/v1/ccdapi.pl >>>>> KillMode=process >>>>> WorkingDirectory=/srv/ccdapi >>>>> >>>>> [Install] >>>>> WantedBy=multi.user.target >>>>> >>>>> When I try to start the service I get >>>>> >>>>> -- Unit ccdapi.service has begun starting up. >>>>> Apr 28 16:41:48 vl-vm-sr824.lb.videotron.ca ccdapi[63200]: Can't >>>>> locate Mojo/Base.pm in @INC (you may need to install the Mojo::Base >>>>> module) >>>>> (@INC contains: >>>>> /srv/ccdapi/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/x86_64-linux >>>>> >>>>> Apr 28 16:41:48 vl-vm-sr824.lb.videotron.ca ccdapi[63200]: BEGIN >>>>> failed--compilation aborted at >>>>> /srv/ccdapi/.perlbrew/libs/perl-5.24.0@ccdapi/bin/hypnotoad line 2. >>>>> Apr 28 16:41:48 vl-vm-sr824.lb.videotron.ca systemd[1]: >>>>> ccdapi.service: main process exited, code=exited, status=2/INVALIDARGUMENT >>>>> Apr 28 16:41:48 vl-vm-sr824.lb.videotron.ca ccdapi[63201]: Can't >>>>> locate Mojo/Base.pm in @INC (you may need to install the Mojo::Base >>>>> module) >>>>> (@INC contains: >>>>> /srv/ccdapi/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/x86_64-linux >>>>> >>>>> Apr 28 16:41:48 vl-vm-sr824.lb.videotron.ca ccdapi[63201]: BEGIN >>>>> failed--compilation aborted at >>>>> /srv/ccdapi/.perlbrew/libs/perl-5.24.0@ccdapi/bin/hypnotoad line 2. >>>>> Apr 28 16:41:48 vl-vm-sr824.lb.videotron.ca systemd[1]: >>>>> ccdapi.service: control process exited, code=exited status=2 >>>>> Apr 28 16:41:48 vl-vm-sr824.lb.videotron.ca systemd[1]: Unit >>>>> ccdapi.service entered failed state. >>>>> Apr 28 16:41:48 vl-vm-sr824.lb.videotron.ca systemd[1]: >>>>> ccdapi.service failed. >>>>> Apr 28 16:41:48 vl-vm-sr824.lb.videotron.ca systemd[1]: >>>>> ccdapi.service holdoff time over, scheduling restart. >>>>> Apr 28 16:41:48 vl-vm-sr824.lb.videotron.ca systemd[1]: start request >>>>> repeated too quickly for ccdapi.service >>>>> Apr 28 16:41:48 vl-vm-sr824.lb.videotron.ca systemd[1]: Failed to >>>>> start MY CCDAPI LAB. >>>>> -- Subject: Unit ccdapi.service has failed >>>>> -- Defined-By: systemd >>>>> >>>>> >>>>> So I've double-checked Mojo::Base exists ... >>>>> >>>>> [ccdapi@vl-vm-sr824 ~]$ find . | grep 'Mojo.*Base.pm' >>>>> ./VM01/PROD/perl5/lib/perl5/Mojo/Base.pm >>>>> ./VM01/perl5/lib/perl5/Mojo/Base.pm >>>>> ./temp/report/bin/lib/Mojo/Base.pm >>>>> ./.cpan/build/Mojolicious-7.37-yGj97y/blib/lib/Mojo/Base.pm >>>>> ./.cpan/build/Mojolicious-7.37-yGj97y/lib/Mojo/Base.pm >>>>> ./.perlbrew/libs/perl-5.24.0@ccdapi/lib/perl5/Mojo/Base.pm >>>>> ./perl5/lib/perl5/Mojo/Base.pm >>>>> >>>>> >>>>> 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; >>>>> >>>>> >>>>> But still it won't start. Can anyone help please ? I'm aware this >>>>> seems like a general Perl problem though but not so sure what am I doing >>>>> wrong or is there some sort of bug ?! >>>>> >>>>> Cheers, >>>>> Luc >>>>> >>>>> -- >>>>> 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 mojolicious...@googlegroups.com. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/mojolicious/af5527ae-18eb-49ae-91b9-37a1d7fb7a43n%40googlegroups.com >>>>> >>>>> <https://groups.google.com/d/msgid/mojolicious/af5527ae-18eb-49ae-91b9-37a1d7fb7a43n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> -- >>> 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 mojolicious...@googlegroups.com. >>> >> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/mojolicious/9d757845-faae-4d07-8678-fa7e9c92f1c4n%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/mojolicious/9d757845-faae-4d07-8678-fa7e9c92f1c4n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- 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 mojolicious+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/mojolicious/716a05eb-81d9-4564-992d-e6303f403ee3n%40googlegroups.com.