I can only imagine I’m not searching correctly; this seems like an obvious question to be asked here. My apologies if this is a duplicate.
I’m writing a Perl program that will take a filename as a command-line argument. I need to convert the filename (or the filename with a relative path attached) to an absolute path (specifically to work with Win32::OLE).
I tried using Cwd‘s ‘abs_path’, and that almost does what I want, but it returns it using a Unix-style path instead of a Win32 one.
Is there a module that will convert the path, or perhaps a better module to use in the first place?
I use
rel2absfrom File::Spec. You have to be careful though: that might callgetdcwdfromCwd, and it will assume that you want the current working directory for the current drive. If the file is on some other drive, you’ll have to fix that up yourself or supply the second argument to set the base path.