> Trying write code that work for both UNIX and MSWin32 Mail.
> This runs on Solaris but doesn't work on windows
>  
> $win32ole = 'Win32::OLE qw(in with)';
> $winconst = "Win32::OLE::Const 'Microsoft Outlook'";
>  
> if ($^O eq 'MSWin32'){
>     require $win32ole;
>     require $winconst;
>     $Win32::OLE::Warn = 3;  # die on errors...
> }
>  
> If I use this work fine for windows but want compile on Solaris.
>  
> if ($^O eq 'MSWin32'){
>     use Win32::OLE qw(in with);
>     use Win32::OLE::Const 'Microsoft Outlook';
>     $Win32::OLE::Warn = 3;  # die on errors...
> }
>  
> I get the following error:
>  
> What do I need to do to fix this? The following is the error I get on
> Win32:
>  
> Can't locate Win32::OLE qw(in with) in @INC (@INC contains:
> <snip>

'use' is a compile time directive, so the script will try and
compile/import the Win32::OLE module regardless of your if statement.
Your first example, using require, is the right way to go, but you may
want to require Win32::OLE; import Win32::OLE, which will perform the
same (mostly) as a use.

If you're just sending email, why not just use Net::SMTP, which will
work happily on either OS?

Paul

*****************************************************************
Gloucester Research Limited believes the information 
provided herein is reliable. While every care has been 
taken to ensure accuracy, the information is furnished 
to the recipients with no warranty as to the completeness 
and accuracy of its contents and on condition that any 
errors or omissions shall not be made the basis for any 
claim, demand or cause for action.
*****************************************************************


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to