in reply to random undefined sub error

The first thing to check is the file /git_scripts/lib/gitadm_shell_commands.pm. Does it exist and contain the definition of select_storage? Is it really loaded by the script?
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: random undefined sub error
by LanX (Saint) on Apr 10, 2013 at 14:03 UTC
    > Is it really loaded by the script?

    Well, according to his code, importer is never called since he explicitly uses empty lists after use ...

    > > use gitadm_shell_commands();

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      importer is never called
      It depends on how far the modules follow the common practices (look at their names). Try:

      script.pl:

      #!/usr/bin/perl use warnings; use strict; use Ugly (); puke('Where does it come from?');

      Ugly.pm:

      package Ugly; use warnings; use strict; my $package = (caller)[0]; sub puke { warn @_; } { no strict 'refs'; *{$package . '::puke'} = \&puke; } __PACKAGE__
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
        Sure, I deliberately decided to ignore those dirty possibility. =)

        There are to many ways to pollute the namespace to be listed, at the end the OP should clarify how his code works.

        From the sparse information provided, we can't tell much.

        And he is redefining a sub with the same name, so I suppose nothing should be imported.

        Cheers Rolf

        ( addicted to the Perl Programming Language)

Re^2: random undefined sub error
by jerick1976 (Initiate) on Apr 10, 2013 at 14:47 UTC
    It does exist. It is linked in from an NFS mount point (NAS volume). sub select_storage does indeed exist within the gitadm_shell_commands.pm file. I have tried inserting a require statement to check to see if the module was loaded and did not receive an error. The addition had no affect on the error. Since the require statement seemed unnecessary so I removed it prior to posting.

      Could you possibly forget to define a package gitadm_shell_commands in your gitadm_shell_commands.pm file?

      Try checking symbol table for your sub in case it's left defined somewhere else:

      { no strict 'subs'; sub print_subs { for (keys %{$_[0]}) { next if $_ eq $_[0]; print "$_[0]$_\n" if defined *{$_}{CODE}; print_subs($_[0].$_) if /::$/; # dirty hack } } print_subs("main::"); }