Solved

perl file output could not start from left top?

Posted on 2000-03-13
6
180 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

11 Experts available now in Live!

Get 1:1 Help Now