in reply to Conditional loading of module with global exports

Simple untested thought: Did you try actually declaring the variable?

require IPC::Lite; our @urls; IPC::Lite->import( Key => $0, qw( @urls ) ); push(@urls, '...');

Replies are listed 'Best First'.
Re^2: Conditional loading of module with global exports
by learnedbyerror (Monk) on Feb 22, 2016 at 21:17 UTC

    Updated!! Oh Anonymous Monk, please accept my apologies for maligning your good, accurate and valuable advice. Yes, this did work when tested properly

    Yes, I did try this. The script will compile; however, the data that is persisted in IPC::Lite is not accessible as @url is the RAM @url.

    See the following examples

    This code will persist the results using IPC::Lite

    use IPC::Lite Key => 'TEST', qw(@urls) ; push( @urls, ("a", "b", "c") );

    This code verifies that the data persists

    use IPC::Lite Key => 'TEST', qw(@urls) ; foreach ( @urls ) { print "$_\n"; }; OUTPUT: a b c

    This code uses the method that you referred

    require IPC::Lite; our @urls; IPC::Lite->import( Key => $0, qw( @urls ) ); foreach ( @urls ) { print "$_\n"; }; OUTPUT:

    There is no output because the variable accessed is the RAM variable

    Thanks for the thought