| version 1.13, 2010/03/22 21:13:53 |
version 1.15, 2010/05/26 20:41:15 |
|
|
| package OpenBSDTorrents; |
package OpenBSDTorrents; |
| #$RedRiver: OpenBSDTorrents.pm,v 1.12 2010/03/22 19:08:48 andrew Exp $ |
#$RedRiver: OpenBSDTorrents.pm,v 1.14 2010/05/19 22:19:43 andrew Exp $ |
| use 5.008005; |
use 5.008005; |
| use strict; |
use strict; |
| use warnings; |
use warnings; |
|
|
| |
|
| my $config_file = '/etc/OpenBSDTorrents.conf'; |
my $config_file = '/etc/OpenBSDTorrents.conf'; |
| our $OBT = Config(); |
our $OBT = Config(); |
| our $INSTALL_ISO_REGEX = qr/install\d+\.iso/xms; |
our $INSTALL_ISO_REGEX = qr/ \b install\d+\.iso \b /xms; |
| our $SONG_REGEX = qr/^song.*\.([^\.]+)$/xms; |
our $SONG_REGEX = qr/^song.*\.([^\.]+)$/xms; |
| |
|
| sub Config |
sub Config |
|
|
| sub Get_Files_and_Dirs |
sub Get_Files_and_Dirs |
| { |
{ |
| my $basedir = shift; |
my $basedir = shift; |
| |
|
| |
if ( -f $basedir ) { |
| |
$basedir =~ s{^.*/}{}xms; |
| |
return [], [ $basedir ]; |
| |
} |
| |
|
| opendir DIR, $basedir or die "Couldn't opendir $basedir: $!"; |
opendir DIR, $basedir or die "Couldn't opendir $basedir: $!"; |
| my @contents = sort grep { ! /^\.\.$/ } grep { ! /^\.$/ } readdir DIR; |
my @contents = sort grep { ! /^\.\.$/ } grep { ! /^\.$/ } readdir DIR; |
| closedir DIR; |
closedir DIR; |