ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
if($response->code == 200)
{
print "Web Service works fine";
}
else
{
print "Looks like there is a bug in the web service";
}
}
-bash-4.1# ./script_perl.pl
Global symbol "$username" requires explicit package name at ./script_perl.pl line 29.
Global symbol "$userRole" requires explicit package name at ./script_perl.pl line 30.
Global symbol "$dealerId" requires explicit package name at ./script_perl.pl line 31.
Execution of ./script_perl.pl aborted due to compilation errors.
There are numerous web testing frameworks in Perl, including (as well as the ones mentioned) "LWP::UserAgent."
I happen to enjoy using Selenium a lot, because it runs tests "by gawd, in and with" your actual browser(s). This can be profoundly important. (It does not use Perl.)
I happen to enjoy using Selenium a lot, because it runs tests "by gawd, in and with" your actual browser(s). This can be profoundly important. (It does not use Perl.)
Selenium is the correct way to do it, period. According to its manual, you can indeed script it with Perl.
-bash-4.1# ./script_perl.pl
Global symbol "$username" requires explicit package name at ./script_perl.pl line 29.
Global symbol "$userRole" requires explicit package name at ./script_perl.pl line 30.
Global symbol "$dealerId" requires explicit package name at ./script_perl.pl line 31.
Execution of ./script_perl.pl aborted due to compilation errors.
Code:
sub TestWS
{
my $username;my $userRole;my $dealerId;
my $message = "Your Request Message";
my $userAgent = LWP::UserAgent->new();
Please use [CODE] [/CODE] tags.
See the underlined edits to fix the errors reported. These are basic Perl errors.
Selenium is the correct way to do it, period. According to its manual, you can indeed script it with Perl.
This statement of course is true ... I've done it. What I really meant is that it is happening on the client side. Selenium is driving an actual instance of an actual browser on an actual client side to beat the out of your unsuspecting application.
----
Please let me repeat the suggestion that Perl-related questions are by far best handled over at PerlMonks. (No negativity at all with regard to LQ, but PM is a specialty, specialist site populated by some of the best heads in the Perl world. Present company not included.)
Last edited by sundialsvcs; 03-12-2014 at 06:51 PM.
There's where you simply have to watch the exchange ... do it on your browser, print some logging information to STDERR to help you debug the logic in your program. You're well on your way, now.
A production-ready program is required to work ... no matter what. No matter what the host throws at it. If the statement that you cite is an error in your program, then, go fix it. (LQ is not a code-writing service.) However, if it is anything that the host might legitimately do, whether in response to an error in your program or otherwise, then your program must be prepared to handle the situation appropriately. (Whatever "appropriately" is.) If a module throws an exception (as this one apparently did), then maybe you need to catch it. (Again, "not a code-writing service," but I'm briefly telling you what this program will be expected to do.)
I presume that you have bookmarked http://search.cpan.org, and that you have diligently read every line of all the documentation on the modules that you are using. (And by the way, that is not an "RTFM!!" brush-off.)
Last edited by sundialsvcs; 03-13-2014 at 08:00 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.