Carl Patten wrote:
> I've written a simple bird-call quiz in Perl/Tk with the goal of making
> it work under both Linux and Windows with ActivePerl.  It's all working
> except for sound.  How can I make it load the Win32::Sound module only
> if it's running in Windows?
> 

you have to eval it so it is done at run time instead of compile time.

 > if ("$OSVERSION" eq "linux") {
 >         print "Using Linux sound modules.\n";
 >         $splitter='/';
 > } else {
 >         print "Using Windows sound modules.\n";
	  my $win_sound = "use Win32::Sound";
           eval $win_sound;
 >         $splitter='\\';
 > }

you can also wrap the eval with an if to trap errors that might occur 
while loading Win32::Sound (like it's not installed for some reason)

Eric




_______________________________________________
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
http://www.mn-linux.org tclug-list at mn-linux.org
https://mailman.real-time.com/mailman/listinfo/tclug-list