Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Problems? Is your data what you think it is?
 
PerlMonks  

Re^10: can't import using exporter

by perl-diddler (Friar)
on Mar 16, 2012 at 06:19 UTC ( #959925=note: print w/ replies, xml ) Need Help??


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

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

you put 90% of the the program in BEGIN{}.

You can't develop a program entirely in Begin.

As soon as you start including parts not in begin, you'll run into the fact that you didn't duplicate all of the definitions -- the 2nd being outside of the begin, so that warnings/strict don't complain.

Now you have 2 sets of defines -- those inside the begins, and those outside. You've doubled the development and maintenance.

None of the standard ways to ways suggested worked. While you may have found a workaround that works for you, that is not proving there is not a flaw in perl 5.14.x -- and that standard methods others suggest don't work, neither about 2 dozen more than I tried before coming here.

That's still fits the definition of broken usability, which still fits the definition of a bug.

The problem with simplifying all those pesky aliases and RO var, is that oft' times the problem becomes induplicable.

BTW, I have NEVER accused people of being bad at listening, I *SUCK* at communicating, ok? I know it. I'm stuck with it. I've taken courses, been to therapy, I'm defective -- unfortunately for me and the world. More times than not, I have it together enough to be understood without an interpreter, but have, on occasion, found that helpful!...

I trebly hesitate to post anything for me running up into another wall or another hard place. It isn't usually worth the effort. I figured this time, I'd tried everything except rewriting the program all inside a BEGIN statement. The use Module(util). and it's usage was the last suggestion mentioned to me on 5.10, when this was brought up -- and worked then -- it doesn't anymore.

The module suggested doesn't run on 5.14 without errors -- indicating that 5.14 has now broken it as well. Sure, it may be the modules fault, but if perl is breaking all these programs -- that is another bug -- it's not supposed to be breaking backwards compatibility without a "use feature"...

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.

But I honest still appreciate the work and effort you put into it, and have saved it... but that type of effort shouldn't be required for so little gain, nor should being required to write your code all one way.

Perl was supposed to be about the freedom to do things 20-100 different ways, and now, it's all one way, or a straight-jacket (people go crazy that way, don'thcha know?)...


Comment on Re^10: can't import using exporter
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 Anonymous Monk on Mar 16, 2012 at 07:29 UTC
Re^11: can't import using exporter
by Corion (Pope) 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.

      Extraordinary!!

      > x.pl "module_notational_filename" is not exported by the Module::Runtime mo +dule Can't continue after import errors at ./x.pl line 4. BEGIN failed--compilation aborted at ./x.pl line 4. Ishtar:/Audio/scripts> ^C Ishtar:/Audio/scripts> cat x.pl #!/usr/bin/perl -w use strict; use Module::Runtime qw(module_notational_filename); <p> <p> You can't say I didn't pare down my test program... right? It's does have some fluff. a blank line. sorry, I'm just lazy. <p> <p> Maybe you can get off your extraordinary high horse and realize that s +imple usage as documented in the manpage isn't tested in the CPAN Mat +rix, because I've given you extraordinary evidence that functionality + in that module is broken and Guess what -- that KEYWORD is in a @EXPORT_OK line -- so the evidence just rose extraordinarily that so +mething broke in 6.5.14 that this module relied on -- that has now ch +anged. <p> Are you still in denial or how many modules do I have to find I had an +other program that worked fine in 6.5.12, -- fails to work now with s +imilar errors as the one above. <code> Useless use of multiplication (*) in void context at /home/law/bin/ded +up line 664. String found where operator expected at /home/law/bin/dedup line 762, +near "Warn "Cannot cache scan results in %s: %s\n"" (Do you need to predeclare Warn?) String found where operator expected at /home/law/bin/dedup line 776, +near "Error "No Cached scan file in $scan_res_path to use.\n"" (Do you need to predeclare Error?) String found where operator expected at /home/law/bin/dedup line 780, +near "Warn "Ignoring cached results file '$scan_res_path'.\n"" (Do you need to predeclare Warn?) String found where operator expected at /home/law/bin/dedup line 787, +near "Warn "Cannot cache scan results in %s: %s\n"" (Do you need to predeclare Warn?) String found where operator expected at /home/law/bin/dedup line 820, +near "Error "FATAL: Starting paths must be on same device.\n"" (Do you need to predeclare Error?) String found where operator expected at /home/law/bin/dedup line 827, +near "Warn "$_: neither file nor dir. Ignoring in scan.\n"" (Do you need to predeclare Warn?) String found where operator expected at /home/law/bin/dedup line 833, +near "Error "$_ not readable; pathname blocking further examination\n +"" (Do you need to predeclare Error?) String found where operator expected at /home/law/bin/dedup line 849, +near "Debug "Got %d paths from command line\n"" (Do you need to predeclare Debug?) String found where operator expected at /home/law/bin/dedup line 862, +near "safe_printf "debug=%s, verbose=%s, scandev=%04x; "" (Do you need to predeclare safe_printf?) syntax error at /home/law/bin/dedup line 743, near "confess sprintf" syntax error at /home/law/bin/dedup line 762, near "Warn "Cannot cache + scan results in %s: %s\n"" syntax error at /home/law/bin/dedup line 776, near "Error "No Cached s +can file in $scan_res_path to use.\n"" syntax error at /home/law/bin/dedup line 780, near "Warn "Ignoring cac +hed results file '$scan_res_path'.\n"" syntax error at /home/law/bin/dedup line 787, near "Warn "Cannot cache + scan results in %s: %s\n"" syntax error at /home/law/bin/dedup line 820, near "Error "FATAL: Star +ting paths must be on same device.\n"" syntax error at /home/law/bin/dedup line 827, near "Warn "$_: neither +file nor dir. Ignoring in scan.\n"" syntax error at /home/law/bin/dedup line 833, near "Error "$_ not read +able; pathname blocking further examination\n"" syntax error at
      It's like stops exporting things reliably in larger, non-trivial programs.

      But of course trivial ones still work, so people can prove it works... *BROKEN*

        Like tobyink answered That's because it's called module_notional_filename

        You typed module_notational_filename but didn't copy/paste module_notional_filename

        $ perl -MModule::Runtime=module_notational_filename -e 1 "module_notational_filename" is not exported by the Module::Runtime mo +dule Can't continue after import errors at -e line 0. BEGIN failed--compilation aborted. $ perl -MModule::Runtime=module_notional_filename -e 1

        As Anonymous Monk already pointed out, your are misreading/mistyping the Module::Runtime documentation and trying to import a function that does not exist. Instead of looking for errors with Perl, maybe consider actually reading the error message and comparing it to the documentation. But as you seem to have a penchant for ignoring replies or not reading them, I will repeat it again:

        Module::Runtime does not export a function named module_notational_filename. It is only documented to export a function named module_notional_filename.

        As for your other "evidence", again, you don't show any code, you still do not seem to have a grasp as to how to debug things. I am not joking about the maximum of 10 lines for a program to demonstrate your extraordinary findings. Please put in the effort to reduce your programs, and consider splitting up the large program of over 800 lines into more manageable modules in separate files. This will not only help you in finding the errors, it will also limit the damage you can do by editing a single file to exactly that file, and keep lots of red herrings out of your mind. Also, this will likely limit the side effects of ill-advised changes or misunderstood documentation to a short and manageable file instead of showing error message in an 800 lines file.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://959925]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2014-04-21 02:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (489 votes), past polls