in reply to Re: Accessing SMB Shares from Linux
in thread Accessing SMB Shares from Linux

Thanks Roger, and also to idsfa, for the replies.

I'll take a look at both methods to see which works best for me.

Is there a way to do this that is portable between Win32 and Linux, or am I going to need to write a wrapper to choose between Win32/Linux code?

  • Comment on Re: Re: Accessing SMB Shares from Linux

Replies are listed 'Best First'.
Re: Re: Re: Accessing SMB Shares from Linux
by Roger (Parson) on Nov 26, 2003 at 09:37 UTC
      Is there a way to do this that is portable between Win32 and Linux

    Yes of course. You can check the $^O variable to see whether you are on Windows or Linux platform, and act accordingly.
    use strict; if ($^O ne 'MSWin32') { # NOT on windows? require POSIX; require Filesys::SmbClient; } ... sub OpenFile { my ($server, $path, $username .... ) = @_; if ($^O eq 'MSWin32') { # open file directly as //server/path on Windows ... } else { # open file via smbclient on *nix ... } }