Sys-User-UIDhelper

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

{
   "abstract" : "Helps for locating free UIDs using getpwuid.",
   "author" : [
      "Zane C. Bowers <vvelox@vvelox.net>"
   ],
   "dynamic_config" : 1,
   "generated_by" : "ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010",
   "license" : [
      "unknown"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",

META.yml  view on Meta::CPAN

---
abstract: 'Helps for locating free UIDs using getpwuid.'
author:
  - 'Zane C. Bowers <vvelox@vvelox.net>'
build_requires:
  ExtUtils::MakeMaker: '0'
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010'
license: unknown
meta-spec:

README.md  view on Meta::CPAN

# Sys-User-UIDhelper

Helps for locating free UIDs using getpwuid.

```perl
use Sys::User::UIDhelper;

# invokes it with the default values
my $foo = Sys::User::UIDhelper->new();

# sets the min to 2000 and the max to 4000
my $foo = Sys::User::UIDhelper->new(min=>2000, max=>4000);

lib/Sys/User/UIDhelper.pm  view on Meta::CPAN

package Sys::User::UIDhelper;

use warnings;
use strict;

=head1 NAME

Sys::User::UIDhelper - Helps for locating free UIDs using getpwuid.

=head1 VERSION

Version 0.1.0

=cut

our $VERSION = '0.1.0';

=head1 SYNOPSIS

lib/Sys/User/UIDhelper.pm  view on Meta::CPAN


This finds the first free UID. If it returns undef, no free ones were found.

=cut

sub first_free {
	my $self = $_[0];

	my $int = $self->{min};
	while ( $int <= $self->{max} ) {
		if ( !getpwuid($int) ) {
			return $int;
		}

		$int++;
	}

	return undef;
} ## end sub first_free

=head2 firstfree

lib/Sys/User/UIDhelper.pm  view on Meta::CPAN


This finds the first last UID. If it returns undef, no free ones were found.

=cut

sub last_free {
	my $self = $_[0];

	my $int = $self->{max};
	while ( $int >= $self->{min} ) {
		if ( !getpwuid($int) ) {
			return $int;
		}

		$int--;
	}

	return undef;
} ## end sub last_free

=head2 lastfree



( run in 0.278 second using v1.01-cache-2.11-cpan-8d75d55dd25 )