Well..... Actually, I don't know what your code is meaning deep...
but from the expected results, I suggest you may write in this way :


#!/usr/bin/perl

# name this script as "thisscript.pl", for example.

 $query = $ENV{QUERY_STRING};
 if ($query eq "") {$query = 1}; # Set default page if user just typed
http://yourdomain.com/yourid/thisscript.pl

 if ($query == 1)  { $ignore_prev = 1}; # If user is in the first page
 if ($query >= 10) { $ignore_next = 1 }; # 10 is just an var for index the
 last page

 $prev = $query-1;
 $next = $query+1;

 print "Content-Type:text/html \n\n"; # Keep this line alone, I don't know
why, but good for CGI.
print "<title>Endless</title><html><body> The Currect page is $query <p>";

 if ($ignore_prev != 1) { print "<a href=thisscript.pl?$prev>Perious
Page</a>" }
 if ($ignore_next != 1) { print " | <a href=thisscript.pl?$next>Next
Page</a>"}

 print "</body></html>";

#===========================================================================

 In case, I do not have so much experience to working on a terminal, maybe
my coding behovior maybe quite stupit. But they works, hope it would be
helpful








----- Original Message -----
From: Derek Duhon <[EMAIL PROTECTED]>
To: Derek Duhon <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, June 04, 2001 2:23 PM
Subject: Re: problem


>
> ----- Original Message -----
> From: "Derek Duhon" <[EMAIL PROTECTED]>
> To: "鏡花水月" <[EMAIL PROTECTED]>
> Sent: Sunday, June 03, 2001 11:22 PM
> Subject: Re: problem
>
>
> > An update on my little problem
> > I took the advice many of you gave me, and escaped out the quotes, which
> did
> > in fact prove helpful, although my current dilemma is still more
> > interesting.
> >
> > As you know, environment variables when running the perl script from
> > terminal, and as a cgi through a web browser, are different.  Since %ENV
> is
> > an associative array, I made things a little easier by putting it in a
> > normal array and referencing where I think the value of query string is,
> > whether or not this is correct in the web browser I do not know.  First,
> > here is my source
> >
> > #!/usr/local/bin/perl
> > $" = "\n";
> > @ENV = %ENV;
> > $current = $ENV[20];
> > $next = $current + 1;
> > $prev = $current - 1;
> > $output = "Content-type:
> > text/html\n\n<HTML><HEAD><TITLE>Endless!</TITLE></HEAD>
> > <BODY BGCOLOR = \"#000000\"><FONT COLOR = \"red\"><H5>$current</H5>
> > <HR COLOR = \"red\"><A HREF = endless?$prev>Previous Page</a> | <A HREF
=
> > endless?$next>Next Page</A>
> > </FONT></BODY></HTML>";
> > print $output;
> >
> > I know the assignment and subsequent printing of $output seems
pointless,
> > but it was my last experiment to see if I could get it to work.  Now,
> herein
> > lies the peculiarity.  When I run this script in terminal, I get the
> > following output
> >
> > Content-type: text/html
> >
> > <HTML><HEAD><TITLE>Endless!</TITLE></HEAD><BODY BGCOLOR =
"#000000"><FONT
> > COLOR = "red"><H5>USER</H5><HR COLOR = "red"><A HREF =
endless?-1>Previous
> > Page</a> | <A HREF = endless?1>Next Page</A></FONT></BODY></HTML>
> >
> > in terminal, the key user is in the place where the value of query
string
> > would be in browser (i think).  This code seems to work perfectly in
every
> > way in the browser, except for the fact that it simply does not want to
> read
> > in the value of the variables, as you can see at
> > http://i.got.denied.net/~hentai69/cgi-bin/endless
> >
> > if anyone is curious, the exercise I am trying to do was gotten from
this
> > page
> > http://www.comp.leeds.ac.uk/Perl/Cgi/environment.html
> >
> > I hope my future perl programs don't have this much trouble...
> >
> > P.S. if you want to suggest I try putting the variable names into
$(name)
> > format, I already tried it to no avail
> >
> >
> >
> >
> >
> > ----- Original Message -----
> > From: "鏡花水月" <[EMAIL PROTECTED]>
> > To: "Derek Duhon" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > Sent: Sunday, June 03, 2001 8:20 AM
> > Subject: Re: problem
> >
> >
> > > I think you may try to use  :
> > >
> > > print "Content-type: text/html\n\n";
> > > print "<html>...........";
> > > print "other statements";
> > >
> > >
> > >
> > >
> > > ----- Original Message -----
> > > From: Derek Duhon <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Sunday, June 03, 2001 11:29 AM
> > > Subject: problem
> > >
> > >
> > > I have a print statement that prints out an html page, and after a lot
> of
> > > tinkering, I still can't get it to work.  It prints out the html
> > perfectly,
> > > but I can't seem to find a way for it to print the contents of the
> scalar
> > > statements.  The print statement is encased in "".  Here is my source
> > >
> > > #!usr/local/bin/perl
> > > #
> > > #Program to generate endless webpage
> > > $current = $ENV{"QUERY_STRING"};
> > > $next = ++$current;
> > > $prev = --$current;
> > > print "Content-type:
> > > text/html\n\n<HTML><HEAD><TITLE>Endless!</TITLE></HEAD><BODY BGCOLOR =
> > > "#000000"><FONT COLOR = "red"><H5>$current</H5><HR COLOR = "red"><A
HREF
> =
> > > "endless?$prev">Previous Page</a> | <A HREF = "endless?$next">Next
> > > Page</A></FONT></BODY></HTML>";
> > >
> > >
> > >
> >
>

Reply via email to