[Bioperl-l] Permission denied when using Bio::SearchIO in CGI
script
Marcus Claesson
marcus at chah.ucc.ie
Mon Jan 27 12:29:01 EST 2003
Thanks for your answers!
> This is an error in your directory permissions or something (check the
> group read/write on teh file that is created with an ls -l). Bioperl
> does nothing "fancy" about opening files and can't change permissions
> (obviously) of a file.
I noticed that too but the problem is, though I can control
persmissions and locations on my own local files, I cannot do it on a
remote user's files. The purpose of this cgi script is for web users to
parse their local blast output files and upload the result file onto my
server.
The Bio::Search module behaves differently than the "PerlCGI-way" to open
files. Here's an example:
Both these methods work fine when I run the script on a local file with
the right permissions:
#!/usr/bin/perl -wT
use CGI qw(:standard);
use Bio::SearchIO;
print $q->filefield(-name=>'file', #A cgi function to browse and
select files to open
-size=>20),$q->br;
print $q->submit(-name =>'upload',
-value =>'Upload file'),$q->br;
if (param('upload')) {
$fh = $q->upload('file');
$in = new Bio::SearchIO(-format => 'blast',
-file => $fh);
while(<$fh>) {
print $_; }
while($result = $in->next_result) {
etc,etc... }
}
But when I try to open C:\Temp\blastfile.out from a remote windows station
I get this error message:
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: ------------- EXCEPTION -------------,
referer: http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: MSG: Could not open C:\Temp\blastfile.out
for reading: No such file or directory, referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: STACK Bio::Root::IO::_initialize_io
/usr/lib/perl5/site_perl/5.8.0/Bio/Root/IO.pm:244, referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: STACK Bio::Root::IO::new
/usr/lib/perl5/site_perl/5.8.0/Bio/Root/IO.pm:192, referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: STACK Bio::SearchIO::new
/usr/lib/perl5/site_perl/5.8.0/Bio/SearchIO.pm:121, referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: STACK Bio::SearchIO::blast::new
/usr/lib/perl5/site_perl/5.8.0/Bio/SearchIO/blast.pm:200, referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: STACK Bio::SearchIO::new
/usr/lib/perl5/site_perl/5.8.0/Bio/SearchIO.pm:134, referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: STACK toplevel
/var/www/cgi-bin/bxbrowser1.pl:25, referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: , referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: --------------------------------------,
referer: http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
Thus, Bio::Search can't even find the file. But to open it and print the
contents in the 'normal cgi-way' works fine i.e
while(<$fh>) {
print $_;
}
Howcome do you think?
Regards,
Marcus
More information about the Bioperl-l
mailing list