Log-Fine

 view release on metacpan or  search on metacpan

lib/Log/Fine/Formatter/Template.pm  view on Meta::CPAN


                $self->{_placeHolders} = $placeholders;

                return $placeholders;

        }

}          # _placeHolder()

##
# Validator for custom placeholders

sub _placeholderValidate
{

        my $self    = shift;
        my $holders = {};

        $self->_fatal("{custom_placeholders} must be a valid hash ref")
            unless ref $self->{custom_placeholders} eq "HASH";

        foreach my $placeholder (keys %{ $self->{custom_placeholders} }) {

                $self->_fatal(
                              sprintf("custom template '%s' must point to " . "a valid function ref : %s",
                                      $placeholder, ref $self->{custom_placeholders}->{$placeholder})
                ) unless ref $self->{custom_placeholders}->{$placeholder} eq "CODE";

                # Check for duplicate placeholders
                if (defined $holders->{ lc($placeholder) }) {
                        $self->_fatal(
                                      sprintf("Duplicate placeholder '%s' found.  " . "Remember, placeholders are case-INsensitive",
                                              $placeholder
                                      ));
                } else {
                        $holders->{ lc($placeholder) } = 1;
                }

        }

        return 1;

}          # _placeholderValidate()

##
# Getter/Setter for user name

sub _userName
{

        my $self = shift;

        # Should {_userName} be already cached, then return it,
        # otherwise get the user name, cache it, and return
        if (defined $self->{_userName} and $self->{_userName} =~ /\w/) {
                return $self->{_userName};
        } elsif ($self->{use_effective_id}) {
                $self->{_userName} =
                    ($^O eq "MSWin32")
                    ? $ENV{EUID}   || 0
                    : getpwuid($>) || "nobody";
        } else {
                $self->{_userName} = getlogin() || getpwuid($<) || "nobody";
        }

        return $self->{_userName};

}          # _userName()

=head1 MICROSOFT WINDOWS CAVEATS

Under Microsoft Windows operating systems (WinXP, Win2003, Vista,
Win7, etc.), Log::Fine::Formatters::Template will use the following
environment variables for determining user and group information:

=over

=item * C<$UID>

=item * C<$EUID>

=item * C<$GID>

=item * C<$EGID>

=back

Under MS Windows, these values will invariably be set to 0.

=head1 BUGS

Please report any bugs or feature requests to
C<bug-log-fine at rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Log-Fine>.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Log::Fine

You can also look for information at:

=over 4

=item * AnnoCPAN: Annotated CPAN documentation

L<http://annocpan.org/dist/Log-Fine>

=item * CPAN Ratings

L<http://cpanratings.perl.org/d/Log-Fine>

=item * RT: CPAN's request tracker

L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Log-Fine>

=item * Search CPAN

L<http://search.cpan.org/dist/Log-Fine>



( run in 0.877 second using v1.01-cache-2.11-cpan-5b529ec07f3 )