in reply to Re: Undefined subroutine - newbie problem
in thread Undefined subroutine - newbie problem

thank you, I have done like that in last exc, but now I am obliged to use "require" :(
  • Comment on Re^2: Undefined subroutine - newbie problem

Replies are listed 'Best First'.
Re^3: Undefined subroutine - newbie problem
by cheekuperl (Monk) on Aug 14, 2012 at 12:01 UTC
      hm... still doesn't seem to be solution: Undefined subroutine &main::generate_throws_simple called at (...) and the code:
      use strict; use warnings; use vars qw($a $b @wyniki); $a = 6; #kostka $b = 10; #licznik @wyniki = (); require gts; #generate_throws_simple require pts; #print_throws_simple gts->import(); pts->import(); print "\n-------------------STANDARDOWE LOSOWANIE----------------\n"; print_throws_simple(generate_throws_simple($a,$b)); #standardowe losow +anie
      and gts/pts code (just that important):
      require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(print_throws_simple); # symbols automatically exporte +d our @EXPORT_OK = qw(); # symbols exported on request our %EXPORT_TAGS = (); # TAG => [qw(name1 name2)] # ...............................................
        Well, the exporting needs to happen at use(BEGIN) time , so if you don't want to use use, you have to wrap require/importing in  BEGIN {} , or delay compilation of  print_throws_simple(generate_throws_simple($a,$b)); with  eval q{ }

        I suggest you do whatever it takes to be able to use use