On Mon, 2003-06-02 at 07:59, Eric Estabrooks wrote:
> 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)
> 

That did the trick!  Thanks, Eric!  Now I get to work on the hard part:
finding legally redistributable bird calls and images so I can release
it publicly.  Then there's the other issue of figuring out why I get
screen corruption with a Voodoo3 graphics card but none with a Nvidia
GeForce 3, same OS, patches and code.  I'm suspecting that one's
probably just Perl/Tk bugginess.  

-- 
Carl Patten <myok at ogzr.org>


_______________________________________________
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