File: ActiveUser.pm

package info (click to toggle)
perlmoo 0.045
  • links: PTS
  • area: main
  • in suites: slink
  • size: 404 kB
  • ctags: 242
  • sloc: perl: 5,211; makefile: 111; sh: 77
file content (25 lines) | stat: -rw-r--r-- 578 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# At any given time, a single user is the active user. This sets that user.

# Yes, it's simple now, but once we get threads, this will
# become more complex. I will probably use the pid() method
# of a thread to figure out its id, and then use a lookup table
# to figure out which user "owns" the thread.

package ActiveUser;
use strict;

{ # Hide $active inside a closure so it can't be accessed directly.
	my $active=undef;

	# Set the currently active user.
	sub setactive {
		$active=shift;
	}

	# Get the currently active user.
	sub getactive {
		return $active;
	}
}

1;