develooper Front page | perl.beginners | Postings from April 2010

Too many arguments for OneTickUtil::getFilesFromDir at G:\workspace1\scripts\fooPackage.pl line 4, near "$pattern)"

Thread Next
From:
dbtouch
Date:
April 28, 2010 01:52
Subject:
Too many arguments for OneTickUtil::getFilesFromDir at G:\workspace1\scripts\fooPackage.pl line 4, near "$pattern)"
Message ID:
3fd53499-23c8-43eb-b64c-966348d388d2@d12g2000vbr.googlegroups.com
Hi, Perl Folks

I am getting error "Too many arguments for
OneTickUtil::getFilesFromDir at G:\workspace1\scripts\fooPackage.pl
line 4, near "$pattern)" when running a small script calling a package
routine. Could you give some ideas on what I did wrong?

Thanks,

db

# OneTickUtil.pm
use File::Find;
use Date::Calc qw(:all);
use File::Path;

##############################################################
#      OneTickUtil
#
# Some classes and functions to use in omd examples
##############################################################

package OneTickUtil;

our $Dir;
our $searchPattern;

sub getFilesFromDir()
{
	($Dir, $searchPatter) = @_;
	@fileArrays = ();
	find(\&filter, $dirPattern);
	return @fileArrays;
}

sub filter
{
	my $pathFile = $Dir . '\\' . $_;
	if (($pathFile =~ m/$searchPattern/i) && (-f $pathFile))
	{
		push(@CSVFiles, $pathFile);
	}

}

1;

# foolPackage.pl
use OneTickUtil;
my $dir='F:\\omd\\Win32_REUTERS_IDN_SELECTFEED_Collector\
\one_market_data\\one_tick\\lib';
my $pattern='omd*';
my @files = OneTickUtil::getFilesFromDir($dir, $pattern); # error
happens
foreach my $file (@files)
{
	print $file . "\n";
}



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About