• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

how to open html file via cgi perl script!

 
Ranch Hand
Posts: 630
Android Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
This is my first question in Perl!
I am trying to write simple example of html & perl with Apache2 server.
some how I manage to do login page in html. By that if login successful then i can show hello world etc simple things.
But when I try to do complicated things like
1. I have abc.htm which has lots of complicated things inside buttons tables textboxes listboxes etc. by this abc.htm I will do some task then go to def.htm which will be same like this abc.htm .
2. I kept this abc.htm in folder /var/www/ .

trying to do:-
I want to open this abc.htm after successful login.

Here i write my cgi script:-



Problem:-
I cant open abc.htm after successful login.

Requirement:-
1. I need help/guidance/clue !
 
lowercase baba
Posts: 12986
66
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you are asking others to help you, generally you want to make it as easy as possible for them.

Most people won't even look at code that isn't properly formatted. I applaud your use of code tags, but if you don't properly indent your code, it's still virtually unreadable.

Can you please format it correctly and re-post?
 
Mandar Khire
Ranch Hand
Posts: 630
Android Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks fred rosenberger,
You wrote truth which I forgot that

Most people won't even look at code...




Now I solve this bug as mentioned

but if you don't properly indent your code, it's still virtually unreadable.


hope I will get some help!
 
Sheriff
Posts: 7111
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're trying to just redirect to a new website, I think you only print the "Location", that is, no "Content" line or any other "print".
 
Mandar Khire
Ranch Hand
Posts: 630
Android Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
As per webmasterworld Forum, I tried for redirect to Google website. If that works then I will try to abc.html which stored in /var/www folder.
I tried line as below:-

But I cant redirect properly.
Any Help?
 
Knute Snortum
Sheriff
Posts: 7111
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That looks like something from the CGI module, but you aren't using that. Did you try what I said?
 
Mandar Khire
Ranch Hand
Posts: 630
Android Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
When i write following cgi perl script, it will works:-

But this html not have any style!
example same Hello World with style as follows:-

Errors comes in '/var/log/apache2/' as follows:-


[error] [client xx.xxx.xx.xxx] File does not exist: /var/www/favicon.ico
[error] [client xx.xxx.xx.xxx] File does not exist: /var/www/favicon.ico
Bareword found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 23, near ""<html xmlns:v="urn"
(Missing operator before urn?)
String found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 23, near "vml"""
Bareword found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 24, near ""xmlns:o="urn"
(Missing operator before urn?)
String found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 24, near "office"""
Bareword found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 25, near ""xmlns:dt="uuid"
(Missing operator before uuid?)
Bareword found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 25, near "65B3"
(Missing operator before B3?)
Bareword found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 25, near "11d1"
(Missing operator before d1?)
Bareword found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 25, near "00AA00C14882"
(Missing operator before AA00C14882?)
String found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 25, near "AA00C14882"""
Bareword found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 26, near ""xmlns="http"
(Missing operator before http?)
Having no space between pattern and following word is deprecated at /usr/lib/cgi-bin/config_device.cgi line 26.
String found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 26, near "html40">""
Bareword found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 28, near ""<meta http-equiv=Content-Type content="text"
(Missing operator before text?)
String found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 28, near "1252">""
(Missing operator before ">"?)
Bareword found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 29, near ""<link rel=File-List href="hello_world_files"
(Missing operator before hello_world_files?)
String found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 29, near "xml">""
Bareword found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 43, near ""{font-family:"Times"
(Missing operator before Times?)
String found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 43, near "Roman";""
Bareword found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 52, near ""font-family:"Times"
(Missing operator before Times?)
String found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 52, near "Roman";""
Bareword found where operator expected at /usr/lib/cgi-bin/config_device.cgi line 68, near ""<o:shapedefaults v:ext="edit"
(Missing operator before edit?)
syntax error at /usr/lib/cgi-bin/config_device.cgi line 23, near ""><html xmlns:v="urn"
syntax error at /usr/lib/cgi-bin/config_device.cgi line 24, near ""xmlns:o="urn"
syntax error at /usr/lib/cgi-bin/config_device.cgi line 25, near ""xmlns:dt="uuid"
syntax error at /usr/lib/cgi-bin/config_device.cgi line 26, near ""xmlns="http"
syntax error at /usr/lib/cgi-bin/config_device.cgi line 28, near ""><meta http-equiv=Content-Type content="text"
syntax error at /usr/lib/cgi-bin/config_device.cgi line 28, near "1252">""
syntax error at /usr/lib/cgi-bin/config_device.cgi line 29, near ""<link rel=File-List href="hello_world_files"
syntax error at /usr/lib/cgi-bin/config_device.cgi line 43, near ""{font-family:"Times New "
syntax error at /usr/lib/cgi-bin/config_device.cgi line 52, near ""font-family:"Times New "
syntax error at /usr/lib/cgi-bin/config_device.cgi line 68, near ""><o:shapedefaults v:ext="edit"



I have abc.htm which have same type of inline styles as this simple hello world html.
How can i show the webpage by cgi perl script?>
 
Knute Snortum
Sheriff
Posts: 7111
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, the errors in the error log are caused because you are "quoting quotes". For example:

The quote ends after v=. You need to either escape the quotes:

or use the qq function:
 
Knute Snortum
Sheriff
Posts: 7111
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you just want to print what's in abc.htm in your CGI script, I'd open the file and print:
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic