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:
I want to store the error message:
D:/Zulfi/dir1Can't locate object method "Bobaaaaaaaaaaa aaa" via package "Bobaaaa
aaaaaaaaaa" (perhaps you forgot to load "Bobaaaaaaaaaaa aaa"?) at D:/Zulfi/dir1/d
ata1.pl line 1.
in a file.
My code is and other information is listed below:
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.
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:
Code:
D:\Zulfi\PERL MAIN FOLDER>perl filecompileoutput.pl 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.
D:/Zulfi/dir1Can't locate object method "Bobaaaaaaaaaaa aaa" via package "Bobaaaa
aaaaaaaaaa" (perhaps you forgot to load "Bobaaaaaaaaaaa aaa"?) at D:/Zulfi/dir1/d
ata1.pl line 1.
My code is and other information is listed below:
Code:
D:\Zulfi\PERL MAIN FOLDER>type filecompileoutput.pl
#!C:/Perl64/bin/perl.exe
my $dirstr = 'D:/Zulfi/dir1';
print $dirstr;
$fileName = $dirstr . "/data1.pl";
mkdir $dirstr unless -d $existingdir; # Check if dir exists. If not create it.
open (MYFILE, ">$fileName");
print MYFILE "Bobaaaaaaaaaaaaaa\n";
print MYFILE "Bobaaaaaaaaaaaaaa\n";
print MYFILE "Bobaaaaaaaaaaaaaa\n";
close (MYFILE);
open (MYFILE, ">TestFile") || die "\n Could not create write file.\n\n";
print MYFILE `perl $fileName`;
close (MYFILE);
D:\Zulfi\PERL MAIN FOLDER>dir TestFile
Volume in drive D has no label.
Volume Serial Number is 8E4F-05BE
Directory of D:\Zulfi\PERL MAIN FOLDER
11/11/2013 08:35 PM 0 TestFile
1 File(s) 0 bytes
0 Dir(s) 524,333,301,760 bytes free
D:\Zulfi\PERL MAIN FOLDER>cd ..
D:\Zulfi>cd dir1
D:\Zulfi\dir1>type data1.pl
Bobaaaaaaaaaaaaaa
Bobaaaaaaaaaaaaaa
Bobaaaaaaaaaaaaaa
D:\Zulfi\dir1>
Kindly guide me.
Zulfi.
Comment