perl_mlb

 view release on metacpan or  search on metacpan

CGI.pm  view on Meta::CPAN

  unless ($TMPDIRECTORY) {
    @TEMP=("${SL}usr${SL}tmp","${SL}var${SL}tmp",
	   "C:${SL}temp","${SL}tmp","${SL}temp",
	   "${vol}${SL}Temporary Items",
           "${SL}WWW_ROOT", "${SL}SYS\$SCRATCH",
	   "C:${SL}system${SL}temp");
    unshift(@TEMP,$ENV{'TMPDIR'}) if defined $ENV{'TMPDIR'};

    # this feature was supposed to provide per-user tmpfiles, but
    # it is problematic.
    #    unshift(@TEMP,(getpwuid($<))[7].'/tmp') if $CGI::OS eq 'UNIX';
    # Rob: getpwuid() is unfortunately UNIX specific. On brain dead OS'es this
    #    : can generate a 'getpwuid() not implemented' exception, even though
    #    : it's never called.  Found under DOS/Win with the DJGPP perl port.
    #    : Refer to getpwuid() only at run-time if we're fortunate and have  UNIX.
    # unshift(@TEMP,(eval {(getpwuid($>))[7]}).'/tmp') if $CGI::OS eq 'UNIX' and $> != 0;

    foreach (@TEMP) {
      do {$TMPDIRECTORY = $_; last} if -d $_ && -w _;
    }
  }
  $TMPDIRECTORY  = $MAC ? "" : "." unless $TMPDIRECTORY;
}

find_tempdir();

