Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > FileDeletionByDate - Error

Reply
Thread Tools

FileDeletionByDate - Error

 
 
tomcat
Guest
Posts: n/a
 
      09-28-2004
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
 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      09-28-2004
tomcat wrote:
> 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.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
 
 
 
Anno Siegel
Guest
Posts: n/a
 
      09-28-2004
tomcat <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> 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
 
Reply With Quote
 
Brian McCauley
Guest
Posts: n/a
 
      09-28-2004
Anno Siegel wrote:

> 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.

 
Reply With Quote
 
Anno Siegel
Guest
Posts: n/a
 
      09-28-2004
Brian McCauley <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> Anno Siegel wrote:
>
> > 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.


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

> > Does its documentation say that it exports a
> > function named "recurse"?

>
> No it does not.


Oh well

Anno
 
Reply With Quote
 
tomcat
Guest
Posts: n/a
 
      09-29-2004
Gunnar Hjalmarsson <(E-Mail Removed)> wrote in message

> 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
 
Reply With Quote
 
Anno Siegel
Guest
Posts: n/a
 
      09-29-2004
tomcat <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> Gunnar Hjalmarsson <(E-Mail Removed)> wrote in message
>
> > 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"


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
 
Reply With Quote
 
tomcat
Guest
Posts: n/a
 
      09-29-2004
http://www.velocityreviews.com/forums/(E-Mail Removed)-berlin.de (Anno Siegel) wrote in message news:<cjbam6$ps6$(E-Mail Removed)-Berlin.DE>...

> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xffc Thread 0x228 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-30-2006 03:16 PM
Error connecting to SQLExpress 2005 locally (error: 26 - Error Locating Server/Instance Specified) hfk0 ASP .Net 2 03-27-2006 08:43 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 1 03-24-2006 04:20 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-24-2006 02:22 PM
Error 500: ERROR: Cannot forward. Writer or Stream already obtained. Error JavaQueries Java 1 03-01-2005 06:30 PM



Advertisments