473,385 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SERVER global variables in Perl?

Hi

PHP supplies variables such as $_SERVER['PHP_AUTH_USER'] for discovering the user name of an authenicated user (for example someone who has logged onto a web page using htdigest). Is there any similar set of variables accessible from within Perl that would allow me to find out details of an authenticated user (i.e., if they log into a page from which they POST a form that runs a Perl script can I find out the user name within the perl script?).

Thanks
David
Sep 21 '07 #1
3 2153
numberwhun
3,509 Expert Mod 2GB
Hi

PHP supplies variables such as $_SERVER['PHP_AUTH_USER'] for discovering the user name of an authenicated user (for example someone who has logged onto a web page using htdigest). Is there any similar set of variables accessible from within Perl that would allow me to find out details of an authenticated user (i.e., if they log into a page from which they POST a form that runs a Perl script can I find out the user name within the perl script?).

Thanks
David
I don't know about your "i.e." question, but as for if there are environment variables, of course there are:

Expand|Select|Wrap|Line Numbers
  1.    #!/usr/bin/perl
  2.  
  3.    print "Content-type: text/html\n\n";
  4.    print "<tt>\n";
  5.    foreach $key (sort keys(%ENV)) {
  6.       print "$key = $ENV{$key}<p>";
  7.    } 
  8.  
Regards,

Jeff
Sep 21 '07 #2
KevinADC
4,059 Expert 2GB
if they log into a page from which they POST a form that runs a Perl script can I find out the user name within the perl script?).
Probably not. I believe PHP automatically keeps track of sessions (correct me if I am wrong) while perl does not. With perl you have to use a module that tracks the session (CGI::Sessions or other module) or code it into the program yourself.

As Jeff has posted, perl does have the %ENV that stores some environment variables, but I don't think you will find it useful for your particular question. But give it a try.
Sep 21 '07 #3
Thanks to Jeff and Kevin for your replies. I listed the Perl ENV variables, and they didn't include the information I needed, so I'll look at using Session.

David
Sep 21 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: mrbog | last post by:
I have an array/hash that stores path information for my app. As in, what directory this is in, what directory that's in, what the name of the site is, what the products are called, etc. It's...
3
by: gabriele renzi | last post by:
Hi gurus and nubys, matz said more than once that the perlish global variables like $/ or $: are going away in future releases. I wonder if is there already a decision, what they will become?...
5
by: Phil Grimpo | last post by:
I have a very odd situation here. I have an administration page, where based on a users permissions, a recordset is called from the SQL server which has a list of paths to "Module Menus". Each of...
15
by: Michael Rybak | last post by:
hi, everyone. I'm writing a 2-players game that should support network mode. I'm now testing it on 1 PC since I don't have 2. I directly use sockets, and both client and server do...
15
by: joun | last post by:
Hi all, i want to create in my asp.net application a custom server variable, so i can retrieve later in other pages (even asp or perl) with request.servervariables("HTTP_mycustomvariable") ...
18
by: robert | last post by:
Using global variables in Python often raises chaos. Other languages use a clear prefix for globals. * you forget to declare a global * or you declare a global too much or in conflict * you...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
4
by: pcaisse | last post by:
I'm having issues sharing global variables with Explorer. This problem probably has a simple answer (as with most newbie questions). The script.pl file: #!/usr/bin/perl -w use strict; use...
11
by: sinbad | last post by:
hi, I've a very large C program consisting of hundred of files; I want to know what are all the global variables defined in the program. how do i do this. thanks
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.