PDA

View Full Version : OPEN PERL IDE - passing parameters


PeteF
06-08-2006, 03:41 PM
I'm programming in PERL using the Open Perl IDE app for editing and testing
my code. I forgot how to setup the environmnet so that I can pass some
parameters to the program under test.

The manual is not so good....
http://open-perl-ide.sourceforge.net/documentation/user-manual/usermanual.html

Below is a simple program I'm trying to test.
PERL IDE has a "Start Parameter" option and
I tried entering... myname=pete
but that doesn't work.

====================================
#!/usr/bin/perl -w
use CGI qw(:standard);
use strict;

$passed=param(myname)

print header;
print "<B>Testing script...</B>";

print $passed

====================================

Do we have any PERL programmers in here?

---pete---

PeteF
06-08-2006, 05:22 PM
Ok, I found the answer!
I actually had a few things wrong in the original code posted.
I had syntax errors and needed to declare one variable.
The corrected code is shown below.

To pass the parameter I simply entered into the
Startup Parameter textbox.... myname=Pete

Now everything works fine but I can see I need to go back and
study my PERL textbooks. I've done some complex PERL programming
in the past but I seem to have forgotten how to do it. Oh well.

Do we have any PERL programmers in here?

=================================
#!/usr/bin/perl -w
use CGI qw(:standard);
use strict;

my($passed) = { };

$passed=param("myname");


print (header);
print ("<B>Testing script...</B>");

print $passed;
=================================