FileDeletionByDate - Error

T

tomcat

Hello,

After executing script I have such a communicate:
Undefined subroutine &main::recurse called at ... line 74

Line 74 is:
recurse(\&Test_And_Delete, $Dir_Path);

Module recurse is installed, 1 line is use File::Recurse;.

What is wrong?

Regards,
Tom
 
G

Gunnar Hjalmarsson

tomcat said:
After executing script I have such a communicate:
Undefined subroutine &main::recurse called at ... line 74

Line 74 is:
recurse(\&Test_And_Delete, $Dir_Path);

Module recurse is installed, 1 line is use File::Recurse;.

What is wrong?

Perl is case sensitive.
 
A

Anno Siegel

tomcat said:
Hello,

After executing script I have such a communicate:
Undefined subroutine &main::recurse called at ... line 74

In your script? Or in the module file? Replacing essential parts of
the error message with "..." is not a good idea when you are seeking
help.
Line 74 is:
recurse(\&Test_And_Delete, $Dir_Path);

Module recurse is installed, 1 line is use File::Recurse;.

What is File::Recurse? It is not published on CPAN, so how are we
supposed to help? In any case, the module isn't "recurse", it's
"File::Recurse". Does its documentation say that it exports a
function named "recurse"?
What is wrong?

No idea, you have given far too little information. Read the
documentation that comes with File::Recurse.

Anno
 
B

Brian McCauley

Anno said:
What is File::Recurse?

It appears to be an old (and possibly morribund) attempt to fill the
ecological niche now occupied by File::Finder and File::Find::Rule.
It is not published on CPAN,

Yes it is.
Does its documentation say that it exports a
function named "recurse"?

No it does not.
 
A

Anno Siegel

Brian McCauley said:
It appears to be an old (and possibly morribund) attempt to fill the
ecological niche now occupied by File::Finder and File::Find::Rule.


Yes it is.

Oh. A CPAN search on cpan.uwinnipeg.ca doesn't find it, but on
search.cpan.org it does...
No it does not.

Oh well :)

Anno
 
T

tomcat

Gunnar Hjalmarsson said:
Perl is case sensitive.

ech... it is :)

There is no problem with undefined subroutine anymore but there is new
one...

"Can't use string ("D:\mp3") as a HASH ref while "strict refs" in use
at D:/Perl/site/lib/File/Recurse.pm line 36"

D:\mp3 is path in script:
"$Dir_Path = "D:\\mp3";"

Line 36 in MODULE is there:
"sub Recurse {
my $dirsref = shift || die 'Recurse: Need an array reference of
dirs';
my $rulesref = shift;
%files = (); # -- reset the global variable

# -- Set the rules to a hash that &wanted can access
%File::Recurse::RULES = %{ $rulesref }; ############# LINE
36 ###

# -- Process it all
finddepth(\&File::Recurse::wanted, @{ $dirsref });

return %files;
}"

Any ideas?

Regards,
Tom
 
A

Anno Siegel

tomcat said:
ech... it is :)

There is no problem with undefined subroutine anymore but there is new
one...

"Can't use string ("D:\mp3") as a HASH ref while "strict refs" in use
at D:/Perl/site/lib/File/Recurse.pm line 36"

What is the call that produces the error message? How are we supposed
to tell you what you do wrong when you don't say what you are doing?
D:\mp3 is path in script:
"$Dir_Path = "D:\\mp3";"

Line 36 in MODULE is there:
"sub Recurse {
my $dirsref = shift || die 'Recurse: Need an array reference of
dirs';
my $rulesref = shift;
%files = (); # -- reset the global variable

# -- Set the rules to a hash that &wanted can access
%File::Recurse::RULES = %{ $rulesref }; ############# LINE
36 ###

# -- Process it all
finddepth(\&File::Recurse::wanted, @{ $dirsref });

return %files;
}"

Any ideas?

Yes. Read the documentation for the module you are using!

In your original posting, the call was

Recurse(\&Test_And_Delete, $Dir_Path);

A glance at "perldoc File::Recurse" shows that the call is supposed
to be

Recurse(\@dirs, \%rules);

You are giving it a subref where it expects an arrayref, and a scalar
where it expects a hashref. That won't work.

Anno
 
T

tomcat

No idea, you have given far too little information. Read the
documentation that comes with File::Recurse.

Anno


Ok - I'll try to find the answer in documentation. I'm beginner in
Perl and I thought that it could be easier to solve this (like in
event of 'case sensitive').

Anyway, thanks for help
Tomek
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top