Michael W has asked for the wisdom of the Perl Monks concerning the following question:

In the middle of server upgrade everything worked just fine on the other server, xlsx.pm module was installed. They corrected the permission but i am still getting the following error: Can't call method "add_worksheet", any one have any pointers to point me in the right directions, is there a module missing?

Replies are listed 'Best First'.
Re: Issues with XLSX.pm,
by choroba (Cardinal) on Dec 14, 2021 at 19:20 UTC
    Please, provide more information.

    There's no xlsx nor XLSX on CPAN. What module are you talking about?

    Show the exact error message, show the code that causes the error. How is the object created?

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re: Issues with XLSX.pm,
by Tux (Canon) on Dec 14, 2021 at 21:56 UTC
Re: Issues with XLSX.pm,
by swl (Prior) on Dec 14, 2021 at 21:27 UTC

    I presume you are referring to Spreadsheet::XLSX? Is it properly installed? There should be additional pm files under the XLSX dir with the pm file.

    However, the error suggests you are not using a Spreadsheet::XLSX object when calling the add_worksheet method.

    There are very limited details in your post so it is hard to provide anything but guesswork. Could you please provide an SSCCE?

      However, the error suggests you are not using a Spreadsheet::XLSX object when calling the add_worksheet method. 

      Which can mean (EDIT: among other things, see Re: Issues with XLSX.pm, in this node by Anonymous Monk) that he does not check if the call to create the object was successful:

      my $excel = Spreadsheet::XLSX->new('test.xlsx', $converter); die "failed to create" unless defined $excel;

      It's likely that instantiation failed because an XS module was not re-compiled re: In the middle of server upgrade because nobody told it to or simply failed.

      PS. I would like to see more error checking in Synopses, just for these cases. People just copy-paste that code without too much pondering.

      bw, bliako

Re: Issues with XLSX.pm,
by Anonymous Monk on Dec 15, 2021 at 14:27 UTC

    There are three diagnostics Can't call method, to wit:

    • Can't call method "%s" on an undefined value
    • Can't call method "%s" on unblessed reference
    • Can't call method "%s" without a package or object reference

    Which did you get? The first is most common in my experience, and is usually caused by the object creation failing. But this is just a guess. You would get better help if you gave us more to work with than "I got this error message. Why?"