How to Automate the Website using perl module

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gajendra98
    New Member
    • Oct 2008
    • 5

    How to Automate the Website using perl module

    Hi All
    I Have installed Active perl in my system and I am new to perl and automation...Co uld 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...
  • vijayarl
    New Member
    • Sep 2008
    • 65

    #2
    Hi there,

    To install the perl modules can refer this link:

    http://theoryx5.uwinni peg.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

    Comment

    • numberwhun
      Recognized Expert Moderator Specialist
      • May 2007
      • 3467

      #3
      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:

      Code:
      use DBI;
      or even:

      Code:
      use Config::Scoped;
      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

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        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.

        Comment

        • gajendra98
          New Member
          • Oct 2008
          • 5

          #5
          Originally posted by KevinADC
          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...

          Comment

          • über
            New Member
            • Sep 2007
            • 31

            #6
            This might help
            Code:
            #!/usr/bin/perl
            #-----------------------------
            # GET REQUEST
            #
            use LWP::Simple;
            use URI::URL;
            
            my $url = url('http://login.yahoo.com/');
            $url->query_form(username => 'peter', password => 'secret');
            $content = get($url);
            
            #-----------------------------
            # POST REQUEST
            #
            use HTTP::Request::Common qw(POST);
            use LWP::UserAgent;
            
            $ua = LWP::UserAgent->new();
            my $req = POST 'http://login.yahoo.com/',
               [ username => 'peter', password => 'secret' ];
            $content = $ua->request($req)->as_string;

            Comment

            • numberwhun
              Recognized Expert Moderator Specialist
              • May 2007
              • 3467

              #7
              Originally posted by über
              This might help
              Code:
              #!/usr/bin/perl
              #-----------------------------
              # GET REQUEST
              #
              use LWP::Simple;
              use URI::URL;
              
              my $url = url('http://login.yahoo.com/');
              $url->query_form(username => 'peter', password => 'secret');
              $content = get($url);
              
              #-----------------------------
              # POST REQUEST
              #
              use HTTP::Request::Common qw(POST);
              use LWP::UserAgent;
              
              $ua = LWP::UserAgent->new();
              my $req = POST 'http://login.yahoo.com/',
                 [ username => 'peter', password => 'secret' ];
              $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

              Comment

              • gajendra98
                New Member
                • Oct 2008
                • 5

                #8
                Originally posted by numberwhun
                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

                Comment

                • numberwhun
                  Recognized Expert Moderator Specialist
                  • May 2007
                  • 3467

                  #9
                  Originally posted by gajendra98
                  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:

                  Code:
                  c:> perl scriptname.pl

                  Comment

                  Working...