in reply to return from external subroutine

First, I agree with moritz's suggestion. Second, you might want to try use strict; and use warnings; The only thing more amazing than how quickly the errors they generate can help me find and fix a problem is how often I forget to use them from the outset myself.

Replies are listed 'Best First'.
Re^2: return from external subroutine
by kathys39 (Acolyte) on Aug 23, 2007 at 15:57 UTC
    my bad. The code is below with the proper markings. Again, the problem seems to be with the return of Parse.pm. All Parse.pm does it take the file, go thru it, and put parts in a mysql db. This does work. Let me know if I should post more. Thanks again. Tried -w and strict - no help!

    Main file:

    use Parse; # my custom Parse.pm in /etc/perl/ <use Moving; # my custom Moving.pm in /etc/perl ..... foreach $file (@filelist) { Parse::parse_file($file); Moving::move_file($file); ... }

    Parse.pm
    package Parse; sub parse_file { $file = $_[0]; # put data in database, etc. this all works file } return 1;
    Moving.pm
    package Moving; sub move_file { $oldfile = $_[0]; # move a file, rename it, etc } return 1;
      You're really going to want to reformat the code in your original post to look like that. Also, where is the file list coming from? You've left the juicy bits of your code out of these snippits, and I'm afraid that I'm just not good enough to be able to make an intelligent guess without seeing what you're doing.

      If you are really confident that your internals are working just fine and can't post them here, might I suggest you look into using the debugger?

      At the very least I should put return 1 within the subroutine declaration. It has no place or use here outside of the {...}

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

        It's the end-of-package true value, so that use and require succeed.