[27630] in Perl-Users-Digest
Perl-Users Digest, Issue: 9114 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 2 18:05:55 2006
Date: Sun, 2 Apr 2006 15:05:02 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 2 Apr 2006 Volume: 10 Number: 9114
Today's topics:
Re: How to do conditional compile. (nobull@mail.com)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 02 Apr 2006 16:22:55 GMT
From: nobull67@gmail-dot-com.no-spam.invalid (nobull@mail.com)
Subject: Re: How to do conditional compile.
Message-Id: <442ffa5f$0$14626$892e7fe2@authen.yellow.readfreenews.net>
davids wrote:
> Brian McCauley wrote:
>
> To skip compilation of offending subroutines then the best way is to
> place the them in another file and conditoinally require() it.
>
> Thanks Brian. That's what I needed. Googling for
> 'perl "conditional require"' got me to some addiional
hints. I moved
> the Excel routines into a separate file named Excel_subs.pm and put
the
> following in my main routine:
>
> my $HAS_EXCEL = eval "use Win32::OLE::Cont 'Microsoft
Excel'";
>
I usually suggest doing
my $HAS_EXCEL = eval "use Win32::OLE::Cont 'Microsoft Excel'; 1
";
or
my $HAS_EXCEL = eval {
require Win32::OLE::Cont;
Win32::OLE::Cont->import('Microsoft Excel');
1;
};
There explicit return value ensures that eval returns true on success
and false if there is an error.
But from what I read in your original post you were getting a warning
not an error and so $HAS_EXCEL will always be true even if you don't
have Excel.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 9114
***************************************