in reply to Re: Re: Is it possible to have a script run under one account and open a file using another?
in thread Is it possible to have a script run under one account and open a file using another?

If you want it to be portable, abstract it one level, and then bring in whatever code you need based on the OS in your abstraction layer rather than the application layer. As you need support for new environments, you only adjust your abstraction layer.

Example:

# Application.pl use IO::File::AsUser; # Your abstraction layer my $fh = IO::File::AsUser->open($file, $user); # AsUser.pm package IO::File::AsUser; #blah blah sub open { if ($Windows) { do_what_needs_to_be_done_on_windows(); } elsif ($Unix} { do_what_needs_to_be_done_on_unix(); } }
  • Comment on Re: Re: Re: Is it possible to have a script run under one account and open a file using another?
  • Download Code