ExtUtils/MakeMaker.pm  view on Meta::CPAN

    foreach (@args) {
        unless (m/(.*?)=(.*)/) {
            ++$Verbose if m/^verb/;
            next;
        }
        my($name, $value) = ($1, $2);
        if ($value =~ m/^~(\w+)?/) { # tilde with optional username
            $value =~ s [^~(\w*)]
                [$1 ?
                 ((getpwnam($1))[7] || "~$1") :
                 (getpwuid($>))[7]
                 ]ex;
        }

        # Remember the original args passed it.  It will be useful later.
        $self->{ARGS}{uc $name} = $self->{uc $name} = $value;
    }

    # catch old-style 'potential_libs' and inform user how to 'upgrade'
    if (defined $self->{potential_libs}){
        my($msg)="'potential_libs' => '$self->{potential_libs}' should be";

Memoize/TODO  view on Meta::CPAN


perhaps?  Is EXPIRE_USES actually useful?

19990916: Memoize::Expire does EXPIRE_TIME and EXPIRE_USES.
MAXENTRIES can come later as a separate module.

=item *

Put in a better example than C<fibo>.  Show an example of a
nonrecursive function that simply takes a long time to run.
C<getpwuid> for example?  But this exposes the bug that you can't say
C<memoize('getpwuid')>, so perhaps it's not a very good example.

Well, I did add the ColorToRGB example, but it's still not so good.
These examples need a lot of work.  C<factorial> might be a better
example than C<fibo>.  

=item *

Add more regression tests for normalizers.

=item *

Net/ChangeLog.libnet  view on Meta::CPAN

	- Added ResvPort option to new()

Change 131 on 1998/04/19 by <gbarr@pobox.com> (Graham Barr)

	Makefile.PL
	- Patch for running $^X Configure under VMS

Change 130 on 1998/04/19 by <gbarr@pobox.com> (Graham Barr)

	Net::FTP, Net::POP3
	- wrapped getpwuid in eval {} as some OSs (eg NT) do not support it

Change 129 on 1998/04/19 by <gbarr@pobox.com> (Graham Barr)

	Net::FTP
	- Enhanced ->size() to try different approaces if SIZE is
	  not implemented

Change 128 on 1998/04/16 by <gbarr@pobox.com> (Graham Barr)

	Net::Time

Net/Config.pm  view on Meta::CPAN

my $ref;
$file =~ s/Config.pm/libnet.cfg/;
if ( -f $file ) {
    $ref = eval { local $SIG{__DIE__}; do $file };
    if (ref($ref) eq 'HASH') {
	%NetConfig = (%NetConfig, %{ $ref });
	$LIBNET_CFG = $file;
    }
}
if ($< == $> and !$CONFIGURE)  {
    my $home = eval { local $SIG{__DIE__}; (getpwuid($>))[7] } || $ENV{HOME};
    $home ||= $ENV{HOMEDRIVE} . ($ENV{HOMEPATH}||'') if defined $ENV{HOMEDRIVE};
    if (defined $home) {
	$file = $home . "/.libnetrc";
	$ref = eval { local $SIG{__DIE__}; do $file } if -f $file;
	%NetConfig = (%NetConfig, %{ $ref })
	    if ref($ref) eq 'HASH';	
    }
}
my ($k,$v);
while(($k,$v) = each %NetConfig) {

Net/FTP.pm  view on Meta::CPAN

 $ftp->_ACCT($acct) == CMD_OK;
}

sub _auth_id {
 my($ftp,$auth,$resp) = @_;

 unless(defined $resp)
  {
   require Net::Netrc;

   $auth ||= eval { (getpwuid($>))[0] } || $ENV{NAME};

   my $rc = Net::Netrc->lookup(${*$ftp}{'net_ftp_firewall'}, $auth)
        || Net::Netrc->lookup(${*$ftp}{'net_ftp_firewall'});

   ($auth,$resp) = $rc->lpa()
     if ($rc);
  }
  ($ftp,$auth,$resp);
}

Net/Netrc.pm  view on Meta::CPAN

sub _readrc
{
 my $host = shift;
 my($home,$file);

 if($^O eq "MacOS") {
   $home = $ENV{HOME} || `pwd`;
   chomp($home);
   $file = ($home =~ /:$/ ? $home . "netrc" : $home . ":netrc");
 } else {
   # Some OS's don't have `getpwuid', so we default to $ENV{HOME}
   $home = eval { (getpwuid($>))[7] } || $ENV{HOME};
   $home ||= $ENV{HOMEDRIVE} . ($ENV{HOMEPATH}||'') if defined $ENV{HOMEDRIVE};
   $file = $home . "/.netrc";
 }

 my($login,$pass,$acct) = (undef,undef,undef);
 my $fh;
 local $_;

 $netrc{default} = undef;

Net/POP3.pm  view on Meta::CPAN


 ($1 || 0, $2 || 0);
}

sub _lookup_credentials
{
  my ($me, $user) = @_;

  require Net::Netrc;

  $user ||= eval { local $SIG{__DIE__}; (getpwuid($>))[0] } ||
    $ENV{NAME} || $ENV{USER} || $ENV{LOGNAME};

  my $m = Net::Netrc->lookup(${*$me}{'net_pop3_host'},$user);
  $m ||= Net::Netrc->lookup(${*$me}{'net_pop3_host'});

  my $pass = $m ? $m->password || ""
                : "";

  ($user, $pass);
}

Pod/Functions.pm  view on Meta::CPAN

getnetent	Network	get next networks record 
getpeername	Socket	find the other end of a socket connection
getpgrp	Process	get process group
getppid	Process	get parent process ID
getpriority	Process	get current nice value
getprotobyname	Network	get protocol record given name
getprotobynumber	Network	get protocol record numeric protocol
getprotoent	Network	get next protocols record
getpwent	User	get next passwd record
getpwnam	User	get passwd record given user login name
getpwuid	User	get passwd record given user ID
getservbyname	Network	get services record given its name
getservbyport	Network	get services record given numeric port
getservent	Network	get next services record 
getsockname	Socket	retrieve the sockaddr for a given socket
getsockopt	Socket	get socket options on a given socket
glob	File		expand filenames using wildcards
gmtime	Time	convert UNIX time into record or string using Greenwich time
goto	Flow	create spaghetti code
grep	LIST	locate elements in a list test true against a given criterion
hex	Math,String	convert a string to a hexadecimal number

User/grent.pm  view on Meta::CPAN


You may also import all the structure fields directly into your namespace
as regular variables using the :FIELDS import tag.  (Note that this still
overrides your core functions.)  Access these fields as variables named
with a preceding C<gr_>.  Thus, C<$group_obj-E<gt>gid()> corresponds
to $gr_gid if you import the fields.  Array references are available as
regular array variables, so C<@{ $group_obj-E<gt>members() }> would be
simply @gr_members.

The getpw() function is a simple front-end that forwards
a numeric argument to getpwuid() and the rest to getpwnam().

To access this functionality without the core overrides,
pass the C<use> an empty import list, and then access
function functions with their full qualified names.
On the other hand, the built-ins are still available
via the C<CORE::> pseudo-package.

=head1 NOTE

While this class is currently implemented using the Class::Struct

User/pwent.pm  view on Meta::CPAN


use strict;
use warnings;

use Config;
use Carp;

our(@EXPORT, @EXPORT_OK, %EXPORT_TAGS);
BEGIN {
    use Exporter   ();
    @EXPORT      = qw(getpwent getpwuid getpwnam getpw);
    @EXPORT_OK   = qw(
                        pw_has

                        $pw_name    $pw_passwd  $pw_uid  $pw_gid
                        $pw_gecos   $pw_dir     $pw_shell
                        $pw_expire  $pw_change  $pw_class
                        $pw_age
                        $pw_quota   $pw_comment
                        $pw_expire

User/pwent.pm  view on Meta::CPAN

    $pw_dir     = $pwob->dir    ( $_[7] );
    $pw_shell   = $pwob->shell  ( $_[8] );

    $pw_expire  = $pwob->expire ( $_[9] ) if pw_has("expire");

    return $pwob;
}

sub getpwent ( ) { _populate(CORE::getpwent()) }
sub getpwnam ($) { _populate(CORE::getpwnam(shift)) }
sub getpwuid ($) { _populate(CORE::getpwuid(shift)) }
sub getpw    ($) { ($_[0] =~ /^\d+\z/s) ? &getpwuid : &getpwnam }

_feature_init();

1;
__END__

=head1 NAME

User::pwent - by-name interface to Perl's built-in getpw*() functions

User/pwent.pm  view on Meta::CPAN


 $pw = getpw($whoever);

 use User::pwent qw/:DEFAULT pw_has/;
 if (pw_has(qw[gecos expire quota])) { .... }
 if (pw_has("name uid gid passwd"))  { .... }
 print "Your struct pwd has: ", scalar pw_has(), "\n";

=head1 DESCRIPTION

This module's default exports override the core getpwent(), getpwuid(),
and getpwnam() functions, replacing them with versions that return
C<User::pwent> objects.  This object has methods that return the
similarly named structure field name from the C's passwd structure
from F<pwd.h>, stripped of their leading "pw_" parts, namely C<name>,
C<passwd>, C<uid>, C<gid>, C<change>, C<age>, C<quota>, C<comment>,
C<class>, C<gecos>, C<dir>, C<shell>, and C<expire>.  The C<passwd>,
C<gecos>, and C<shell> fields are tainted when running in taint mode.

You may also import all the structure fields directly into your
namespace as regular variables using the :FIELDS import tag.  (Note
that this still overrides your core functions.)  Access these fields
as variables named with a preceding C<pw_> in front their method
names.  Thus, C<< $passwd_obj->shell >> corresponds to $pw_shell
if you import the fields.

The getpw() function is a simple front-end that forwards
a numeric argument to getpwuid() and the rest to getpwnam().

To access this functionality without the core overrides, pass the
C<use> an empty import list, and then access function functions
with their full qualified names.  The built-ins are always still
available via the C<CORE::> pseudo-package.

=head2 System Specifics

Perl believes that no machine ever has more than one of C<change>,
C<age>, or C<quota> implemented, nor more than one of either

os2/.packlist  view on Meta::CPAN

i:/perllib/lib/5.8.2/os2/auto/POSIX/geteuid.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/getgid.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/getgrgid.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/getgrnam.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/getgroups.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/getlogin.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/getpgrp.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/getpid.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/getppid.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/getpwnam.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/getpwuid.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/gets.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/getuid.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/gmtime.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/isatty.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/kill.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/labs.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/ldiv.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/link.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/load_imports.al type=file
i:/perllib/lib/5.8.2/os2/auto/POSIX/localtime.al type=file

os2/B/Deparse.pm  view on Meta::CPAN

sub pp_entereval { unop(@_, "eval") }

sub pp_ghbyname { unop(@_, "gethostbyname") }
sub pp_gnbyname { unop(@_, "getnetbyname") }
sub pp_gpbyname { unop(@_, "getprotobyname") }
sub pp_shostent { unop(@_, "sethostent") }
sub pp_snetent { unop(@_, "setnetent") }
sub pp_sprotoent { unop(@_, "setprotoent") }
sub pp_sservent { unop(@_, "setservent") }
sub pp_gpwnam { unop(@_, "getpwnam") }
sub pp_gpwuid { unop(@_, "getpwuid") }
sub pp_ggrnam { unop(@_, "getgrnam") }
sub pp_ggrgid { unop(@_, "getgrgid") }

sub pp_lock { unop(@_, "lock") }

sub pp_exists {
    my $self = shift;
    my($op, $cx) = @_;
    my $arg;
    if ($op->private & OPpEXISTS_SUB) {

os2/Config.pm  view on Meta::CPAN

d_getppid='define'
d_getprior='define'
d_getprotobyname_r='undef'
d_getprotobynumber_r='undef'
d_getprotoent_r='undef'
d_getprotoprotos='define'
d_getprpwnam='undef'
d_getpwent='define'
d_getpwent_r='undef'
d_getpwnam_r='undef'
d_getpwuid_r='undef'
d_getsbyname='define'
d_getsbyport='define'
d_getsent='define'
d_getservbyname_r='undef'
d_getservbyport_r='undef'
d_getservent_r='undef'
d_getservprotos='define'
d_getspnam='undef'
d_getspnam_r='undef'
d_gettimeod='define'

os2/Config.pm  view on Meta::CPAN

gethostent_r_proto='0'
getlogin_r_proto='0'
getnetbyaddr_r_proto='0'
getnetbyname_r_proto='0'
getnetent_r_proto='0'
getprotobyname_r_proto='0'
getprotobynumber_r_proto='0'
getprotoent_r_proto='0'
getpwent_r_proto='0'
getpwnam_r_proto='0'
getpwuid_r_proto='0'
getservbyname_r_proto='0'
getservbyport_r_proto='0'
getservent_r_proto='0'
getspnam_r_proto='0'
gidformat='"ld"'
gidsign='-1'
gidsize='4'
gidtype='gid_t'
glibpth='/usr/shlib  /lib /usr/lib /usr/lib/386 /lib/386 /usr/ccs/lib /usr/ucblib /usr/local/lib '
gmake='gmake'

os2/Config.pod  view on Meta::CPAN

routine is available.

=item C<d_getpwnam_r>

From F<d_getpwnam_r.U>:

This variable conditionally defines the C<HAS_GETPWNAM_R> symbol,
which indicates to the C program that the getpwnam_r()
routine is available.

=item C<d_getpwuid_r>

From F<d_getpwuid_r.U>:

This variable conditionally defines the C<HAS_GETPWUID_R> symbol,
which indicates to the C program that the getpwuid_r()
routine is available.

=item C<d_getsbyname>

From F<d_getsrvby.U>:

This variable conditionally defines the C<HAS_GETSERVBYNAME> 
symbol, which indicates to the C program that the 
getservbyname() routine is available to look up services
by their name.

os2/Config.pod  view on Meta::CPAN


=item C<getpwnam_r_proto>

From F<d_getpwnam_r.U>:

This variable encodes the prototype of getpwnam_r.
It is zero if d_getpwnam_r is undef, and one of the
C<REENTRANT_PROTO_T_ABC> macros of F<reentr.h> if d_getpwnam_r
is defined.

=item C<getpwuid_r_proto>

From F<d_getpwuid_r.U>:

This variable encodes the prototype of getpwuid_r.
It is zero if d_getpwuid_r is undef, and one of the
C<REENTRANT_PROTO_T_ABC> macros of F<reentr.h> if d_getpwuid_r
is defined.

=item C<getservbyname_r_proto>

From F<d_getservbyname_r.U>:

This variable encodes the prototype of getservbyname_r.
It is zero if d_getservbyname_r is undef, and one of the
C<REENTRANT_PROTO_T_ABC> macros of F<reentr.h> if d_getservbyname_r
is defined.

os2/POSIX.pm  view on Meta::CPAN

sub sqrt {
    usage "sqrt(x)" if @_ != 1;
    CORE::sqrt($_[0]);
}

sub getpwnam {
    usage "getpwnam(name)" if @_ != 1;
    CORE::getpwnam($_[0]);
}

sub getpwuid {
    usage "getpwuid(uid)" if @_ != 1;
    CORE::getpwuid($_[0]);
}

sub longjmp {
    unimpl "longjmp() is C-specific: use die instead";
}

sub setjmp {
    unimpl "setjmp() is C-specific: use eval {} instead";
}

os2/POSIX.pm  view on Meta::CPAN

		fcntl
		fileno
		fork
		getc
		getgrgid
		getgrnam
		getlogin
		getpgrp
		getppid
		getpwnam
		getpwuid
		gmtime
		isatty
		kill
		link
		localtime
		log
		mkdir
		nice
		open
		opendir

os2/POSIX.pod  view on Meta::CPAN


This is identical to Perl's builtin C<getppid()> function for
returning the process identifier of the parent process of the current
process , see L<perlfunc/getppid>.

=item getpwnam

This is identical to Perl's builtin C<getpwnam()> function for
returning user entries by user names, see L<perlfunc/getpwnam>.

=item getpwuid

This is identical to Perl's builtin C<getpwuid()> function for
returning user entries by user identifiers, see L<perlfunc/getpwuid>.

=item gets

Returns one line from C<STDIN>, similar to E<lt>E<gt>, also known
as the C<readline()> function, see L<perlfunc/readline>.

B<NOTE>: if you have C programs that still use C<gets()>, be very
afraid.  The C<gets()> function is a source of endless grief because
it has no buffer overrun checks.  It should B<never> be used.  The
C<fgets()> function should be preferred instead.

os2/Sys/Syslog.pm  view on Meta::CPAN


    $whoami = $ident;

    if (!$whoami && $mask =~ /^(\S.*?):\s?(.*)/) {
	$whoami = $1;
	$mask = $2;
    } 

    unless ($whoami) {
	($whoami = getlogin) ||
	    ($whoami = getpwuid($<)) ||
		($whoami = 'syslog');
    }

    $whoami .= "[$$]" if $lo_pid;

    $mask =~ s/%m/$!/g;
    $mask .= "\n" unless $mask =~ /\n$/;
    $message = sprintf ($mask, @_);

    $sum = $numpri + $numfac;

os2/auto/POSIX/autosplit.ix  view on Meta::CPAN

sub getgrnam  ;
sub atan2  ;
sub cos  ;
sub exp  ;
sub fabs  ;
sub log  ;
sub pow  ;
sub sin  ;
sub sqrt  ;
sub getpwnam  ;
sub getpwuid  ;
sub longjmp  ;
sub setjmp  ;
sub siglongjmp  ;
sub sigsetjmp  ;
sub kill  ;
sub raise  ;
sub offsetof  ;
sub clearerr  ;
sub fclose  ;
sub fdopen  ;

os2/auto/POSIX/getpwuid.al  view on Meta::CPAN

# NOTE: Derived from ../../lib/POSIX.pm.
# Changes made here will be lost when autosplit is run again.
# See AutoSplit.pm.
package POSIX;

#line 190 "../../lib/POSIX.pm (autosplit into ../../lib/auto/POSIX/getpwuid.al)"
sub getpwuid {
    usage "getpwuid(uid)" if @_ != 1;
    CORE::getpwuid($_[0]);
}

# end of POSIX::getpwuid
1;

os2/auto/POSIX/load_imports.al  view on Meta::CPAN

		fcntl
		fileno
		fork
		getc
		getgrgid
		getgrnam
		getlogin
		getpgrp
		getppid
		getpwnam
		getpwuid
		gmtime
		isatty
		kill
		link
		localtime
		log
		mkdir
		nice
		open
		opendir

syslog.pl  view on Meta::CPAN


    $whoami = $ident;

    if (!$ident && $mask =~ /^(\S.*):\s?(.*)/) {
	$whoami = $1;
	$mask = $2;
    } 

    unless ($whoami) {
	($whoami = getlogin) ||
	    ($whoami = getpwuid($<)) ||
		($whoami = 'syslog');
    }

    $whoami .= "[$$]" if $lo_pid;

    $mask =~ s/%m/$!/g;
    $mask .= "\n" unless $mask =~ /\n$/;
    $message = sprintf ($mask, @_);

    $sum = $numpri + $numfac;



( run in 0.456 second using v1.01-cache-2.11-cpan-454fe037f31 )