Apache-Wyrd

 view release on metacpan or  search on metacpan

Wyrd/DBL.pm  view on Meta::CPAN


=item database

database name (to connect to)

=item db_password

database password

=item db_username

database user name

=item loglevel

Logging level, per Apache::Wyrd object

=item globals

pointer to globals hashref

=item req (B<required>)

the request itself (Apache request object)

=item strict

should strict procedures be followed (not used by default)

=item user

the current user (not used by default)

=back

=cut

sub new {
	my ($class, $init) = @_;
	if ((ref($init) ne 'HASH') and $init) {
		complain("invalid init data given to Das Blinkenlights -- Ignored");
		$init = {};
	}
	$ENV{PATH} = undef unless ($$init{flags} =~ /allow_unsafe_path/);
	if ((ref($$init{'globals'}) ne 'HASH') and $$init{'globals'}) {
		complain("invalid global data given to Das Blinkenlights -- Ignored");
		$$init{'globals'} = {};
	}
	my @standard_params = qw(
		atime
		base_class
		blksize
		blocks
		ctime
		database
		db_password
		db_username
		dba
		dev
		file_path
		gid
		globals
		ino
		logfile
		loglevel
		mode
		mtime
		nlink
		rdev
		req
		self_path
		size
		strict
		taint_exceptions
		uid
		user
	);
	my $data = {
		dbl_log		=>	[],
		dbh_ok		=>	0,
		dbh			=>	undef,
		response	=>	undef
	};
	foreach my $param (@standard_params) {
		$$data{$param} = ($$init{$param} || undef);
	}
	bless $data, $class;
	if (UNIVERSAL::isa($$init{'req'}, 'Apache')) {
		$data->{'req'} = $$init{'req'};
		$data->{'mod_perl'} = 1;
		my $server = $$init{'req'}->server;
		$data->{'loglevel'} = 4 if ($server->port == 81);
		$data->{'self_path'} ||= $$init{'req'}->parsed_uri->rpath;
		my $apr = Apache::Wyrd::Request->instance($$init{'req'});
		$data->{'apr'} = $apr;
	};
	if (UNIVERSAL::isa($$init{'database'}, 'DBI::db')) {
		if ($$init{'database'}->can('ping') && $$init{'database'}->ping) {
			$data->{'dbh'} = $$init{'database'};
			$data->{'dbh_ok'} = 1;
		} else {
			$data->log_bug('DBI-type Database apparently passed to Das Blinkenlights, but was not valid')
		}
	}
	return $data;
}

=pod

=item verify_dbl_compatibility

Used by Apache::Wyrd to confirm it's been passed the right sort of object for a
DBL.

=cut

sub verify_dbl_compatibility {
	return 1;
}

=item (scalar) C<strict> (void)

Wyrd/DBL.pm  view on Meta::CPAN

function.

=cut

sub ino {
	my ($self) = @_;
	return $self->{'ino'};
}


=pod

=item (scalar) C<mode> (void)

the file mode  (type and permissions) of the file currently being served. 
Derived from Apache::Wyrd::Handler, by default compatible with the C<stat()>
builtin function.

=cut

sub mode {
	my ($self) = @_;
	return $self->{'mode'};
}


=pod

=item (scalar) C<nlink> (void)

the number of (hard) links to the file of the file currently being served. 
Derived from Apache::Wyrd::Handler, by default compatible with the C<stat()>
builtin function.

=cut

sub nlink {
	my ($self) = @_;
	return $self->{'nlink'};
}


=pod

=item (scalar) C<uid> (void)

the numeric user ID of file's owner of the file currently being served. 
Derived from Apache::Wyrd::Handler, by default compatible with the C<stat()>
builtin function.

=cut

sub uid {
	my ($self) = @_;
	return $self->{'uid'};
}


=pod

=item (scalar) C<gid> (void)

the numeric group ID of file's owner of the file currently being served. 
Derived from Apache::Wyrd::Handler, by default compatible with the C<stat()>
builtin function.

=cut

sub gid {
	my ($self) = @_;
	return $self->{'gid'};
}


=pod

=item (scalar) C<rdev> (void)

the the device identifier (special files only) of the file currently being
served.  Derived from Apache::Wyrd::Handler, by default compatible with the
C<stat()> builtin function.

=cut

sub rdev {
	my ($self) = @_;
	return $self->{'rdev'};
}


=pod

=item (scalar) C<atime> (void)

the last access time in seconds since the epoch of the file currently being
served.  Derived from Apache::Wyrd::Handler, by default compatible with the
C<stat()> builtin function.

=cut

sub atime {
	my ($self) = @_;
	return $self->{'atime'};
}


=pod

=item (scalar) C<ctime> (void)

the inode change time in seconds since the epoch of the file currently being
served.  Derived from Apache::Wyrd::Handler, by default compatible with the
C<stat()> builtin function.  See the perl documentation for details.

=cut

sub ctime {
	my ($self) = @_;
	return $self->{'ctime'};
}


=pod

=item (scalar) C<blksize> (void)

the preferred block size for file system I/O of the file currently being
served.  Derived from Apache::Wyrd::Handler, by default compatible with the
C<stat()> builtin function.

=cut



( run in 2.264 seconds using v1.01-cache-2.11-cpan-ceb78f64989 )