FileDeletionByDate - Error

Discussion in 'Perl Misc' started by tomcat, Sep 28, 2004.

  1. tomcat

    tomcat Guest

    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
     
    tomcat, Sep 28, 2004
    #1
    1. Advertising

  2. 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
     
    Gunnar Hjalmarsson, Sep 28, 2004
    #2
    1. Advertising

  3. tomcat

    Anno Siegel Guest

    tomcat <> 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
     
    Anno Siegel, Sep 28, 2004
    #3
  4. 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.
     
    Brian McCauley, Sep 28, 2004
    #4
  5. tomcat

    Anno Siegel Guest

    Brian McCauley <> 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
     
    Anno Siegel, Sep 28, 2004
    #5
  6. tomcat

    tomcat Guest

    Gunnar Hjalmarsson <> 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
     
    tomcat, Sep 29, 2004
    #6
  7. tomcat

    Anno Siegel Guest

    tomcat <> wrote in comp.lang.perl.misc:
    > Gunnar Hjalmarsson <> 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
     
    Anno Siegel, Sep 29, 2004
    #7
  8. tomcat

    tomcat Guest

    -berlin.de (Anno Siegel) wrote in message news:<cjbam6$ps6$-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
     
    tomcat, Sep 29, 2004
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hfk0
    Replies:
    2
    Views:
    21,747
  2. JavaQueries
    Replies:
    1
    Views:
    3,765
    John C. Bollinger
    Mar 1, 2005
  3. Balaji
    Replies:
    3
    Views:
    10,194
  4. Bishop
    Replies:
    1
    Views:
    825
    Bishop
    Feb 24, 2007
  5. juvi
    Replies:
    3
    Views:
    1,082
    Alexey Smirnov
    Jan 22, 2009
Loading...

Share This Page