Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

cgi file not printing anything

by rjsaulakh (Beadle)
on Dec 17, 2005 at 12:00 UTC ( #517472=perlquestion: print w/ replies, xml ) Need Help??
rjsaulakh has asked for the wisdom of the Perl Monks concerning the following question:

#!/usr/bin/perl use CGI; my $cgi=new CGI; print $cgi->header; #here im using rows module in which i am calculating the no of rows use rows; $count = 0; open (FIN, "data.txt") or die "cant open the file "; while(<FIN>) { $count++ } $totalcount= $count; print "$totalcount \n \n "; #so put all the values inside an array say @total. $no_per_page=3; $total_pages=int((scalar $totalcount) / $no_per_page); print "$total_pages \n \n "; $remainder = (scalar $totalcount) % $no_per_page; if ($remainder) { $total_pages++; print $total_pages; } if($total_pages) { print <<"END"; <table cellpadding="0" cellspacing="0" bor +der="0" width="100%"> <tr> <td class="smtxt"> END print "<b>Page&nbsp;</b>"; for $i (1 .. $total_pages) { if ($i == $page) { print "<b>$i</b>"; } else { print "<a href=\"winner.cgi?page=$i&period=$p +eriod\">$i</a>"; } if ($i != $total_pages) { print "&nbsp;|&nbsp;"; } } print "<!-- '$total_pages' '$remainder' --></td></tr></table>\ +n"; }

Comment on cgi file not printing anything
Download Code
Re: cgi file not printing anything
by chas (Priest) on Dec 17, 2005 at 12:54 UTC
    I never heard of the "rows" module. Are you sure the spelling is correct with regard to case?
    (Update: And how are you using it? Try perl -c on your script. If there isn't such a module that could be the problem.)
    Maybe you need to specify the full path to "data.txt". You could try use CGI::Carp qw(fatalsToBrowser); to see possible errors.

      i am able to solve this problem

Re: cgi file not printing anything
by reneeb (Chaplain) on Dec 17, 2005 at 23:20 UTC
    use strict; and use warnings; could be very helpful.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://517472]
Approved by fxmakers
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2014-11-29 07:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (204 votes), past polls