You do this by checking it against a regular expression. In order to use this data in any of these potentially dangerous operations you need to untaint it. The full list of restrictions is given in the perlsec manual page. Tainted data cannot be used in an expression that interacts with the outside world – for example, you can’t use it in a call to system or as the name of a file to open. This option puts Perl into “taint mode.” In this mode, Perl inherently distrusts any data that it receives from outside the program’s source – for example, data passed in on the command line, read from a file, or taken from CGI parameters. In modern versions of Perl (since 5.6.0) the -w option has been replaced by the use warnings pragma, which is more flexible than the command-line option so you shouldn’t use -w in new code. ![]() Each of these warnings is a potential bug in your program and should be investigated. This turns on warnings that Perl will then give you if it finds any of a number of problems in your code. It’s far easier to fix problems when you’ve only made a few changes than it is to type in a couple of hundred of lines of code and then try to debug that. This makes sure that the program still compiles. When I’m working on a program I never go more than a few minutes without saving the file and running: $ perl -c This is a great way to ensure that you haven’t introduced any syntax errors while you’ve been editing a program. This option compiles your program without running it. And while they aren’t ever necessary, it’s rare that you’ll find an experienced Perl programmer working without them. There are three options I like to think of as a “safety net,” as they can stop you from making a fool of yourself when you’re doing something particularly clever (or stupid!). ![]() In this article we’ll look at some of the most useful of these. Perl has a large number of command-line options that can help to make your programs more concise and open up many new possibilities for one-off command-line scripts using Perl.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |