Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Printing output of perl cgi to a file

by NetWallah (Canon)
on Apr 01, 2014 at 15:03 UTC ( [id://1080584]=note: print w/replies, xml ) Need Help??


in reply to Printing output of perl cgi to a file

> I want to print the user name and the time of running the cgi script

The "user name" of the person at the computer running the browser is not available by default, inside a server CGI program.

If you need that, some sort of authentication or login process is required, that will capture ans store that information.

Instead, you way want to use some easily available information, like the IP address of the client.

CGI's remote_host() and remote_addr() are the best ways of getting that. You could try the remote_user() method, if you enable authentication.

Your code:

my $user = $q->param('user_id')
expects the user name to come in via a query string. It would be unusual if this was required to be sent with every page the user visited.

        What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
              -Larry Wall, 1992

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1080584]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-23 22:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found