Find the answer to your Linux question:
Results 1 to 4 of 4
Hello everyone, a current project of mine is to write a Perl script to generate a webpage that allows one to browse his/her local manpages. The problem is that I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Engineer Javasnob's Avatar
    Join Date
    Jul 2005
    Location
    Wisconsin
    Posts
    942

    A Dynamic webpage


    Hello everyone, a current project of mine is to write a Perl script to generate a webpage that allows one to browse his/her local manpages. The problem is that I don't know how to set a link to go to the output of a program. Here's some sample code:
    Code:
    open(FILE, "> $file") || die ("Couldn't open $file: $!\n");
    print FILE "<html>\n";
    print FILE "<head><title>Local Manpage Browser</title></head>\n";
    print FILE "<body>\n";
    print FILE "<a href=\"browsegen.pl\">All sections</a>\n";
    print FILE "<a href=\"browsegen.pl 1\">Section 1</a>\n";
    # Other man sections go here
    system "firefox $file";
    So the object to is write this temporary HTML document to a file and then open Firefox on it. browsegen.pl is a program that generates a set of links to all the manpages in the specified section, or all sections if none is specified. The problem is that when I click on the links generated, they try to download browsegen.pl. (Which I expected, but just had to try it) I tried using <form>, but I just don't think that the submit buttons look very clean. Is there anyway to link to a program without a <form>?

    Thanks for all your help!

  2. #2
    Banned CodeRoot's Avatar
    Join Date
    Sep 2005
    Posts
    567
    If I understand you correctly, I may be able to help you. But, let me ask you a couple of questions first:

    1. Are the 'man' pages in HTML format (or some format that can be loaded directly by the browser)?
    2. What type of links does your 'browsegen.pl' program produce - UNIX [file structure] or HTML [code]?

  3. #3
    Linux Engineer Javasnob's Avatar
    Join Date
    Jul 2005
    Location
    Wisconsin
    Posts
    942
    Here are the answers to your questions:

    1. The manpages are in their default format, but the program is designed to convert them on the fly with zcat and man2html.

    2. browsegen.pl produces full HTML code. Sample output should look something like this:
    Code:
    % browsegen.pl 1
    <html>
    <head><title>Local Manpages&#58; Section 1</title></head>
    <body>
    <-- Links to manpages go here; the links actually activate zcat $manpage | man2html to
          convert the pages into HTML on the fly. -->
    </body>
    </html>

  4. #4
    Banned CodeRoot's Avatar
    Join Date
    Sep 2005
    Posts
    567
    If I understand you correctly, I may be able to help you.
    Or, maybe not... (this time, anyway... )

    I am not sure of how you would do this with "just" HTML -- you might have to use java...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •