in reply to require a module and import array data

See Exporter and Coping with Scoping.

  • Comment on Re: require a module and import array data

Replies are listed 'Best First'.
Re^2: require a module and import array data
by fionbarr (Friar) on Apr 09, 2015 at 14:40 UTC
    ########################################################## # db_data.pm use strict; use warnings; package db_data; use Exporter; my @ISA = qw(Exporter); my @EXPORT = qw(@LoH); my @LoH = ( { database => 'Pxxxxx', hostname => 'wpprd0.com', servicename => 'pqxxxx', port => '9010', username => 'mmmmmm', password => 'pl', }, ) ; 1;
    @LoH array is still not available to main routine

      So, have you read the other link I provided?

      Alternatively, have you read the Exporter documentation and examples? They do not mention lexical variables, neither for @EXPORT nor for the exported variables. Maybe you want to explain why you chose to use lexical variables there.

        from Exporter 'The symbols can represent functions, scalars, arrays, hashes, or typeglobs'
        I can't access the other link....company is blocking that URL

      Take a closer look at Exporter, my isn't used for any of the vars , they are supposed to be globals ... my vars (not globals) cannot be exported

        got it! Thanks...it was the lexical 'my' @LoH in the db_data module