.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Environment 3" .TH Environment 3 "2002-02-07" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" Slash::Utility::Environment \- SHORT DESCRIPTION for Slash .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Slash::Utility; \& # do not use this module directly .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\s-1LONG\s0 \s-1DESCRIPTION\s0. .SH "EXPORTED FUNCTIONS" .IX Header "EXPORTED FUNCTIONS" .Sh "getCurrentMenu([\s-1NAME\s0])" .IX Subsection "getCurrentMenu([NAME])" Returns the menu for the resource requested. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1NAME\s0" 4 .IX Item "NAME" .PD Name of the menu that you want to fetch. If not supplied, menu named after active script will be used (i.e., the \*(L"users\*(R" menu for \*(L"users.pl\*(R"). .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" A reference to an array with the menu in it is returned. .Sh "getCurrentUser([\s-1MEMBER\s0])" .IX Subsection "getCurrentUser([MEMBER])" Returns the current authenicated user. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1MEMBER\s0" 4 .IX Item "MEMBER" .PD A member from the users record to be returned. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" A hash reference with the user information is returned unless \s-1VALUE\s0 is passed. If \&\s-1MEMBER\s0 is passed in then only its value will be returned. .Sh "setCurrentUser(\s-1MEMBER\s0, \s-1VALUE\s0)" .IX Subsection "setCurrentUser(MEMBER, VALUE)" Sets a value for the current user. It will not be permanently stored. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1MEMBER\s0" 4 .IX Item "MEMBER" .PD The member to store \s-1VALUE\s0 in. .IP "\s-1VALUE\s0" 4 .IX Item "VALUE" \&\s-1VALUE\s0 to be stored in the current user hash. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" The passed value. .Sh "setCurrentForm(\s-1MEMBER\s0, \s-1VALUE\s0)" .IX Subsection "setCurrentForm(MEMBER, VALUE)" Sets a value for the current user. It will not be permanently stored. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1MEMBER\s0" 4 .IX Item "MEMBER" .PD The member to store \s-1VALUE\s0 in. .IP "\s-1VALUE\s0" 4 .IX Item "VALUE" \&\s-1VALUE\s0 to be stored in the current user hash. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" The passed value. .Sh "createCurrentUser(\s-1USER\s0)" .IX Subsection "createCurrentUser(USER)" Creates the current user. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1USER\s0" 4 .IX Item "USER" .PD \&\s-1USER\s0 to be inserted into current user. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" Returns no value. .Sh "getCurrentForm([\s-1MEMBER\s0])" .IX Subsection "getCurrentForm([MEMBER])" Returns the current form. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1MEMBER\s0" 4 .IX Item "MEMBER" .PD A member from the forms record to be returned. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" A hash reference with the form information is returned unless \s-1VALUE\s0 is passed. If \&\s-1MEMBER\s0 is passed in then only its value will be returned. .Sh "createCurrentForm(\s-1FORM\s0)" .IX Subsection "createCurrentForm(FORM)" Creates the current form. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1FORM\s0" 4 .IX Item "FORM" .PD \&\s-1FORM\s0 to be inserted into current form. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" Returns no value. .Sh "getCurrentCookie([\s-1MEMBER\s0])" .IX Subsection "getCurrentCookie([MEMBER])" Returns the current cookie. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1MEMBER\s0" 4 .IX Item "MEMBER" .PD A member from the cookies record to be returned. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" A hash reference with the cookie incookieation is returned unless \s-1VALUE\s0 is passed. If \s-1MEMBER\s0 is passed in then only its value will be returned. .Sh "createCurrentCookie(\s-1COOKIE\s0)" .IX Subsection "createCurrentCookie(COOKIE)" Creates the current cookie. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1COOKIE\s0" 4 .IX Item "COOKIE" .PD \&\s-1COOKIE\s0 to be inserted into current cookie. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" Returns no value. .Sh "getCurrentStatic([\s-1MEMBER\s0])" .IX Subsection "getCurrentStatic([MEMBER])" Returns the current static variables (or variable). .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1MEMBER\s0" 4 .IX Item "MEMBER" .PD A member from the static record to be returned. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" A hash reference with the static information is returned unless \s-1MEMBER\s0 is passed. If \&\s-1MEMBER\s0 is passed in then only its value will be returned. .Sh "createCurrentStatic(\s-1HASH\s0)" .IX Subsection "createCurrentStatic(HASH)" Creates the current static information for non Apache scripts. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1HASH\s0" 4 .IX Item "HASH" .PD A hash that is to be used in scripts not running in Apache to simulate a script running under Apache. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" Returns no value. .Sh "getCurrentAnonymousCoward([\s-1MEMBER\s0])" .IX Subsection "getCurrentAnonymousCoward([MEMBER])" Returns the current anonymous corward (or value from that object). .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1MEMBER\s0" 4 .IX Item "MEMBER" .PD A member from the \s-1AC\s0 redcord to be returned. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" If \s-1MEMBER\s0, then that value is returned; else, the hash containing all the \s-1AC\s0 info will be returned. .Sh "createCurrentAnonymousCoward(\s-1HASH\s0)" .IX Subsection "createCurrentAnonymousCoward(HASH)" Creates the current anonymous coward for non Apache scripts. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1HASH\s0" 4 .IX Item "HASH" .PD A hash that is to be used in scripts not running in Apache to simulate a script running under Apache. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" Returns no value. .Sh "\fIgetCurrentVirtualUser()\fP" .IX Subsection "getCurrentVirtualUser()" Returns the current virtual user that the site is running under. .IP "Return value" 4 .IX Item "Return value" The current virtual user that the site is running under. .Sh "createCurrentVirtualUser(\s-1VIRTUAL_USER\s0)" .IX Subsection "createCurrentVirtualUser(VIRTUAL_USER)" Creates the current virtual user for non Apache scripts. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1VIRTUAL_USER\s0" 4 .IX Item "VIRTUAL_USER" .PD The current virtual user that is to be used in scripts not running in Apache to simulate a script running under Apache. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" Returns no value. .Sh "\fIgetCurrentDB()\fP" .IX Subsection "getCurrentDB()" Returns the current Slash::DB object. .IP "Return value" 4 .IX Item "Return value" Returns the current Slash::DB object. .Sh "createCurrentDB(\s-1SLASHDB\s0)" .IX Subsection "createCurrentDB(SLASHDB)" Creates the current \s-1DB\s0 object for scripts not running under Apache. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1SLASHDB\s0" 4 .IX Item "SLASHDB" .PD Pass in a Slash::DB object to be used for scripts not running in Apache. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" Returns no value. .Sh "isAnon(\s-1UID\s0)" .IX Subsection "isAnon(UID)" Tests to see if the uid passed in is an anonymous coward. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1UID\s0" 4 .IX Item "UID" .PD Value \s-1UID\s0. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" Returns true if the \s-1UID\s0 is an anonymous coward, otherwise false. .Sh "getAnonId([\s-1FORMKEY\s0])" .IX Subsection "getAnonId([FORMKEY])" Creates an anonymous \s-1ID\s0 that is used to set an \s-1AC\s0 cookie, with some random data (well, as random as random gets) .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1FORMKEY\s0" 4 .IX Item "FORMKEY" .PD Return the same value as normal, but without prepending with a '\-1\-'. The normal case, with '\-1\-', is for easy identification of cookies. This case is for use with formkeys. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" A random value based on alphanumeric characters .Sh "bakeUserCookie(\s-1UID\s0, \s-1PASSWD\s0)" .IX Subsection "bakeUserCookie(UID, PASSWD)" Bakes (creates) a user cookie from its ingredients (\s-1UID\s0, \s-1PASSWD\s0). .PP Currently cookie is hexified: this should be changed, no need anymore, perhaps? \*(-- pudge .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1UID\s0" 4 .IX Item "UID" .PD User \s-1ID\s0. .IP "\s-1PASSWD\s0" 4 .IX Item "PASSWD" Password. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" Created cookie. .Sh "eatUserCookie(\s-1COOKIE\s0)" .IX Subsection "eatUserCookie(COOKIE)" Digests (parses) a user cookie, returning it to its original ingredients (\s-1UID\s0, password). .PP Currently cookie is hexified: this should be changed, no need anymore, perhaps? \*(-- pudge .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1COOKIE\s0" 4 .IX Item "COOKIE" .PD Cookie to be parsed. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" The \s-1UID\s0 and password encoded in the cookie. .Sh "setCookie(\s-1NAME\s0, \s-1VALUE\s0, \s-1SESSION\s0)" .IX Subsection "setCookie(NAME, VALUE, SESSION)" Creates a cookie and places it into the outbound headers. Can be called multiple times to set multiple cookies. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1NAME\s0" 4 .IX Item "NAME" .PD NAme of the cookie. .IP "\s-1VALUE\s0" 4 .IX Item "VALUE" Value to be placed in the cookie. .IP "\s-1SESSION\s0" 4 .IX Item "SESSION" Flag to determine if the cookie should be a session cookie. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" No value is returned. .Sh "prepareUser(\s-1UID\s0, \s-1FORM\s0, \s-1URI\s0 [, \s-1COOKIES\s0])" .IX Subsection "prepareUser(UID, FORM, URI [, COOKIES])" This is called to initialize the user. It is called from Slash::Apache::User::handler, and from createEnvironment (so it can set up a user in \*(L"command line\*(R" mode). See those two functions to see how to call this function in each kind of environment. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1UID\s0" 4 .IX Item "UID" .PD The \s-1UID\s0 of the user. Can be anonymous coward. Will be anonymous coward if uid is not defined. .IP "\s-1FORM\s0" 4 .IX Item "FORM" The form data (which may be the same data returned by getCurrentForm). .IP "\s-1URI\s0" 4 .IX Item "URI" The \s-1URI\s0 of the page the user is on. .IP "\s-1COOKIES\s0" 4 .IX Item "COOKIES" An Apache::Cookie object (not used in \*(L"command line\*(R" mode). .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" The prepared user data. .IP "Side effects" 4 .IX Item "Side effects" Sets some cookies in Apache mode, sets currentPage (for templates) and bunches of other user datum. .Sh "filter_params(\s-1PARAMS\s0)" .IX Subsection "filter_params(PARAMS)" This cleans up form data before it is used by the program. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1PARAMS\s0" 4 .IX Item "PARAMS" .PD A hash of the parameters to clean up. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" Hashref of cleaned-up data. .Sh "getObject(\s-1CLASS_NAME\s0 [, \s-1VIRTUAL_USER\s0, \s-1ARGS\s0])" .IX Subsection "getObject(CLASS_NAME [, VIRTUAL_USER, ARGS])" Returns a object in \s-1CLASS_NAME\s0, using the \fInew()\fR constructor. It passes \&\s-1VIRTUAL_USER\s0 and \s-1ARGS\s0 to it, and then caches it. If the object exists the second time through, it will just return, without reinitializing (even if different \s-1VIRTUAL_USER\s0 and \s-1ARGS\s0 are passed). That shouldn't be a problem, since you should only have one instance with one set of args required per Slash site. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1CLASS_NAME\s0" 4 .IX Item "CLASS_NAME" .PD A class name to use in creating a object. .IP "\s-1VIRTUAL_USER\s0" 4 .IX Item "VIRTUAL_USER" Optional; will default to main Virtual User for site if not supplied. Passed as second argument to the \fInew()\fR constructor (after class name). .IP "\s-1ARGS\s0" 4 .IX Item "ARGS" Any other arguments to be passed to the object's constructor. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" An object, unless object cannot be gotten; then undef. .Sh "\fIerrorLog()\fP" .IX Subsection "errorLog()" Generates an error that either goes to Apache's error log or to \s-1STDERR\s0. The error consists of the package and and filename the error was generated and the same information on the previous caller. .IP "Return value" 4 .IX Item "Return value" Returns 0; .Sh "writeLog(\s-1DATA\s0)" .IX Subsection "writeLog(DATA)" Places optional data in the accesslog. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1DATA\s0" 4 .IX Item "DATA" .PD Strings that are concatenated together to be used in the \s-1SLASH_LOG_DATA\s0 field. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" No value is returned. .Sh "createEnvironment([\s-1VIRTUAL_USER\s0])" .IX Subsection "createEnvironment([VIRTUAL_USER])" Places data into the request records notes table. The two keys it uses are \s-1SLASH_LOG_OPERATION\s0 and \s-1SLASH_LOG_DATA\s0. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1VIRTUAL_USER\s0" 4 .IX Item "VIRTUAL_USER" .PD Optional. You can pass in a virtual user that will be used instead of \f(CW$ARGV[0]\fR. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" No value is returned. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fISlash\fR\|(3), \fISlash::Utility\fR\|(3). .SH "VERSION" .IX Header "VERSION" $Id: Environment.pm,v 1.1.2.32 2002/02/07 13:18:00 pudge Exp $