delete WebGUI::Session::Os
This commit is contained in:
parent
7ff307cabe
commit
1150528b8a
5 changed files with 4 additions and 162 deletions
|
|
@ -68,7 +68,6 @@ B<NOTE:> It is important to distinguish the difference between a WebGUI session
|
|||
$session->icon
|
||||
$session->id
|
||||
$session->output
|
||||
$session->os
|
||||
$session->privilege
|
||||
$session->request
|
||||
$session->response
|
||||
|
|
@ -145,7 +144,7 @@ sub close {
|
|||
|
||||
# Kill circular references. The literal list is so that the order
|
||||
# can be explicitly shuffled as necessary.
|
||||
foreach my $key (qw/_asset _datetime _icon _slave _db _env _form _http _id _output _os _privilege _scratch _setting _stow _style _url _user _var _cache _errorHandler _response _request/) {
|
||||
foreach my $key (qw/_asset _datetime _icon _slave _db _env _form _http _id _output _privilege _scratch _setting _stow _style _url _user _var _cache _errorHandler _response _request/) {
|
||||
delete $self->{$key};
|
||||
}
|
||||
}
|
||||
|
|
@ -454,7 +453,7 @@ Uses simple session vars. See WebGUI::Session::Var::new() for more details.
|
|||
sub open {
|
||||
my ($class, $c, $env, $sessionId, $noFuss) = @_;
|
||||
my $config = ref $c ? $c : WebGUI::Config->new($c);
|
||||
my $self = {_config=>$config }; # TODO - if we store reference here, should we weaken WebGUI->config?
|
||||
my $self = { _config => $config };
|
||||
bless $self, $class;
|
||||
|
||||
if ($env) {
|
||||
|
|
@ -493,23 +492,6 @@ sub output {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 os ( )
|
||||
|
||||
Returns a WebGUI::Session::Os object.
|
||||
|
||||
=cut
|
||||
|
||||
sub os {
|
||||
my $self = shift;
|
||||
unless (exists $self->{_os}) {
|
||||
$self->{_os} = WebGUI::Session::Os->new();
|
||||
}
|
||||
return $self->{_os};
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 privilege ( )
|
||||
|
|
|
|||
|
|
@ -1,88 +0,0 @@
|
|||
package WebGUI::Session::Os;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
||||
-------------------------------------------------------------------
|
||||
Please read the legal notices (docs/legal.txt) and the license
|
||||
(docs/license.txt) that came with this distribution before using
|
||||
this software.
|
||||
-------------------------------------------------------------------
|
||||
http://www.plainblack.com info@plainblack.com
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Session::Os
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This package allows you to reference environment variables.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
$os = WebGUI::Session::Os->new;
|
||||
|
||||
$value = $os->get('name');
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this package:
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 get( varName )
|
||||
|
||||
Retrieves the current value of an operating system variable.
|
||||
|
||||
=head3 varName
|
||||
|
||||
The name of the variable.
|
||||
|
||||
=head4 name
|
||||
|
||||
The name of the operating system as reported by perl.
|
||||
|
||||
=head4 type
|
||||
|
||||
Will either be "Windowsish" or "Linuxish", which is often more useful than name because the differences between various flavors of Unix, Linux, and BSD are usually not that significant.
|
||||
|
||||
=cut
|
||||
|
||||
sub get {
|
||||
my $self = shift;
|
||||
my $var = shift;
|
||||
return $self->{_os}{$var};
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 new ( )
|
||||
|
||||
Constructor. Returns an OS object.
|
||||
|
||||
=cut
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $self = {};
|
||||
$self->{_os}{name} = $^O;
|
||||
if ($self->{_os}{name} =~ /MSWin32/i || $self->{_os}{name} =~ /^Win/i) {
|
||||
$self->{_os}{type} = "Windowsish";
|
||||
} else {
|
||||
$self->{_os}{type} = "Linuxish";
|
||||
}
|
||||
bless $self, $class;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
Loading…
Add table
Add a link
Reference in a new issue