Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^9: Need help with pagination

by hippo (Bishop)
on Jan 01, 2023 at 12:19 UTC ( #11149257=note: print w/replies, xml ) Need Help??


in reply to Re^8: Need help with pagination
in thread Need help with pagination

Unbelievable error ..

Quite so - it is indeed very hard to believe. Your code as posted works fine:

$ cat 11149222.pl #!/usr/bin/perl use strict; use warnings; print "Content-type: text/html\n\n"; print "Hello World!"; $ perl 11149222.pl Content-type: text/html Hello World!$ perl -v | head -3 This is perl 5, version 34, subversion 0 (v5.34.0) built for x86_64-li +nux-thread-multi $

🦛

Replies are listed 'Best First'.
Re^10: Need help with pagination
by *alexandre* (Beadle) on Jan 01, 2023 at 15:55 UTC
    Here the code snippet I do do now
    #!c:/xampp/perl/bin/perl.exe use warnings; use CGI; use Time::HiRes qw(gettimeofday); my $query = CGI->new; my $dir = "C:/Users/41786/OneDrive/Documents/recordz1/"; print $query->header; test(); sub test { open (FILE, "<$dir/test2.html") or die "cannot open file $dir/test +2.html"; my $content = ""; my $string .= "<a href=\"/cgi-bin/recordz.cgi?lang=FR&amp;session= +1&page=historique&amp;article=1amp;min_index=1&amp;max_index=40\" ><- +1-></a>&#160;&nbsp;"; while (<FILE>) { s/\$ARTICLE{'index'}/$string/g; $content .= $_; } print "Content-Type: text/html\n\n"; print $content; close (FILE); }
        Doesn't work by the way when I run the following code
        #!c:/xampp/perl/bin/perl.exe use warnings; use CGI; use Time::HiRes qw(gettimeofday); my $query = CGI->new; my $dir = "C:/Users/41786/OneDrive/Documents/recordz1/"; print $query->header; test(); sub test { my $counter = 10000; #Should be ge from db; my $string = ""; open (FILE, "<$dir/test2.html") or die "cannot open file $dir/test +2.html"; my $content = ""; my $nb_page = round ($counter / 40, 1);#Number of objects display +ed per page. for (my $i = '0'; $i < $nb_page+ 1;$i++) { my $n2 = $i %= 10; $min_index += 40; $string .= "<a href=\"/cgi-bin/recordz.cgi?lang=FR&amp;session +=1&page=historique&amp;article=1amp;min_index=$min_index&amp;max_inde +x=40\" ><-$n2-></a>&#160;&nbsp;"; $nb_page--; } while (<FILE>) { s/\$ARTICLE{'index'}/$string/g; $content .= $_; } print $content; close (FILE); } sub round { my $n = shift || ''; my $r = sprintf("%.0f", $n); return $r; }
        The result I'm getting in my web page is the following : <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5-> <-6-> <-7-> <-8-> <-9-> <-0-> <-1-> <-2-> <-3-> <-4-> <-5->

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11149257]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2023-03-21 18:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (60 votes). Check out past polls.

    Notices?