Solved

perl file output could not start from left top?

Posted on 2000-03-13
6
188 Views
Last Modified: 2010-03-05
I use the following perl file , use table , try to output datafile, how come the
output html fail to start from left-top corner? how to format it start from the left-top beginning?


#!/usr/local/bin/perl  

require "cgi-lib.pl";

# Use the
use Getopt::Long;
use English;
use AnyDBM_File;


print "Content-type: text/html\n\n";
print"<html>\n";
print"<head>\n";

print"<title>please fill out</title>";
print"</head>";

print"<body>";

# Set up the command line options.
my $ret            = GetOptions ("d|database:s");

my $database   = "convert.dbm";
my (%contents,$count,$type,$name,$price,$desc,$record);

# Open the DBM database file.
dbmopen (%contents, $database, 0700) || die "Could not open DBM file $database : $!\n";

# Force the top of page.
$FORMAT_LINES_LEFT = 0;
$count = 0;



print"<table>";

      print "<tr>";
        print"<td>Count Item # </td>";
        print"<td>Item Type </td>";
        print"<td>Item Name </td>";
        print"<td>Price </td>";
        print"<td>Description</td>";
        print"</tr>";


# Start printing out the dbm information.
for $number (sort keys %contents)
{
   # Get the contents from the hash.
   $record = $contents{$number};

   # Split the record up.
   ($type,$name,$price,$desc) = split (/\|/, $record);
   $count++;

   # Write it...
      #write
      print "<tr>";
      print"<td> $count</td>";
      print"<td> $type</td>";
      print"<td> $name</td>";
      print"<td> $price</td>";
      print"<td> $desc</td>";

      print"</tr>";
      print"<br>\n";

}

print"</table>";
print"</body>\n";

print"</html>\n";


# Close the DBM database.
dbmclose %contents;
0
Comment
Question by:syu1
  • 3
  • 2
6 Comments
 
LVL 16

Accepted Solution

by:
maneshr earned 50 total points
ID: 2613998
add this line of HTML code before print "<table>";

                   NOTE:    

                   TOPMARGIN and LEFTMARGIN establish margins in MSIE.
                   MARGINHEIGHT and MARGINWIDTH establish margins in Netscape.

                   print "<BODY TOPMARGIN=0 LEFTMARGIN=0 MARGINHEIGHT=0
                    MARGINWIDTH=0> \n";
0
 

Author Comment

by:syu1
ID: 2614415
sorry , I try , it dont work at all!
0
 

Author Comment

by:syu1
ID: 2614517
sorry , I try , it dont work at all!
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 16

Expert Comment

by:maneshr
ID: 2614545
are you using frames???

0
 
LVL 16

Expert Comment

by:maneshr
ID: 2617218
you have duplicate postings of this question. please delete one of them.
0
 
LVL 3

Expert Comment

by:jyu_88
ID: 2617908
run it from the command line and capture the HTML to a file. try to view the file yourself and also post the HTML here.

CGI.pm is preferred over old cgi-lib.pl.
-cut-----cut------cut-----cut---
#! /usr/bin/perl -w
use CGI;
my $query = new CGI;
print query->header(-type=>'text/html');
print $query->start_html(-title=>'please fill out');
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now