By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,660 Members | 1,299 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,660 IT Pros & Developers. It's quick & easy.

How to Automate the Website using perl module

P: 5
Hi All
I Have installed Active perl in my system and I am new to perl and automation...Could some one tell me how to install the perl modules and how to use those modules with the perl for autmating the website ... it will be very helpful for me to start automation...
Oct 10 '08 #1
Share this Question
Share on Google+
8 Replies


P: 65
Hi there,

To install the perl modules can refer this link:

http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlmodinstall.html

To answer your 2nd question, it's better to get it from the perl experts from this forum as even am newbiee to perl.

Regards,
Vijayarl
Oct 10 '08 #2

numberwhun
Expert Mod 2.5K+
P: 3,503
CPAN provides excellent documentatio on installing perl modules. To use the module, you would first install it, then, specify it in the beginning of your Perl script as such:

Expand|Select|Wrap|Line Numbers
  1. use DBI;
  2.  
or even:

Expand|Select|Wrap|Line Numbers
  1. use Config::Scoped;
  2.  
Those are real module examples. What you put will depend on what module you are using. To use a module, you have to look at its page on CPAN as it will instruct you in its use.

Regards,

Jeff
Oct 10 '08 #3

KevinADC
Expert 2.5K+
P: 4,059
If you are using active perl you use the PPM application to install modules. Activeperl comes with a lot of documentation, so find the documentation (in the activeperl folder) and read it.

Automation could mean anything so there is no way to help with that unless you specify what you want or are trying to do.
Oct 10 '08 #4

P: 5
If you are using active perl you use the PPM application to install modules. Activeperl comes with a lot of documentation, so find the documentation (in the activeperl folder) and read it.

Automation could mean anything so there is no way to help with that unless you specify what you want or are trying to do.
Hi Kevin Thanks for ur reply

What i have to do is I want to Login in to my site by entering username and password and later i want to click on any button for furthur process..

And i am working on windows machine ie Windows XP...
Oct 13 '08 #5

P: 31
This might help
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2. #-----------------------------
  3. # GET REQUEST
  4. #
  5. use LWP::Simple;
  6. use URI::URL;
  7.  
  8. my $url = url('http://login.yahoo.com/');
  9. $url->query_form(username => 'peter', password => 'secret');
  10. $content = get($url);
  11.  
  12. #-----------------------------
  13. # POST REQUEST
  14. #
  15. use HTTP::Request::Common qw(POST);
  16. use LWP::UserAgent;
  17.  
  18. $ua = LWP::UserAgent->new();
  19. my $req = POST 'http://login.yahoo.com/',
  20.    [ username => 'peter', password => 'secret' ];
  21. $content = $ua->request($req)->as_string;
Oct 13 '08 #6

numberwhun
Expert Mod 2.5K+
P: 3,503
This might help
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2. #-----------------------------
  3. # GET REQUEST
  4. #
  5. use LWP::Simple;
  6. use URI::URL;
  7.  
  8. my $url = url('http://login.yahoo.com/');
  9. $url->query_form(username => 'peter', password => 'secret');
  10. $content = get($url);
  11.  
  12. #-----------------------------
  13. # POST REQUEST
  14. #
  15. use HTTP::Request::Common qw(POST);
  16. use LWP::UserAgent;
  17.  
  18. $ua = LWP::UserAgent->new();
  19. my $req = POST 'http://login.yahoo.com/',
  20.    [ username => 'peter', password => 'secret' ];
  21. $content = $ua->request($req)->as_string;
Just a bit of advice Uber, it is highly advised and recommended in "Perl Best Practices" to put all of your "use" statements at the top of your script. You don't want to scatter them throughout your script or finding dependencies for scripts will be hell for others. I, personally, would not want to support code that did something like that. I have supported some pretty bad code and it is never fun!

Regards,

Jeff
Oct 13 '08 #7

P: 5
Just a bit of advice Uber, it is highly advised and recommended in "Perl Best Practices" to put all of your "use" statements at the top of your script. You don't want to scatter them throughout your script or finding dependencies for scripts will be hell for others. I, personally, would not want to support code that did something like that. I have supported some pretty bad code and it is never fun!

Regards,

Jeff
Hey jeff..Thnk u very much..

And one thing i want to know is i can run these scripts in perl express right? or do i need to run in any other toll..Just mention those if possible..
Basically perl express is a editor i am using right now.....

And actually LWP module is itself installed while installing active perl in my sys....ie..LWP perl module pogram is existing in the path C:\Perl\lib\LWP

Do i need to install again if i use these in my scripts

Thanks in advance
Oct 16 '08 #8

numberwhun
Expert Mod 2.5K+
P: 3,503
Hey jeff..Thnk u very much..

And one thing i want to know is i can run these scripts in perl express right? or do i need to run in any other toll..Just mention those if possible..
Basically perl express is a editor i am using right now.....

And actually LWP module is itself installed while installing active perl in my sys....ie..LWP perl module pogram is existing in the path C:\Perl\lib\LWP

Do i need to install again if i use these in my scripts

Thanks in advance
If its installed, then no, you shouldn't have to install them again, just the once. I don't know anything about Perl Express, but when you run perl scripts, you should really be running them from the command line to test them. Use the following format for that:

Expand|Select|Wrap|Line Numbers
  1. c:> perl scriptname.pl
  2.  
Oct 16 '08 #9

Post your reply

Sign in to post your reply or Sign up for a free account.