Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 01 Jul 2005 09:38:30 -0600
From:      "Aaron Dalton" <aaron@daltons.ca>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/82864: New Port: devel/p5-File-Random
Message-ID:  <E1DoNb4-000IUR-Qw@finch.st>
Resent-Message-ID: <200507011540.j61FeHYF018224@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         82864
>Category:       ports
>Synopsis:       New Port: devel/p5-File-Random
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 01 15:40:17 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Aaron Dalton
>Release:        FreeBSD 5.2.1-RELEASE i386
>Organization:
>Environment:
System: FreeBSD chariss.finch.st 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #1: Sat Mar 5 16:29:20 MST 2005 ross@chariss.finch.st:/usr/src/sys/i386/compile/CHARISS i386


	
>Description:
This module simplifies the routine job of selecting a random file. (As you 
can find at CGI scripts).

It's done, because it's boring (and errorprone), always to write something 
like

  my @files = (<*.*>);
  my $randf = $files[rand @files];

or

  opendir DIR, " ... " or die " ... ";
  my @files = grep {-f ...} (readdir DIR);
  closedir DIR;
  my $randf = $files[rand @files];

It also becomes very boring and very dangerous to write randomly selection 
for subdirectory searching with special check-routines.

The simple standard job of selecting a random line from a file is 
implemented, too.

-----
NOTE: This module has a large number of prerequisites used solely for 
testing.  Since the ports system does not do the 'make test' step, I have 
omitted these prereqs in the Makefile.  This means, however, that a number 
of warnings will be output at the 'perl Makefile.PL' stage.  I do not know 
if there is a conventional way to suppress such warnings.

>How-To-Repeat:
	
>Fix:

	

--- submission.txt begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	p5-File-Random
#	p5-File-Random/Makefile
#	p5-File-Random/distinfo
#	p5-File-Random/pkg-descr
#	p5-File-Random/pkg-plist
#
echo c - p5-File-Random
mkdir -p p5-File-Random > /dev/null 2>&1
echo x - p5-File-Random/Makefile
sed 's/^X//' >p5-File-Random/Makefile << 'END-of-p5-File-Random/Makefile'
X# New ports collection makefile for:	p5-File-Random
X# Date created: 			01 July 2005
X# Whom: 				Aaron Dalton <aaron@daltons.ca>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	File-Random
XPORTVERSION=	0.17
XCATEGORIES=	devel perl5
XMASTER_SITES=	${MASTER_SITE_PERL_CPAN}
XMASTER_SITE_SUBDIR=	File
XPKGNAMEPREFIX=	p5-
X
XMAINTAINER=	aaron@daltons.ca
XCOMMENT=	Perl module for random selecting of a file
X
XBUILD_DEPENDS=	${SITE_PERL}/${PERL_ARCH}/Want.pm:${PORTSDIR}/devel/p5-Want
XRUN_DEPENDS=	${BUILD_DEPENDS}
X
XPERL_CONFIGURE=	yes
X
XMAN3=		File::Random.3
X
X.include <bsd.port.mk>
END-of-p5-File-Random/Makefile
echo x - p5-File-Random/distinfo
sed 's/^X//' >p5-File-Random/distinfo << 'END-of-p5-File-Random/distinfo'
XMD5 (File-Random-0.17.tar.gz) = 4138133bf7fb0a2b4400073a3f1cea1d
XSIZE (File-Random-0.17.tar.gz) = 12834
END-of-p5-File-Random/distinfo
echo x - p5-File-Random/pkg-descr
sed 's/^X//' >p5-File-Random/pkg-descr << 'END-of-p5-File-Random/pkg-descr'
XThis module simplifies the routine job of selecting a random file. (As you 
Xcan find at CGI scripts).  It's done, because it's boring (and 
Xerrorprone), always to write something like
X
X  my @files = (<*.*>);
X  my $randf = $files[rand @files];
X
Xor
X
X  opendir DIR, " ... " or die " ... ";
X  my @files = grep {-f ...} (readdir DIR);
X  closedir DIR;
X  my $randf = $files[rand @files];
X
XIt also becomes very boring and very dangerous to write randomly selection 
Xfor subdirectory searching with special check-routines.  The simple 
Xstandard job of selecting a random line from a file is implemented, too.
X
XWWW: http://search.cpan.org/dist/File-Random/
XAuthor: Janek Schleicher <bigj@kamelfreund.de>
X
X- Aaron Dalton
Xaaron@daltons.ca
END-of-p5-File-Random/pkg-descr
echo x - p5-File-Random/pkg-plist
sed 's/^X//' >p5-File-Random/pkg-plist << 'END-of-p5-File-Random/pkg-plist'
X%%SITE_PERL%%/File/Random.pm
X%%SITE_PERL%%/%%PERL_ARCH%%/auto/File/Random/.packlist
X@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/File/Random
X@unexec rmdir %D/%%SITE_PERL%%/%%PERL_ARCH%%/auto/File 2>/dev/null || true
X@unexec rmdir %D/%%SITE_PERL%%/File 2>/dev/null || true
END-of-p5-File-Random/pkg-plist
exit
--- submission.txt ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1DoNb4-000IUR-Qw>