in reply to Re^3: Perl Module Problems
in thread Perl Module Problems
use strict; use warnings; use diagnostics; package HLDS; use Exporter (); our $VERSION = 1.00; our @ISA = qw(Exporter); our @EXPORT = (); our @EXPORT_OK = qw(array); # Create Map Array given an argument. sub GameMaps { # Declare Variables my ($game) = @_; my $user = $ENV{'USER'}; # Create Dir Path my $dir = "/home/$user/hlds_l/$game/maps/"; # End if dir not exist return unless -d $dir; #Read maps from directory my @maps; opendir(my $maps_dh, $dir) || die("Cannot open directory"); @maps = readdir($maps_dh); closedir($maps_dh); # Take only maps and trim .bsp @maps=grep /\.bsp/, @$game; foreach my $map (@maps) { $map=~ s/\.bsp// } return @maps; } 1; # end
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Perl Module Problems
by ikegami (Patriarch) on Sep 24, 2006 at 04:17 UTC |