Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^3: How to make that works with perl

by Thilosophy (Curate)
on Apr 14, 2007 at 01:55 UTC ( #610031=note: print w/replies, xml ) Need Help??

in reply to Re^2: How to make that works with perl
in thread How to make that works with perl

You want to serve a page that looks like your DreamWeaver page from a CGI/Perl script.

How the page looks in a web browser depends only on the HTML of that page. It does not matter at all how that HTML was produced on the server-side: It does not matter if it is hand-written in vi, done with DreamWeaver or by print statements in a Perl program. It does not matter if it is static HTML, or made by Perl, Java, COBOL, ASP .

So, yes, of course, you can write a Perl program that outputs HTML that looks exactly like your DreamWeaver file. The easiest way is to use a templating engine (HTML::Template is one such, just search for it on CPAN or here).

When you say "dynamic content" you have to distinguish between dynamic for the client, and dynamic for the server. Your flash banner is probably not dynamic content in terms of the server. What I mean is that the HTML (the part that the server produces) will always say src="banner.swf" , which is completely static. If the DreamWeaver page you made (which is static, because it is a static HTML file) already has all the dynamic content you want, you do not need to change that HTML dynamically on the server.

Examples for server-side dynamic content would be error messages (like "wrong password") that get inserted in the form, or rotating to a different flash banner depending on some clever conditions (although this can usually also be done on the client-side with JavaScript, or by the banner server).

I hope this is not too confusing for you. If this is your first project with Perl/CGI, I highly recommend you look at some of the tutorials here on PerlMonks. The most important concept to get a handle on IMHO is between what has to happen on the server, and what happens in the web browser. Separating these two parts cleanly can greatly improve maintainability of your application.

Update: fix CPAN link, GrandFather++

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://610031]
[Corion]: But yes, "who started this process" is interesting information :)
[tye]: no, I really believe that "login user" was added as a fundamental bit of info about each process in order to enhance the usefulness of auditing
[Corion]: Ah - if that information is saved in a file, then you could theoretically spam that file and confuse getlogin(). So, don't use it for authentication :)
[tye]: that is what getlogin() certainly *used* to do. I don't believe that is what it certainly should do.
[davido]: /var/run/utmp is 664 i think.
[tye]: Note that my "man getlogin" says that it uses stdin when it should use /dev/tty (calling a glibc bug). But that does not appear to be the case when I test it. But maybe Perl's getlogin() is not using glibc's getlogin().
[oiskuu]: well, run a strace and see what the getlogin does for you.... As I said. SELinux probably has those security labels. But not regular linux.
[tye]: for example, read https://unix. questions/146138/ loginuid-should-be -allowed-to-change -or-not-mutable-or -not
[tye]: I'm not using SELinux and it certainly appears to disagree with you. shrug
[tye]: Since you brought up /proc, oiskuu, I didn't see you respond to my suggestion of 'loginuid'. Does your /proc not have such?

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2017-06-23 19:46 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (554 votes). Check out past polls.