473,387 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Calling subroutine

Hi,

Below is the part of code from a test FW I am working on :
Expand|Select|Wrap|Line Numbers
  1. sub run {
  2.  
  3.     [i]my $self = shift;
  4.     $self->SUPER::LogDirGen( );    #    priti
  5.     my $config = new Config::Simple( $self->{ config } );
  6.     my %config_hash = $config->vars( );
  7.     print ("1..................");
  8.     foreach ( @{ $self->{ queue } } ) {
  9.     print ("2..................");
  10.         Class::Autouse->load( $_ );
  11.         my $test_object = $_->new( \%config_hash );
  12.         my $test_name = $_;
  13.         print ("test object is : $test_object......\n");
  14.         print ("test name is : $test_name..................\n");
  15.         #$self->SUPER::LogFileGen($test_name);    #priti
  16.         foreach ( grep( m/^test/, @{ Class::Inspector->methods( $_ ) } ) ) {
  17.         print ("4..................");
  18.             foreach ( 'setUp', $_, 'tearDown' ) {
  19.                 print ("5..................");
  20.                 eval { $test_object->$_( ) };
  21.                 my $tc = $_;
  22.                 print ("at the end...$tc \n"); 
  23.             }
  24.         }
  25.     }    
  26. }
This part of code works fine. I try to call "$self->SUPER::LogFileGen($test_name); " commented out in the above code which is a function to redirect my standard outputs to a file. I get the below error :

Expand|Select|Wrap|Line Numbers
  1. Can't locate TestCalenders.pm in @INC (@INC contains: C:/usr/
  2. site/lib, C:/usr/lib, .) at C:/usr/site/lib/Automat/Framework/TestSuiteRunner.pm
  3.  line 49
  4.         Automat::Framework::TestSuiteRunner::run('Automat::Framework::TestSuiteR
  5. unner=HASH(0x226054)') called at run.pl line 36
  6. # Looks like you failed 3 tests of 25.
  7. # Looks like your test died just after 25.
Below is the sample LogFileGen subroutine:
Expand|Select|Wrap|Line Numbers
  1. sub LogFileGen {
  2. my $test_object = $_[1];
  3. print "content-type: $ext/html \n\n"; 
  4. $FH = "filehandle";
  5. chdir ("Log$now_string"); 
  6. my $cur = getcwd;
  7. open (OUTPUT, ">$test_object.txt");
  8. my $Test = Test::Builder->new;
  9. $Test->output("$test_object.txt");
  10. return();
  11. }
Can anybody help to solve the issue. And also if someone please explain me why the error is coming when i cann the LogFileGen subroutine.

Thanks,
Priti
Mar 10 '08 #1
7 1650
KevinADC
4,059 Expert 2GB
Looks like you need to start by installing the TestCalenders.pm module.
Mar 10 '08 #2
It is already. The error is coming only when I call the LogFileGel subrouting from this subroutine.
Mar 10 '08 #3
numberwhun
3,509 Expert Mod 2GB
It is already. The error is coming only when I call the LogFileGel subrouting from this subroutine.
I have to agree with Kevin. Considering this error:

Can't locate TestCalenders.pm in @INC (@INC contains: C:/usr/
site/lib, C:/usr/lib, .) at C:/usr/site/lib/Automat/Framework/TestSuiteRunner.pm
line 49

which you so kindly posted, the module TestCalenders.pm is not found. If this is something that you installed, then you need to ensure that Perl can find it, otherwise, its useless. That is why you are getting this error.

Also, Please put code tags around any code you post in the forums. I have fixed it for you this time, but next time things get uglier. ;-)

Regards,

Moderator
Mar 10 '08 #4
Thanks . I will surely keep that in mind.
If you see the code, there is :
Expand|Select|Wrap|Line Numbers
  1. Class::Autouse->load( $_ ); # @ line 10. whick loads all the modules.
I am not getting the error when I run the code as it is. But when I insert

Expand|Select|Wrap|Line Numbers
  1. $self->SUPER::LogFileGen($test_name);  #priti  - I see the error.
Hope my question is clear now.

Thanks.
Mar 10 '08 #5
Also, let me know how can I make sure that perl is able to find the module.

Thanks,
Mar 10 '08 #6
eWish
971 Expert 512MB
TestCalenders does not appear to be a module from CPAN. Unless you installed it in the directory that perl looks for modules, you will need to use the lib pragma before perl will see the module.

Expand|Select|Wrap|Line Numbers
  1. use lib '/path/to/TestCalenders';
Edit:
Below is an example of how to use the code tags:
[CODE]The tags surrond the code that is posted which preserves the format and spacing.[/CODE]

Thank you for trying.

--Kevin
Mar 10 '08 #7
I have included the lib pragma and the code run good now. Thanks a lot for the help.

You are right, TestCalender is not a CPAN module. Still I have a doubt (if you dont mind me asking it again).

Why Perl is not able to look for the module ONLY WHEN the "self->SUPER::LogFileGen($test_name);" line in included in the code BUT able to look for the module when I comment this out.

Sorry If I am being repeatative.

Thanks Again.

Priti
Mar 10 '08 #8

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

Similar topics

4
by: Michael Farber | last post by:
Not sure if this is the right group for this but anyways... I've got an ASP web application that uses a Visual Basic component to do some work. I instantiate the component in asp and then...
2
by: Giulio Belrango | last post by:
Hi I need someones help I'm working in an IBM 390 batch environment. What I'm trying to do is to call from a non DB2 COBOL program a DB2 COBOL program that will access a table and perform an...
30
by: Tim Marshall | last post by:
Here's the scenario, A2003, Jet back end, illustrated with some cut down code at the end of the post: A proc dims a snapshot recordset (dim rst as Dao.recordset) and opens it. There are several...
12
by: Bigdakine | last post by:
I don't know if this is the right forum for this, and if not please suggest one which fits. I have to call a fortran sub routine from a C main program. The fortran subroutine statement is ...
5
by: Amit | last post by:
I tried calling a subroutine in a fortran module from C ,but couldn't.I always get the error: undefined reference in the main.o file (main is in C calling the subroutine). for calling the...
2
by: Ray J. | last post by:
I have a C++ program written and compiled on Solaris 8 with gcc. With gcc lets me compile fortran code along with the C++ program to be able to call the fortran code as a subroutine. The...
11
by: RichN | last post by:
I am developing a c program in Visual Studio .NET 2003. I also have an Intel(R) Fortran compiler for MVS .NET My fortran sourcecode already existed. I started a new fortran project and chose to...
4
by: Dursun | last post by:
I need to call a subroutine in FormA from within FormB. Let FormA be an MDIForm and let FormB be its MDIChild form. So, the FormB.MDIParent property will return an object refernce to the FormA...
2
by: singlal | last post by:
Hi, my question was not getting any attention because it moved to 2nd page; so posting it again. Sorry for any inconvenience but I need to get it resolved fast. Need your help! ...
7
by: mirandacascade | last post by:
Note: I'm not sure if the subject line of this post uses the correct terminology, so apologies if the subject line turns out to be misleading. I think it's probably easier to provide a trivial...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.