[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


frames in perl

Posted on 1998-07-31
Medium Priority
Last Modified: 2010-03-05

How do get frames happening in perl?  I have a page that outputs info in a txt file into a table of cells, it is super long and i would like to retain the top headings for greater readabiltiy.  Can i do this somehow, if so how?

Once again, since i haven't a clue about how hard this is, if the answer looks complicated i will boost the pts.

Question by:generous
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2

Accepted Solution

alamo earned 200 total points
ID: 1208959
You can't do it with a single call to your script.

A frameset with 2 frames requires the browser to get 3 pages: the main page (frameset) and each of the frames. So what you need to do is have a way in your program to generate each of the 3 pages. (You could have the heading be a static page, not generated dynamically, but the page with the table needs to have its parameters passed to it which means the frameset needs those parameters.

There are two main ways to do this: a different script to generate each page, or a hidden field which tells the same script which page to generate.

Ok, that's how to do frames, but here's why frames aren't necessarily the best idea:

In many cases the table headings won't line up exactly with the table any more, if you separate them. This is because the browser dynamically sizes each column, using the information you give it as a guide but not as absolute dimensions. This won't look good. The solution to that is to re-print your column headings every so many rows in your table, every 25 rows for example.

The idea of one huge table has a big drawback anyway, if it's big enough: it will take a long time to load, and the browser usually won't show any of it until it's all loaded (so it knows how to size it). This means your users are looking at nothing for a while. The solution to this is to break up the table into many smaller tables, for example end the table after 25 rows and start a new one. This is only necessary with really large tables.

One more thought: I think there's a way to get a header which stays visible using pure HTML, without frames. This would only work on the latest browsers but might be the most elegant solution. I don't know the details or if it truly works - I suggest you ask this question over in the HTML section.

Hope this helps!

Expert Comment

ID: 1208960
alamo, are you referring to style sheets?
(Note, I'm not even close to sure how those work...)

Expert Comment

ID: 1208961
Yes, style sheets and layers. I have seen questions asked at EE over in the HTML section that make me think it could work, but I never followed the discussion enough to know myself how to do it.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 1208962
Wow, what an answer!  Umm, only it does not spell it out for me.  How is this for a strategy.   The script writes the dynmaic info to a file (not completely sure how to do this), then it calls the frameset file (using location:). The thrid file is hard coded with the heading.

Could you provide me with the code to write to that file?  Is it simply
    print tablefile "<td><b>$currenttotal</b></td>\n";   #this being done for each bit of info

Will this work?

Pls note, the issues you have raised about the table's loading time and apperence are occuring right now, but have been decided to be "liveable".

Expert Comment

ID: 1208963
There's a possible problem there, it all depends on how your generate the information.

The problem arises in the fact that there is a single copy of bottom.html for everyone. That means if two people load the page at the same time, one may get the other's info. And more likely, if someone hits reload (or in some cases uses the Back button) they will get the latest copy of bottom.html, not the one they generated.

In some applications this is no problem, the script just generates a page with the latest info anyway, rather than a different page based on what the user asked for. If yours is like this, then what you propose will work. You need to open the file for output with
so that you can write to it. You also need to print the entire html page, not just  the <td> ... </td> bits.

If however the page you generate is different for each user and each time its loaded, a much better approach is to not use Location: for the frameset but instead for your main script to print the frameset page itself in response to the original request, and make the bottom frame a link to another script (or the same script with an additional parameter). The second script would then dynamically generate the page, just like your current script. This only works for scripts loaded from a GET form or link, not a POST, so that the URL of the bottom frame can include all the info needed to generate the page. If it works for you though, you can avoid dealing with multiple temporary files.

Let me know which approach of the above you will take, and I can provide more info if needed.

Author Comment

ID: 1208964

I got the frames to work by writing the ouput to one of the three frame html files.  The issuse of multiple viewers of bottom.html is not a concern, just as you suggested, it is only a listing of current info.  However in the future i might make the files tmp and be erased upon clicking of a button, if privacy issues do arise.

But the location is not working.  Could it be b/c of it is below the print "content-type: text/html\n\n"; line.  I can never understand how that line effects so much of my code.  Where should the location line go?

Ps.  If you do not answer, Thanks Alamo I have learned alot from this attempt and your advice.

Expert Comment

ID: 1208965
When you use Location it should be the only line you print  and should have \n\n at the end.

print "Location: http://whatever.com/etc\n\n";

You are telling the browser to go somewhere else - the place you send it will set its own Content-type and other headers.

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
Six Sigma Control Plans

650 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