Skip to content

Perl Harbor #63

Closed Answered by Stagyrite
eltikia asked this question in Q&A
Discussion options

You must be logged in to vote

There is a race condition when a user passes Perl code with the command line 'e' option. Here's a plan that Perl 1 implements:

  1. Create a temporary file prefixed with "perl-e" by calling a 'mktemp()' function.
  2. Write Perl 1 code passed as a program argument to the newly created file.
  3. Close the temporary file flushing the buffers.
  4. Proceed as if the temporary file would be passed to the Perl 1 interpreter.
    Suppose you want to print a 'hello, world' text with Perl 1.
$ ./perl -e 'print "hello, world\n";'

It would create a temporary file (e.g., /tmp/perl-emMuFDJ). That file is certain to contain the Perl code followed by a new line character. Then, the execution proceeds as if you execute:

$ …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by eltikia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants