473,387 Members | 1,569 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.

Storing the compilation error of perl program in a file

3
Hi,
I compile my code and i got some error. I want to store the error message in a file. For example right now i am getting following error:

Expand|Select|Wrap|Line Numbers
  1.  
  2. D:\Zulfi\PERL MAIN FOLDER>perl filecompileoutput.pl 
  3. D:/Zulfi/dir1Can't locate object method "Bobaaaaaaaaaaaaaa" via package "Bobaaaa 
  4. aaaaaaaaaa" (perhaps you forgot to load "Bobaaaaaaaaaaaaaa"?) at D:/Zulfi/dir1/d 
  5. ata1.pl line 1.
  6.  
I want to store the error message:

D:/Zulfi/dir1Can't locate object method "Bobaaaaaaaaaaaaaa" via package "Bobaaaa
aaaaaaaaaa" (perhaps you forgot to load "Bobaaaaaaaaaaaaaa"?) at D:/Zulfi/dir1/d
ata1.pl line 1.
in a file.

My code is and other information is listed below:
Expand|Select|Wrap|Line Numbers
  1.  
  2. D:\Zulfi\PERL MAIN FOLDER>type filecompileoutput.pl 
  3. #!C:/Perl64/bin/perl.exe 
  4. my $dirstr = 'D:/Zulfi/dir1'; 
  5. print $dirstr; 
  6.  
  7. $fileName = $dirstr . "/data1.pl"; 
  8.  
  9. mkdir $dirstr unless -d $existingdir; # Check if dir exists. If not create it. 
  10.  
  11.  
  12. open (MYFILE, ">$fileName"); 
  13. print MYFILE "Bobaaaaaaaaaaaaaa\n"; 
  14. print MYFILE "Bobaaaaaaaaaaaaaa\n"; 
  15. print MYFILE "Bobaaaaaaaaaaaaaa\n"; 
  16.  close (MYFILE); 
  17.  
  18. open (MYFILE, ">TestFile") || die "\n   Could not create write file.\n\n"; 
  19. print MYFILE `perl $fileName`; 
  20.  
  21.  
  22. close (MYFILE); 
  23.  
  24.  
  25. D:\Zulfi\PERL MAIN FOLDER>dir TestFile 
  26.  Volume in drive D has no label. 
  27.  Volume Serial Number is 8E4F-05BE 
  28.  
  29.  Directory of D:\Zulfi\PERL MAIN FOLDER 
  30.  
  31. 11/11/2013  08:35 PM                 0 TestFile 
  32.                1 File(s)              0 bytes 
  33.                0 Dir(s)  524,333,301,760 bytes free 
  34.  
  35. D:\Zulfi\PERL MAIN FOLDER>cd .. 
  36.  
  37. D:\Zulfi>cd dir1 
  38.  
  39. D:\Zulfi\dir1>type data1.pl 
  40. Bobaaaaaaaaaaaaaa 
  41. Bobaaaaaaaaaaaaaa 
  42. Bobaaaaaaaaaaaaaa 
  43.  
  44. D:\Zulfi\dir1>
  45.  
It shows that it has created the TestFile but its size is zero. This is my problem "How to store data in TestFile which is to store error messages generated during compiling a program using perl?"

Kindly guide me.

Zulfi.
Nov 11 '13 #1
1 1199
zak200
3
Hi,
This problem is solved now:

http://perlguru.com/gforum.cgi?post=...=unread#unread

Zulfi.
Nov 11 '13 #2

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

Similar topics

6
by: Pierre-Yves | last post by:
Hello, I would like to prevent my perl program to be executed several times simultaneously (if the program is already running, I would like to display a message like "another instance of this...
1
by: varala_kanth | last post by:
hello friends, iam new bie i run the perl program with in command mode with this following command perl <filename>.pl
6
by: Joachim | last post by:
I made some project changes (which seems it doesn't help if I undo) which have created compilation error: " Server Error in '/PCSWebApp1' Application....
2
by: Tommy Vercetti | last post by:
In Visual Studio .NET 2003, I do the following 1) File->New->Project 2) Visual C++ Projects->.NET->Windows Forms Application 3) Project->Add New Item->C++ File 4) Clear the new C++ file and...
2
by: Kevin R. | last post by:
I have been ignoring this problem for a few weeks now, but it's becoming a bit annoying not to mention unproductive. Here it goes: I compile my project with no errors. Then after I debug/run it,...
3
by: sir.linying | last post by:
My php script is to call perl scipt which makes use of Spreadsheet::ParseExcel module to parse Excel file. I am able to launch php script from command line so that perl script can run and properly...
0
by: brakesh | last post by:
Hi, I am trying to call a perl program (that connects a webserver database) from a php program via a webbrowser. For example : http://development.noaa.gov/test_exec.php?dataid=8313. The...
1
by: BSand0764 | last post by:
I'm getting an error that I can't seem to resolve. When I compile the Functor related logic in a test program, the files compile and execute properly (see Listing #1). However, when I...
1
by: jacek.dziedzic | last post by:
Hi! I have a program that #includes a header file of an external library. If the environment is set-up correctly, this file is found in the include path and everything works. Now, assume...
2
by: preityrao | last post by:
Hi, I am new to perl and was trying to write a perl program witha UI. i.e. I have written a html form which invokes a perl program to execute and to print back the data selected in the form. ...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.