develooper Front page | perl.beginners | Postings from February 2002

Re: GURU question about use and modules...

Thread Previous
From:
Jeff 'japhy' Pinyan
Date:
February 5, 2002 09:39
Subject:
Re: GURU question about use and modules...
Message ID:
Pine.GSO.4.21.0202051234280.612-100000@crusoe.crusoe.net
On Feb 5, Nikola Janceski said:

>now I thought that the following code would work... but no.
>
>if ($^O =~ /^(ms)?(win|dos)(32|nt)?$/i){
>	use lib "N:/njancesk/perllib";
>	use Win32::Process;
>	use Win32::Event 1.00 qw(wait_any);
>
>	} else {
>	use lib "/u/njancesk/perllib";
>
>	}
>
>This is the error on UNIX:
>Can't locate Win32/Process.pm in @INC ...

use happens at compile-time.  There really should be some error raised
when Perl finds 'use' in a conditional block...

  BEGIN {
    if ($^O =~ /^(ms)?(win|dos)(32|nt)?$/i) {
      eval q{
        use lib "N:/njancesk/perllib";
        use Win32::Process;
        use Win32::Event 1.00 qw(wait_any);
      };
    }
    else {
      eval q{
        use lib "/u/njancesk/perllib";
      }
    }
  }

-- 
Jeff "japhy" Pinyan      japhy@pobox.com      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About