Permalink
Browse files

Was fooled by the e in -MBlock::NamedVar

  • Loading branch information...
1 parent 39e84a6 commit 2dba6e56c85f097cb72edb8155bea524f1aa17ab @schwern schwern committed May 12, 2010
Showing with 8 additions and 1 deletion.
  1. +6 −1 bin/perl5i.c.PL
  2. +2 −0 t/command_line_wrapper.t
View
@@ -19,6 +19,8 @@ printf $fh <<'END', $0, $perl_path, $tempdir;
* Any changes here will be wiped out. Edit it there instead.
*/
+#define DEBUG 0
+
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
@@ -50,7 +52,10 @@ int main (int argc, char* argv[]) {
char *dash_e = strchr(argv[i], 'e');
/* Its a one liner */
- if( dash_e && (strchr(argv[i], '-') == argv[i]) )
+ if( dash_e && strcmp(dash_e, "e") == 0
+ && (strchr(argv[i], '-') == argv[i])
+ && (strchr(argv[i], 'M') != argv[i]+1)
+ )
{
saw_dash_e = 1;
View
@@ -28,6 +28,8 @@ like `$perl5i "-Ilib" -e "\$^X->say"`, qr/perl5i/, '$^X is perl5i';
is `$perl5i -wle "print 'Hello'"`, "Hello\n", "compound -e";
+is `$perl5i -Minteger -e "say 'Hello'"`, "Hello\n", "not fooled by -Module";
+
# Make sure it thinks its a one liner.
is `$perl5i -e 'print \$0'`, "-e", '$0 preserved';
is `$perl5i -e 'print __LINE__'`, 1, '__LINE__ preserved';

0 comments on commit 2dba6e5

Please sign in to comment.