Skip Menu |

This queue is for tickets about the AnsibleModule CPAN distribution.

Report information
The Basics
Id: 123055
Status: new
Priority: 0/
Queue: AnsibleModule

People
Owner: Nobody in particular
Requestors: tim [...] timsheahan.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.3
Fixed in: (no value)



Subject: Cannot install AnsibleModule when Mojolicious is version 7.46 (deprecated 'slurp')
On a new system, I found AnsibleModule cannot be installed by cpan due to a failed test. The reported error is: # at t/01_basic.t line 8. # Tried to use 'AnsibleModule'. # Error: "slurp" is not exported by the Mojo::Util module # Can't continue after import errors at /root/.cpan/build/AnsibleModule-0.3-0/blib/lib/AnsibleModule.pm line 15. Inspecting Mojo::Util, 'slurp' is totally gone (as of Mojolicious version 7.46). There is a note that it is deprecated in favor of Mojo::File 'slurp' (an instance method). I was able to make AnsibleModule install by: 1) going to its build folder created by cpan 2) editing lib/AnsibleModule.pm as per following diff: 15c15 < use Mojo::Util qw/slurp/; --- Show quoted text
> use Mojo::File;
35c35,36 < my $args = slurp($ARGV[0]); --- Show quoted text
> my $file = Mojo::File->new($ARGV[0]); > my $args = $file->slurp;
3) running 'make' 4) running 'make test' 5) running 'make install' If slurp is absent from Mojo::File in older versions of Mojolicious, one might cater for all users of AnsibleModule by doing something like the following - 1) pull in both modules: use Mojo::File; use Mojo::Util (); 2) conditionally use whichever module implements slurp my $args; if (Mojo::Util->can('slurp')) { $args = Mojo::Util::slurp($ARGV[0]); } else { my $file = Mojo::File->new($ARGV[0]); $args = $file->slurp; } -HTH Tim Sheahan