http://www.perlmonks.org?node_id=959925


in reply to Re^9: can't import using exporter
in thread can't import using exporter

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^11: can't import using exporter
by chromatic (Archbishop) on Mar 16, 2012 at 07:11 UTC
    Perl was supposed to be about the freedom to do things 20-100 different ways...

    If you throw a random mess of nonsense at the compiler and expect it to do what you think you mean, you're going to spend a lot of time surprised at the results.

    Um... there are a few things your example doesn't do nor solve, yet proves.

    Nonsense. What Corion wrote is correct.

    ... standard methods others suggest don't work...

    Utter nonsense. Code I wrote that's been run countless millions of times would not work if that were true, and millions of successful test reports from CPAN Testers alone demonstrates that that feature works as it has for years.

Re^11: can't import using exporter
by Corion (Patriarch) on Mar 16, 2012 at 07:56 UTC
    ... Sorry. Breaking apart a 800 line perl prog that was a 185 line shell script , into a 10-15 file perl monster is messed up. ... The problem with simplifying all those pesky aliases and RO var, is that oft' times the problem becomes induplicable. ...

    This process is called debugging. If you are programming, you should familiarize yourself with it. If the problem becomes "induplicable", that means you have just eliminated one source of your problems. But it feels to me that you prefer others to put effort in solving your problems over cleaning your room first before asking for help.

    ... you put 90% of the the program in BEGIN{}. ... You can't develop a program entirely in Begin.

    My approach mechanically reproduces what use does. If that does not suit you, then you will have to restructure your code in a way that it does not rely on how use works. I'm not sure why you are hell-bent on doing things the way you do them, but I showed you where your approach fails and how you need to modify your approach to get to a result. Your impression that "standard methods" don't work is owed to the fact that you did not present the relevant code and did not show how you tried to rely on symbol exports happening at the right time. The "standard methods" rely on the programmer understanding Perl and understanding how and when symbols are exported from modules. I suggest that you learn more Perl.

    Also, it may surprise you, but you can easily develop a program entirely in BEGIN blocks, as long as you understand what BEGIN blocks are and what they do.

    The module suggested doesn't run on 5.14 without errors -- indicating that 5.14 has now broken it as well.

    Again, extraordinary claims require extraordinary evidence. The CPAN tester Matrix for Module::Util shows no breakage, and you have shown lots of broken code that you produce, and concepts that you misunderstand or ignore. In so far, I really, really recommend that you don't claim things that you do not have a program with less than 10 short lines for to reproduce them.

    Your program is a onerous, though proven, workaround, but it also gives ample fodder to any perl-hater out there about how broken a language perl is, because having to do that to have multiple classes in the same file is broken.

    No. You don't need to do any of that to have multiple classes in the same file. This only shows that you don't understand what you are doing. You are not declaring a single class in your code. As you claim to be educated by merlyn and brian d foy, it would amuse me if you found a section in their books or a statement by them where they claim that your shown approach is somehow object oriented and has entities where "class" would be an appropriate moniker. Especially the lack of the bless keyword is a certain indicator that you are not dealing with objects and classes in your code.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re^11: can't import using exporter
by Anonymous Monk on Mar 16, 2012 at 07:29 UTC