[Bast-commits] r5312 - in local-lib/1.000/trunk: . lib/local

apeiron at dev.catalyst.perl.org apeiron at dev.catalyst.perl.org
Wed Jan 14 08:02:12 GMT 2009


Author: apeiron
Date: 2009-01-14 08:02:12 +0000 (Wed, 14 Jan 2009)
New Revision: 5312

Modified:
   local-lib/1.000/trunk/Changes
   local-lib/1.000/trunk/Makefile.PL
   local-lib/1.000/trunk/lib/local/lib.pm
Log:
Bail if given fancy dashes due to copypasting from a UTF8-happy POD formatter.


Modified: local-lib/1.000/trunk/Changes
===================================================================
--- local-lib/1.000/trunk/Changes	2009-01-14 03:21:36 UTC (rev 5311)
+++ local-lib/1.000/trunk/Changes	2009-01-14 08:02:12 UTC (rev 5312)
@@ -1,5 +1,10 @@
 Revision history for local::lib
 
+1.003001 2009-01-14
+        - Properly bail if given fancy dashes obtained by copy-pasting from a
+          UTF8-happy POD formatter. This will bail in both the Makefile.PL and
+          in local::lib::import().
+
 1.003000 2009-01-13
         - Add the --self-contained flag from Mark Stosberg, which also contains
           a doc patch warning about the dangers of UNINST=1. Thanks, Mark!

Modified: local-lib/1.000/trunk/Makefile.PL
===================================================================
--- local-lib/1.000/trunk/Makefile.PL	2009-01-14 03:21:36 UTC (rev 5311)
+++ local-lib/1.000/trunk/Makefile.PL	2009-01-14 08:02:12 UTC (rev 5312)
@@ -3,6 +3,22 @@
 use vars qw($bootstrapping);
 
 BEGIN {
+  # watch out for fancy dashes. these can wind up in our @ARGV if the user is
+  # copypasting the bootstrap command from the POD displayed e.g. by perldoc
+  # on a Mac OS X terminal. since no software recognizes and handles these
+  # dashes, it's better to die loudly telling the user exactly what happened
+  # so they don't make the same mistake again rather than being the only
+  # program in the universe that works with them.
+  if(grep { /−/ } @ARGV) {
+      die <<'DEATH';
+WHOA THERE! It looks like you've got some fancy dashes in your commandline!
+These are *not* the traditional -- dashes that software recognizes. You
+probably got these by copy-pasting from the perldoc for this module as
+rendered by a UTF8-capable formatter. This most typically happens on an OS X
+terminal, but can happen elsewhere too. Please try again after replacing the
+dashes with normal minus signs.
+DEATH
+  }
   if (my ($x) = grep { /^--bootstrap(?:=.*)?$/ } @ARGV) {
     @ARGV = grep { !/^--bootstrap(?:=.*)?$/ } @ARGV;
     $bootstrapping = 1;

Modified: local-lib/1.000/trunk/lib/local/lib.pm
===================================================================
--- local-lib/1.000/trunk/lib/local/lib.pm	2009-01-14 03:21:36 UTC (rev 5311)
+++ local-lib/1.000/trunk/lib/local/lib.pm	2009-01-14 08:02:12 UTC (rev 5312)
@@ -11,7 +11,7 @@
 use Carp ();
 use Config;
 
-our $VERSION = '1.003000'; # 1.2.0
+our $VERSION = '1.003001'; # 1.3.1
 
 sub import {
   my ($class, @args) = @_;
@@ -24,6 +24,17 @@
   # Handle the '--self-contained' option
   my $flag = shift @args;  
   no warnings 'uninitialized'; # the flag is optional 
+  # make sure fancy dashes cause an error
+  if ($flag =~ /−/) {
+      die <<'DEATH';
+WHOA THERE! It looks like you've got some fancy dashes in your commandline!
+These are *not* the traditional -- dashes that software recognizes. You
+probably got these by copy-pasting from the perldoc for this module as
+rendered by a UTF8-capable formatter. This most typically happens on an OS X
+terminal, but can happen elsewhere too. Please try again after replacing the
+dashes with normal minus signs.
+DEATH
+  }
   if ($flag eq '--self-contained') {
     # The only directories that remain are those that we just defined and those where core modules are stored. 
     @INC = ($Config::Config{privlibexp}, $Config::Config{archlibexp}, split ':', $ENV{PERL5LIB});




More information about the Bast-commits mailing list