A
ashwani
Hi
i am writting a new module service_ini.
here is the code which is using the module:
#!/usr/bin/perl
#use strict;
use warnings;
BEGIN {
push @INC, 'D:/Strech Goals/Unit test Automation/Development/
service_ini/lib';
}
use service_ini;
my %this = (SERVICE_INI_FILE_NAME => "sgutat.ini");
$this{'TRACE_FILE_NAME'} = "D:/Strech Goals/Unit test Automation/
Development/input files/OC_CC_C2_002.tra";
$this->{'SERVICE_INI_FD'} = service_ini:penServiceIni();
$this->{'SERVICE_INI_PARAM'} = service_ini::ReadServiceINIParam($this-
open(TraFD,$this->{'TRACE_FILE_NAME'}) || die "Can't open file $this-
while(my $line = <TraFD>)
{
chomp($line);
if ($line =~ m/(State)(\[[0-9]+\]) ([0-9]+), SIB(\w+\/\w+)((\/\w
+)*))/)
{
print "\nLine = $line";
print "\nState No: $3";
print "\nSIB Name: $4\n";
}
}#end of while
print "\nclosing $this->{'TRACE_FILE_NAME'}";
close(TraFD)|| die "Can't close file: $this->{'TRACE_FILE_NAME'}";
and code of service_ini module is
______________________________________________________
package service_ini;
#require Exporter;
#use AutoLoader qw(AUTOLOAD);
#our @ISA = qw(Exporter);
# Items to export into callers namespace by default. Note: do not
export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
# This allows declaration use service_ini ':all';
# If you do not need this, moving things directly into @EXPORT or
@EXPORT_OK
# will save memory.
#our %EXPORT_TAGS = ( 'all' => [ qw(
#) ] );
#our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
#our @EXPORT = qw(
#);
#our $VERSION = '0.01';
# Preloaded methods go here.
# Autoload methods go after =cut, and are processed by the autosplit
program.
#1;
#__END__
# Below is stub documentation for your module. You'd better edit it!
=head1 NAME
service_ini - Perl extension for blah blah blah
=head1 SYNOPSIS
use service_ini;
blah blah blah
=head1 DESCRIPTION
Stub documentation for service_ini, created by h2xs. It looks like the
author of the extension was negligent enough to leave the stub
unedited.
Blah blah blah.
=head2 EXPORT
None by default.
=head1 SEE ALSO
Mention other useful documentation such as the documentation of
related modules or operating system documentation (such as man pages
in UNIX), or any relevant external documentation such as RFCs or
standards.
If you have a mailing list set up for your module, mention it here.
If you have a web site set up for your module, mention it here.
=head1 AUTHOR
A. U. Thor, E<lt>[email protected]<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2007 by A. U. Thor
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.6 or,
at your option, any later version of Perl 5 you may have available.
=cut
use 5.008006;
use strict;
use warnings;
my $service_ini_file_name = 'sgutat.ini'
#sub new {
#return $this;
#}
sub openServiceIni {
print "\nEntry in service_ini:penServiceIn";
my $FD=undef;
open($FD,$service_ini_file_name) || die "\ncan not open
configuration file $service_ini_file_name\n";
print "\nExit from service_ini:penServiceIni";
return $FD;
}
sub ReadServiceINIParam
{
print "\nEntry in service_ini::ReadServiceINIParam";
#my $FH = undef;
#open($FH,$service_ini_file_name) || die "\ncan not open
configuration file $service_ini_file_name\n";
print "\nExit from service_ini::ReadServiceINIParam";
}#end of ReadServiceINIParam
1;
______________________________________________________
but when i am compiling this it is giving error as
syntax error at D:/Strech Goals/Unit test Automation/Development/
service_ini/lib/service_ini.pm line 97, near "sub openServiceIni "
syntax error at D:/Strech Goals/Unit test Automation/Development/
service_ini/lib/service_ini.pm line 103, near "}"
Compilation failed in require at Main.pl line 9.
BEGIN failed--compilation aborted at Main.pl line 9.
i am writting a new module service_ini.
here is the code which is using the module:
#!/usr/bin/perl
#use strict;
use warnings;
BEGIN {
push @INC, 'D:/Strech Goals/Unit test Automation/Development/
service_ini/lib';
}
use service_ini;
my %this = (SERVICE_INI_FILE_NAME => "sgutat.ini");
$this{'TRACE_FILE_NAME'} = "D:/Strech Goals/Unit test Automation/
Development/input files/OC_CC_C2_002.tra";
$this->{'SERVICE_INI_FD'} = service_ini:penServiceIni();
$this->{'SERVICE_INI_PARAM'} = service_ini::ReadServiceINIParam($this-
{'SERVICE_INI_FD'});
open(TraFD,$this->{'TRACE_FILE_NAME'}) || die "Can't open file $this-
print "\n$this->{'TRACE_FILE_NAME'} has opened";{'TRACE_FILE_NAME'}" ;
while(my $line = <TraFD>)
{
chomp($line);
if ($line =~ m/(State)(\[[0-9]+\]) ([0-9]+), SIB(\w+\/\w+)((\/\w
+)*))/)
{
print "\nLine = $line";
print "\nState No: $3";
print "\nSIB Name: $4\n";
}
}#end of while
print "\nclosing $this->{'TRACE_FILE_NAME'}";
close(TraFD)|| die "Can't close file: $this->{'TRACE_FILE_NAME'}";
and code of service_ini module is
______________________________________________________
package service_ini;
#require Exporter;
#use AutoLoader qw(AUTOLOAD);
#our @ISA = qw(Exporter);
# Items to export into callers namespace by default. Note: do not
export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
# This allows declaration use service_ini ':all';
# If you do not need this, moving things directly into @EXPORT or
@EXPORT_OK
# will save memory.
#our %EXPORT_TAGS = ( 'all' => [ qw(
#) ] );
#our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
#our @EXPORT = qw(
#);
#our $VERSION = '0.01';
# Preloaded methods go here.
# Autoload methods go after =cut, and are processed by the autosplit
program.
#1;
#__END__
# Below is stub documentation for your module. You'd better edit it!
=head1 NAME
service_ini - Perl extension for blah blah blah
=head1 SYNOPSIS
use service_ini;
blah blah blah
=head1 DESCRIPTION
Stub documentation for service_ini, created by h2xs. It looks like the
author of the extension was negligent enough to leave the stub
unedited.
Blah blah blah.
=head2 EXPORT
None by default.
=head1 SEE ALSO
Mention other useful documentation such as the documentation of
related modules or operating system documentation (such as man pages
in UNIX), or any relevant external documentation such as RFCs or
standards.
If you have a mailing list set up for your module, mention it here.
If you have a web site set up for your module, mention it here.
=head1 AUTHOR
A. U. Thor, E<lt>[email protected]<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2007 by A. U. Thor
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.6 or,
at your option, any later version of Perl 5 you may have available.
=cut
use 5.008006;
use strict;
use warnings;
my $service_ini_file_name = 'sgutat.ini'
#sub new {
#return $this;
#}
sub openServiceIni {
print "\nEntry in service_ini:penServiceIn";
my $FD=undef;
open($FD,$service_ini_file_name) || die "\ncan not open
configuration file $service_ini_file_name\n";
print "\nExit from service_ini:penServiceIni";
return $FD;
}
sub ReadServiceINIParam
{
print "\nEntry in service_ini::ReadServiceINIParam";
#my $FH = undef;
#open($FH,$service_ini_file_name) || die "\ncan not open
configuration file $service_ini_file_name\n";
print "\nExit from service_ini::ReadServiceINIParam";
}#end of ReadServiceINIParam
1;
______________________________________________________
but when i am compiling this it is giving error as
syntax error at D:/Strech Goals/Unit test Automation/Development/
service_ini/lib/service_ini.pm line 97, near "sub openServiceIni "
syntax error at D:/Strech Goals/Unit test Automation/Development/
service_ini/lib/service_ini.pm line 103, near "}"
Compilation failed in require at Main.pl line 9.
BEGIN failed--compilation aborted at Main.pl line 9.