in reply to •Re: calling functions with same names but in different modules depending on user input
in thread calling functions with same names but in different modules depending on user input

Thanks for the comments ,OO solution was great ! why didnt I think of this before ? studpid me ! ok - while we are on the topic, consider this code :
#!/usr/local/bin/perl use standard; use nonstandard; my $option = "standard"; my_print("i m in main\n"); $option::just_print(); <-- error :syntax error at main.pl near "$opt +ion::just_print(" sub my_print(){ print @_; } package nonstandard; sub just_print{ print "in just_print nonstandard \n"; main::my_print("calling my_print from nonstandard\n"); } 1; package standard; sub just_print{ print "in just_print standard \n"; main::my_print("calling my_print from standard\n"); } 1;
$option::just_print( ) gives errors, so I did this : my $a = "&"."$adaption"."::just_print()"; eval $a; Is their any better way to do this(apart from our great OO) ?(consider that the two packages have 10-15 functions having similar names,so executing it in the above way is not a good way) I guess, you guys have already answered this..but just for clarification sake
  • Comment on Re: •Re: calling functions with same names but in different modules depending on user input
  • Download Code