http://www.perlmonks.org?node_id=580581

Let it be more convenient to use the 3rd-party unix-like sh shells with/from Win32-ish Perls.

This code is written as a module so that it is convenient to use from the command line. See the SYNOPSIS section in the embedded POD, below.

package US; use strict; use warnings; use vars qw($VERSION @ISA @EXPORT); sub rightway; $VERSION ='0.01'; use base 'Exporter'; @EXPORT = ('rightway'); =head1 NAME US.pm - correct slash orientation in file path specs from native Win32 + to Perl-canonical form. =head1 VERSION This documentation describes version B<0.01> of US. =head1 SYNOPSIS use US; use Win32; use File::Glob 'bsd_glob'; { local $\ = "\n"; print for glob( rightway Win32::GetShortPathName(Win32::GetFolderPath(Win32:: +CSIDL_COMMON_DOCUMENTS)) . "/*") ; } =head1 DESCRIPTION Makes it more convenient to use the 3rd-party unix-like sh shells with +/from Win32-ish Perls. "US" as a name was not chosen with a nationalistic or xenophobic inten +tion. The author expects to use this code mainly from the commandline (in "1-liners" as + we say in Perl), and as such a short, easy to remember name is a matter of convenience. + Ok? "U"=="Unix", "S"=="Slash". Thus, "US.pm". =cut =head1 EXPORTED FUNCTIONS =head2 rightway =cut sub rightway ($) { my $pstr = shift @_; $pstr=~ s{\\}{/}g; $pstr; } 1; # US like all modules, should return "TRUE". __END__ =head1 AUTHOR, WARRANTY, COPYRIGHT, & LICENCE INFO NO COPYRIGHT, NO WARRANTY, USE AT OWN RISK. Created Oct 25 2006 by Soren Andersen. This code is considered by the author to be so obvious and trivial that he hereby releases all claim of rights to (and disclaims any responsibility for) the code, and places it in the PUBLIC DOMAIN. Last modified: 25 Oct 2006 at 09:31 AM EDT =cut