Skip to content

Marys little script

Harry Kakoulidis edited this page Feb 16, 2020 · 1 revision

So, Mary is going to write this super CGI script using OptiPerl. Let's see how she does it.

> hmm... is it pathinfo or path_info? I keep forgetting.

> let's see OptiPerl' s hint about this:

...Now while Mary is typing her ultra complex code, OptiPerl really helps her with its box coding...

...and of course bracket line coding...

...and while typing, all syntax errors are shown automatically...

...also OptiPerl has an extremely smart syntax parser. It recognizes html in multiline print statements, it can color subroutine names and variables depending on whether they have been declared or not, and can parse even extremely complex perl code.

> OptiPerl really helps; but I still need to type code! Or not..

...well she will still need to type, but OptiPerl can make it a little less with it's html and perl code completion, templates and code librarian.

> I need to do some smart searching and replacing in my script, but a standard find & replace won't do. I think I have to write another script in perl to to make replacements in my code using a regular expression!

...OptiPerl has the most powerful search and replace dialog. You can enter a regular expression to search for (that can even span many lines), and replace using backreferences. You can also conduct a search on all the files of a project or an entire folder...

> Finally finished typing. Now I will start debugging!

...OptiPerl supports breakpoints, watches, live evaluation of variables. The debugger can be started directly on the script, or can be loaded to wait for a script with a -d shebang on a remote machine (like on your web hosts). The debugger can also be used via loopback to debug scripts when invoked from a form (e.g. pressing the submit button)...

> I have made an excellent script, but how am I going to check its security?

...You can use OptiPerl' s query editor to construct any possible scenario of sending data to your script. You can test GET, POST, PATHINFO, Cookies or add exotic environment variables. This way you can quickly test how your script should respond to the parameters it expects and whether it can handle attacks with strange queries. For console script writers, the query editor can automate sending to STDIN sequences of characters...

> Now finally I will run my script. I just hope I don't get any 500 error.

...OptiPerl' s internal server works closely with the debugger when using via loopback. When running, when something is wrong with the script, instead of giving a cryptic 500 error, it analyzes the data it got and tells you what is wrong...

> Great everything is fixed now... But I really would like to see what's going on when my script is being run.

...OptiPerl' s "Server Talk" tab shows everything that's going on when running your script. There is also an option to enable a spy proxy so that all client requests and server responses while browsing any page on the internet is shown...

> Arrgh... now how will I check if the e-mail's text is correct without actually sending it?

... Actually if you run a script with something like open( MAIL,"|/bin/sendmail"), this will actually work under windows just like in Unix without any change in your code. But instead of sending the e-mail, you'll get a pop-up window in OptiPerl showing what *would* be sent to sendmail. Date also works...

This wraps up our exiting story. Above is a small sample of what OptiPerl does! Myriads more tools will help your small or large perl project get ready. This is what the best Perl Environment can do for you!

Clone this wiki locally