Hi monks!
While compiling this CGI script perl -c serve.pl it is showing errors,
Misplaced _ in number at serve.pl line 44.
Misplaced _ in number at serve.pl line 44.
Bareword found where operator expected at serve.pl line 44, near "0_CREAT"
(Missing operator before CREAT?)
syntax error at serve.pl line 44, near "0_CREAT "
syntax error at serve.pl line 48, near "}"
serve.pl had compilation errors.
all related to sysopen lines. I am not able to figure out the problem.
Any suggestions!! pl
#!/usr/bin/perl -w
use strict;
use CGI;
use Fcntl qw(:DEFAULT :flock);
#$query->cgi_errror and error($query, "Error transferring file: " . $q
+uery->cgi_error );
#SUB error needs to be completed
print "Content-type:text/html\n\n";
#Declaring constants
use constant UPLOAD_DIR => "/usr/local";
use constant MAX_FILE_SIZE => 1_048_576; #Limit each upload to 1MB
use constant MAX_OPEN_TRIES => 100;
use constant BUFFER_SIZE => 16_384;
# New object
my $query = new CGI;
my $file = $query->param('fname');#|| error ($query, "No file r
+eceived.");
my $fh = $query->upload("$file");
#y $buffer = "";
my $filename = "";
#y @annotation = "";
my @list = "";
$query->header();
$query->start_html();
$query->startform();
################# IF file has been uploaded ##########################
+###
if($file)
{
$file =~ s/[^\w.-]/_/g; #Rectifying the string for name of the fil
+e
if($file=~ /^(\w[\w.-]*)/)
{
$file = $1;
}
else
{
error($query, "Invalid file name; file must start with a letter or n
+umber.");
}
until (sysopen OUTPUT, UPLOAD_DIR . $file, 0_CREAT )
{
$file =~ s/(\d*)(\.\w+)$/($1||0)+1 .$2/e;
$1 >= MAX_OPEN_TRIES and error ($query, "Unable to save your file");
}
while(read($fh, $buffer, BUFFER_SIZE)) #Write content to OUTPUT file
{
print OUTPUT $buffer;
}
close OUTPUT;
$filename = $file.'.'.'fasta';
if($format eq "embl")
{
embl_fasta();
}
elsif($format eq "genbank")
{
genbank_fasta();
}
open(IN,"UPLOAD_DIR/$filename");
my $one = 0;
my $header;
my $prevhead;
my $sequence;
#reading the genome sequence
my $x=1;
while(<IN>)
{
my $seqline = $_;
$seqline =~ s/\n//g;
if($seqline =~ /^>/g)
{
if($one == 0)
{
$header = $seqline;
$prevhead = $header;
$sequence = '';
$one++;
next;
}
else
{
$header = $seqline;
$annotation[$x]=$prevhead;
$list[$x]=$sequence;
$x++;
$prevhead = $header;
$sequence = '';
next;
}
}#end if $seqline
$sequence = $sequence.$seqline;
$sequence =~ s/\s//g;
}#end while<IN1>
close(IN);
$annotation[$x]=$prevhead;
$list[$x]=$sequence;
} # If Sequence has been uploaded
################# Opening of each sequence ###########################
+####
my $z=0;
for $name(@annotation)
{
my $sequence="";
$sequence = $list[$z];
print "$sequence";
$z++;
print "<B> <center><h2>PROMOTER PREDICTION AT A SENSITIVITY LEVEL </h2
+></center><br><br>";
print " <body bgcolor=\"#E0E0E0 \">";
print "<B><em><font color=\"#800000\"> Sequence ID :</em></font>  
+; </B>$sequence<br>";
print "<br><BLINK><font color=\"#800000 \">RESULTS</font><br><br> </BL
+INK></B>";
print "<hr>";
print "<h3><font color=\"#800000\">FORWARD STRAND</font></h3><br>";
print "<hr>";
}
$query->endform();
$query->end_html();