From: apeiron Date: Wed, 14 Jan 2009 08:02:12 +0000 (+0000) Subject: Bail if given fancy dashes due to copypasting from a UTF8-happy POD formatter. X-Git-Tag: 1.006009~83 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d4dbe584d4fb4bc6c179801ae4aa5c6b7f55f157;p=p5sagit%2Flocal-lib.git Bail if given fancy dashes due to copypasting from a UTF8-happy POD formatter. git-svn-id: http://dev.catalyst.perl.org/repos/bast/local-lib/1.000/trunk@5312 bd8105ee-0ff8-0310-8827-fb3f25b6796d --- diff --git a/Changes b/Changes index 32f2dde..96214f5 100644 --- a/Changes +++ b/Changes @@ -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! diff --git a/Makefile.PL b/Makefile.PL index c5e6a21..cf1ec5c 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -3,6 +3,22 @@ use warnings; 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; diff --git a/lib/local/lib.pm b/lib/local/lib.pm index 79f8476..bdc2572 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -11,7 +11,7 @@ use File::Path (); 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 @@ sub import { # 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});