siddheshsawant has asked for the wisdom of the Perl Monks concerning the following question:
Hello friends I have written one script and one module as follows.I am giving both the things in detail
#!/usr/bin/perl use UserScenarioDesc; #providing web_link and user_scenario_name for testing the working of +the script my $web_link="http://lcla238.ping.com/nightly_results/2010_03_23/log_l +cla133.ping.com_64___TestSuiteDARE_Tx_Debug_MpaaPseudoIBM_AIX__3_37.h +tml"; my $us_name="testdare/UserScenarioDAREenableDisableEncryptionTx"; #print statement wrote to check the bug print"hello\n"; #calling the user sceanrio description function for testing my $user_scenario_desc = UserScenarioDesc::get_user_scenario_desc($we +b_link,$us_name); #print statement wrote to check the bug print"Hello\n"; print "UserScenario Description is as follows:\n"; print $user_scenario_desc."\n";
the corresponding module is as follows:
package UserScenarioDesc; use strict; use Cwd qw( abs_path ); my ($cwd, $above, $below, $tinc); BEGIN { $cwd = abs_path "."; ($above, $below) = $cwd =~ m~^(.+)/pp2dev/src(/.+|)$~ or die "Not in a pp2dev source tree\n"; my $tinc = "$above/pp2dev/src/testsuite/user/tinc"; my $Common="$above/pp2dev/src/testsuite/user"; unshift @INC, $tinc; unshift @INC, $Common; } use DHPL::System; use nightly::common; use Logs::LogReader; #Defining function BEGIN { use Exporter; our @ISA = qw(Exporter); our @EXPORT = qw( &get_user_scenario_desc ); } sub get_user_scenario_desc{ my($web_link, $us_name) = @_; # constructing web link to open the remote log file if($web_link =~ m/nightly_results(.*?)(.html)/) { $web_link= "/nightly_results".$1.".html"; } #remote copy command `rcp lcla238.ping.com:$web_link /tmp/nightly_db_scenarios.html`; my $file = "/tmp/nightly_db_scenarios.html"; #Generating SUiteLog object my $sul = SuiteLog->new( { FILE => $file } ); # $logfile is the log f +ile of test run #parsing all the log. $sul->parse_suite( ); # get_scheduled will return the list of all the test_suites present in + the respective test_run foreach my $sname ( @{$sul->get_scheduled( )} ) { #creating scenario_log variable using SuiteLog object my $scl = $sul->get_log( $sname ); #invoking method to list all the scenarios names for the given web lin +k. my $name = $scl->name( ); ##invoking method to extract the description (if any) for the given sc +enario name of the provided test_web_link. my $description=$scl->get_decription(); if($name eq $us_name){ return $description; } } } 1;
I am getting an output as follows:
hello (234113)Hello UserScenario Description is as follows: Steps for testing basic encryption: 1) turn on encryption on a device and verify 2) copy test data file to device 3) copy data from device to output file 4) verify test data file and output file are the same 5) reboot 6) verify device is still encrypted 7) copy data from device to output file again 8) verify test data file and output file are still the same 9) turn off encryption and verify 10) copy data from device to output file 11) verify test data file and output file are not the same
In the script I wrote two print statments purposely to specify that the error is coming from line
UserScenarioDesc::get_user_scenario_desc($web_link,$us_name);
The number (234113) that you can see in the output in between two hellos is not expected...One interesting thing about this is when I change my input web_link value the garbage value gets changed...If anybody knows why I am getting such garbage value in the output then please let me know...Thanks in advance !!!!!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: getting some random number for subroutine call in perl
by SuicideJunkie (Vicar) on Mar 24, 2010 at 15:18 UTC | |
|
Re: getting some random number for subroutine call in perl
by ikegami (Patriarch) on Mar 24, 2010 at 15:11 UTC | |
|
Re: getting some random number for subroutine call in perl
by Anonymous Monk on Mar 24, 2010 at 14:53 UTC | |
|
Re: getting some random number for subroutine call in perl
by Jenda (Abbot) on Mar 25, 2010 at 14:45 UTC |