Need help with a small Perl script to display red screen

M

Matthew

Hello, I am wanting to create a snippet of Perl code that I can put at
the top of all my Perl scripts, so when someone externally tries to
execute it directly it will run, stop, and then display a red screen
without executing the rest of the code, however if a certain variable
is passed -- lets say for the purposes of this example something from
'$pass', then it will skip over this part and execute the complete
file. Can someone help me write something like this -- it would be
very much appreciated! :)

Cheers!

Matt
 
W

Walter Roberson

:Hello, I am wanting to create a snippet of Perl code that I can put at
:the top of all my Perl scripts, so when someone externally tries to
:execute it directly it will run, stop, and then display a red screen
:without executing the rest of the code

Perl has no inherent concept of 'red' or 'screen', so if you want
this done, you will have to give us a hint about the acceptable
constraints. For example, is this for use with the 7 segment Nixie
tubes or the later 9 segment Nixies?
 
G

gnari

Matthew said:
Hello, I am wanting to create a snippet of Perl code that I can put at
the top of all my Perl scripts, so when someone externally tries to
execute it directly it will run, stop, and then display a red screen
without executing the rest of the code, however if a certain variable
is passed -- lets say for the purposes of this example something from
'$pass', then it will skip over this part and execute the complete
file. Can someone help me write something like this -- it would be
very much appreciated! :)

version one:
red_screen(),exit() if ($ENV{SECRET_ENVIRONMENT_VARIABLE} ne 'password');

run it like this (from bash shell):
SECRET_ENVIRONMENT_VARIABLE=password perl myprog.pl normalarg
from other systems, set the environment variable, and run normally


version 2:
red_screen(),exit() if (shift() ne 'passwrd');

run it like this
SECRET_ENVIRONMENT_VARIABLE=1 perl myprog.pl password normalarg


gnari
 
T

Tintin

Matthew said:
Hello, I am wanting to create a snippet of Perl code that I can put at
the top of all my Perl scripts, so when someone externally tries to
execute it directly it will run, stop, and then display a red screen
without executing the rest of the code, however if a certain variable
is passed -- lets say for the purposes of this example something from
'$pass', then it will skip over this part and execute the complete
file. Can someone help me write something like this -- it would be
very much appreciated! :)

Define "external"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top