in reply to Re: comments break my code
in thread comments break my code

this is it

t.pl

#!/usr/bin/perl -w use strict; use CGI; use Tester::Test; Tester::Test->test();
Test.pm
package Tester::Test; use strict; sub test{ print "test"; } #test 1; __END__

Replies are listed 'Best First'.
Re^3: comments break my code
by simonm (Vicar) on Nov 19, 2005 at 17:09 UTC
    If you're editing files on Windows and running them on a Mac, you might need to check your line endings -- is there a real carriage-return between the comment and the "1;" line? -Simon
      holy crap... thanks. the .pm had mac lineendings.
      fixed that and it worked.
      Guess I am offically an idiot.

        You aren't the first, nor the last, to be nailed by line ending issues: don't worry about it. :-)

        ---
        $world=~s/war/peace/g

        Welcome to the club. This sort of thing is embarassing, but consider this - you'll probably never make this particular mistake again...

Re^3: comments break my code
by fmerges (Chaplain) on Nov 20, 2005 at 12:27 UTC

    Hi,

    A thing that has nothing to do with your problem, but I won't use the indirect method call when you're not dealing with OO. Tester::Test->test() Because that way your first argument in the @_ array will be the Package name 'Tester::Test'.

    Use the normal method Tester::Test::test() or use the Exporter module to import the subroutines into your namespace.

    Tester::Test.pm
    package Tester::Test; use strict; use Exporter qw/ import /; our @EXPORT_OK = qw/ test /; sub test{ print "test"; } 1;
    t.pl
    #!/usr/bin/perl -w use strict; use CGI; use Tester::Test qw/test/; # if you want to import it into your namesp +ace Tester::Test::test(); # or directly test() if you have imported it exit;

    Regards,

    |fire| at irc.freenode.net