Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

rightway from US.pm

by Intrepid (Deacon)
on Oct 25, 2006 at 14:02 UTC ( #580581=snippet: print w/ replies, xml ) Need Help??

Description:

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
Comment on rightway from US.pm
Download Code

Back to Snippets Section

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://580581]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2014-12-21 20:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (107 votes), past polls