Re: preview HTML without a browser?
by derby (Abbot) on Jun 06, 2007 at 18:10 UTC
|
What will you be previewing with? There are plenty of programs/modules that convert HTML to other formats (PDF::FromHTML) but you need to supply more info (and code) about what you're trying to accomplish.
| [reply] |
|
|
It's very basic HTML code, maybe an img tag, and a few link tags but I would like to have Perl display the HTML 'somehow' without previewing it in a browser if possible. I see that there are a few cryptic browsers built with Perl that might work.
Thanks
| [reply] |
Re: preview HTML without a browser?
by marto (Cardinal) on Jun 06, 2007 at 21:09 UTC
|
If by "Without a browser" you mean without Opera,Firefox or whatever then you could have a look at tkweb, I am not sure if this suits your requirements.
Hope this helps
Martin | [reply] |
Re: preview HTML without a browser?
by swampyankee (Parson) on Jun 06, 2007 at 20:49 UTC
|
Some word processing programs, e.g., OpenOffice Writer or MS Word, can render HTML. Searching through CPAN, I found Mail::LMLM::Render::HTML, which may be do what you want.
emc
Any New York City or Connecticut area jobs? I'm currently unemployed.
There are some enterprises in which a careful disorderliness is the true method.
—Herman Melville
| [reply] |
Re: preview HTML without a browser?
by GrandFather (Saint) on Jun 06, 2007 at 22:59 UTC
|
What do you mean preview? You could look at it with a text editor. You could strip the mark up and just look at the text. You could write an HTML viewer using something like Tk, but then you start crossing the line into browser territory. You could leverage IE or Firefox to render the HTML for you "under the hood" - is that using a browser? You could open the HTML directly with something like Firefox, but then you really are using a browser.
Yes, the question is silly. Is is silly because it doesn't provide enough context. A good answer needs the question to say why you want to do that and why you can't just use a browser.
DWIM is Perl's answer to Gödel
| [reply] |
Re: preview HTML without a browser?
by Grundle (Scribe) on Jun 06, 2007 at 21:07 UTC
|
Sure you can do this quite easily.
Basically all you need to do is spoof a web browser. If you look at the RFC for the http 1.1 protocol you can read all about it ftp://ftp.isi.edu/in-notes/rfc2616.txt
The following is how I used telnet to get get the HTML code for the opening page of google.com.
NOTE: For any HTML over SSL you would have to do some extra work... For my example ">" denotes what is returned to me by the server. Everything else I typed in.
$telnet google.com 80
>Trying 64.233.187.99...
>Connected to google.com.
>Escape character is '^]'.
GET http://www.google.com/ HTTP/1.1
>HTTP/1.1 200 OK
>Cache-Control: private
>Content-Type: text/html; charset=ISO-8859-1
>Server: GWS/2.1
>Transfer-Encoding: chunked
>Date: Wed, 06 Jun 2007 21:01:48 GMT
>Set-Cookie: >PREF=ID=b52be41e5ad2eb1b:TM=1181163708:LM=1181163708:S=Y
+1L>Lo7leE_1XL
>0KD; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; >domain=.google.c
+om
>Connection: Keep-Alive
...
#Here is the dump of the HTML that I don't want to paste.
| [reply] [d/l] |
Re: preview HTML without a browser?
by stonecolddevin (Parson) on Jun 07, 2007 at 00:11 UTC
|
CGI has a debug method you can use from the command line
Just run your script like you would any other perl script and append your form values after the perl file name and it will spit out the script's output.
| [reply] |
Re: preview HTML without a browser?
by Minimiscience (Beadle) on Jun 06, 2007 at 19:25 UTC
|
You could try stripping away all the tags (& the contents of the <HEAD> tag), leaving just the text, but I don't really see the point of your question. What's so bad about using a browser? | [reply] |
Re: preview HTML without a browser?
by guinex (Sexton) on Jun 06, 2007 at 19:36 UTC
|
| [reply] |
Re: preview HTML without a browser?
by naikonta (Curate) on Jun 07, 2007 at 03:23 UTC
|
| [reply] |
Re: preview HTML without a browser?
by J R Ramos (Initiate) on Dec 09, 2014 at 05:00 UTC
|
I’m having a similar or the same problem as Anonymous Monk. I want to build web pages on my lap top in areas where I don’t have internet access – no browser. So how do I see how the page is coming along without a functioning browser? | [reply] |
|
|
cd /path/with/my/html/
plackup -p 8080 -MPlack::App::Directory -e 'Plack::App::Directory->new
+->to_app'
Then images and HTML from that root can be used/previewed at http://localhost:8080/ or equivalent for your box. You can use Plack::Builder to do much more but that’s a good starter. More reading: Plack, Plack::App::Directory. If it’s not enough, come back with a fresh question; c.f., one not continuing this thread from 2007. :P Good luck | [reply] [d/l] [select] |
|
|
Why doesn't your browser function without Internet access?
All browsers that I have used are perfectly capable of viewing local HTML files (or connecting to an HTTP server running on localhost) without Internet access.
| [reply] |