X-Apparently-To: dlyzxl@yahoo.com via 206.190.38.149; Sat, 02 Oct 2004 02:18:31 -0700
X-Originating-IP: [63.251.223.186]
Return-Path: <beginners-cgi-return-11450-dlyzxl=yahoo.com@perl.org>
Received: from 63.251.223.186 (HELO lists.develooper.com) (63.251.223.186)
by mta120.mail.sc5.yahoo.com with SMTP; Sat, 02 Oct 2004 02:18:31 -0700
Received: (qmail 11580 invoked by uid 514); 2 Oct 2004 09:18:25 -0000
Mailing-List: contact beginners-cgi-help@perl.org; run by ezmlm
Precedence: bulk
List-Post: <mailto:beginners-cgi@perl.org>
List-Help: <mailto:beginners-cgi-help@perl.org>
List-Unsubscribe: <mailto:beginners-cgi-unsubscribe@perl.org>
List-Subscribe: <mailto:beginners-cgi-subscribe@perl.org>
Delivered-To: mailing list beginners-cgi@perl.org
Delivered-To: moderator for beginners-cgi@perl.org
Received: (qmail 3470 invoked from network); 2 Oct 2004 02:08:13 -0000
Delivered-To: beginners-cgi@perl.org
X-Spam-Status: No, hits=-4.8 required=8.0
tests=BAYES_00,HTML_MESSAGE
X-Spam-Check-By: la.mx.develooper.com
To: beginners-cgi@perl.org
Date: Fri, 01 Oct 2004 22:07:56 -0400
From: David Kirol <dkirol@isp.com>
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.7) Gecko/20040616
X-Accept-Language: en-us, en
MIME-Version: 1.0
Subject: Re: undefined value error
References: <20040924001358.76078.qmail@web51106.mail.yahoo.com>
In-Reply-To: <20040924001358.76078.qmail@web51106.mail.yahoo.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Posted-By: 68.118.191.248
Content-Length: 1042
Xiangli Zhang wrote:
> I got the following error when one cgi file 'test.cgi' was called from HTML:
>
> Can't call method "sequence" on an undefined value
>
> However I can run 'test.cgi' with command 'perl test.cgi' correctly.
>
> Can anybody help me figure out the problem?
>
> The following is my code: error happened on bold lines.
>
> thanks,
>
>
> #!/usr/bin/perl
> use CGI;
> use CGI::Carp qw(fatalsToBrowser);
> use warnings;
> use diagnostics;
> use DNAalign;
> use fastream;
> use DNAseq;
> print "Content-type: text/html\n\n";
> print "<html><head><title>Perl CGI Example # 2";
> print "</title></head><body><h1>";
> print "Alignment Result </h1><p>";
> print "<pre>";
> chdir("/srv/www/httmp/default/chromat_dir");
> my $seq1=fastream->new("default.fasta.screen.contigs");
> my $seq2=fastream->new("secondFile");
> my $test1=$seq1->next_seq();
> my $test2=$seq2->next_seq();
> my $s1=$test1->sequence();
> my $s2=$test2->sequence();
> print "input1===$s1\n";
> print "input2===$s2\n";
> ($sa,$sb)=DNAalign::align($test1,$test1);
> $result1=$sa->sequence();
> $result2=$sb->sequence();
> print "\n";
> print "result1=== $result1\n";
> print "result2=== $result2\n";
> print "</pre>";
> print "</p>";
> print "</body></html>";
>
>
>
> Xiangli Zhang (Justin)
> 306-310 Decaire Street, Coquitlam
> BC, Canada, V3K 6X1
> phone: 604-9399181
>
>
> Xiangli Zhang (Justin)
> 306-310 Decaire Street, Coquitlam
> BC, Canada, V3K 6X1
> phone: 604-9399181
>
>
> ---------------------------------
> Post your free ad now! Yahoo! Canada Personals
>
Justin,
I think you are making a basic 'cgi' error. The error may stem from the
fact that the 'State' of the html page cannot change once it is printed.
Try moving all of the statements that might change the state of the
script (i.e.
chdir("/srv/www/httmp/default/chromat_dir");
my $seq1=fastream->new("default.fasta.screen.contigs");
my $seq2=fastream->new("secondFile");
my $test1=$seq1->next_seq();
my $test2=$seq2->next_seq();
my $s1=$test1->sequence();
my $s2=$test2->sequence();
and so on)
ahead of the html header
print "Content-type: text/html\n\n";
Let me know how you make out.
Dave
--
To unsubscribe, e-mail: beginners-cgi-unsubscribe@perl.org
For additional commands, e-mail: beginners-cgi-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>