0

I started using Padre and while working on a particular program which works just fine when run from the command line, Padre shows a Compilation failed in require error message suggesting that there is a problem in BEGIN and I do not have a BEGIN block in my module.

So if someone could shed some light on what are the possible scenarios that this could happen. The module that is causing the error is over 500 lines of code, so don't think it is wise to paste all that.

Sometimes I wonder why I chose an IDE to cause me more (perhaps unnecessary) grief :-)

Thanks a lot.

toolic
  • 57,801
  • 17
  • 75
  • 117
Hameed
  • 2,227
  • 1
  • 21
  • 31

1 Answers1

2
 use Foo;

is short for

BEGIN {
   require Foo;
   import Foo;
}

Anyway that error message isn't noteworthy. It means that "I usually try to find all there errors, but I can't this time. Fix the earlier errors first." So what error did you actually get?

ikegami
  • 367,544
  • 15
  • 269
  • 518
  • Well, the problem is that when I open the Module in Padre, there is only two `uninitialized value` warnings and there is no other error in the main script either. Thanks Anyway. I suppose the debugger is getting confused because the actual script is supposed to run on a Solaris box and I am trying to emulate the environment in my windows PC just for the sake of running Padre and I am missing a module somewhere... Better be content to Vim over Putty. – Hameed Jul 30 '12 at 01:06
  • The message you gave will never ever happen without another fatal error message, no matter which OS you use. Now, it could be that's a bug in Padre that's hiding it... – ikegami Jul 30 '12 at 01:18
  • Found the problem. One of the used modules in my module calls getpwuid which is not available on windows, of course. The weird part was that it wasn't reporting it until I exlicitly put the `use TheModule` inside a BEGIN block. I suppose your clarification helped in a way. Thanks – Hameed Jul 30 '12 at 01:23
  • huh? How odd because `use TheModule;` is the same as `BEGIN { require TheModule; import TheModule; }`. It actually does create a BEGIN block internally! – ikegami Jul 30 '12 at 04:13
  • That's why I didn't figure it out in the first place. The actual error was in TheModule.pm and the IDE was not reporting it, but the same IDE was reporting it when it was used in another script. I checked it over and over again. Here: http://imageshack.us/photo/my-images/607/scr1h.png/ and http://imageshack.us/photo/my-images/3/scr2vq.png/. Check the Syntax Check window in both screenshots. – Hameed Jul 30 '12 at 04:35
  • I see you got the actual error message when you got the BEGIN failed message, like I said you should have gotten. Now, it would be nice if it showed an error on the `use` line (like EPIC, the Perl plugin for Eclipse does), but that's the first time this has come up in this conversation. – ikegami Jul 30 '12 at 05:03
  • I have used EPIC. I found PADRE to be faster. Anyways, I am not even sure if it is a Padre thing or my error somewhere. Thanks for all your help. – Hameed Jul 30 '12 at 06:11