in reply to Symbols not importing/exporting correctly

and lastly here is csLogs::Error, which is where csErrorClass is being imported from package Error;

That needs to be package csLogs::Error.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re: Symbols not importing/exporting correctly
by AidanLee (Chaplain) on May 03, 2001 at 19:41 UTC
    Great, it works. Question: I was under the impression that by using something like csLogs::Error that while, yes, this specifies a specific namespace, that in use it simply helped specify which subdirectory the module should be found in from one of the @INC locations. Am I walking fine lines here?

    I think my old assumption is that Perl knew that csLogs::Error was the same namespace as Error if Error was in the csLogs directory.

      use csLogs::Error qw(a b) expands to:

      BEGIN { require csLogs::Error; import csLogs::Error qw(a b); }
      which expands to:
      BEGIN { require "csLogs/Error.pm"; csLogs::Error->import( qw(a b) ); }
      and that last line eventually becomes something like one of these:
      Exporter::import( "csLogs::Error", qw(a b) ); UNIVERSAL::import( "csLogs::Error", qw(a b) );
      So "csLogs::Error" is used both to find the Error.pm file and to find import(). So you need to get it right. Unfortunately, there is really no enforcement that the file csLogs/Error.pm defines a csLogs::Error::import() or sets @csLogs::Error::ISA= qw(Exporter) and @csLogs::Error::EXPORT.

      It would be nice if UNIVERSAL::import() complained about such things so you might find Universally unimportant and overused useful (and important).

              - tye (but my friends call me "Tye")