Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^12: can't import using exporter

by perl-diddler (Hermit)
on Mar 16, 2012 at 09:01 UTC ( #959941=note: print w/ replies, xml ) Need Help??


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

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*


Comment on Re^12: can't import using exporter
Download Code
Re^13: can't import using exporter
by Anonymous Monk on Mar 16, 2012 at 09:26 UTC

    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
      Oi vey... It's spelled notation, not notion (synonym for naming or naming convention)... guess spelling errors aren't exactly program bugs... but regardless, definitely not caused by anything in 5.6.14. Still, In the manpage for module::runtime, it documents naming related changed affecting modules between 5.8->5.10 5.10->5.12 5.12->5.14. If one doesn't catch you...
      Core bugs worked around [Note -- change from 5.10 -> 5.12 ] The first bug worked around is core bug [perl #68590], which ca +uses lexical state in one file to leak into another that is "require"d/"use"d from it. This bug is present from Perl 5.6 u +p to Perl 5.10, and is fixed in Perl 5.11.0. From Perl 5.9.4 up to +Perl 5.10.0 no satisfactory workaround is possible in pure Perl. Th +e workaround means that modules loaded via this module don't suff +er this pollution of their lexical state. Modules loaded in other ways +, or via this module on the Perl versions where the pure Perl workaround + is impossible, remain vulnerable. The module Lexical::SealRequire +Hints provides a complete workaround for this bug. [Note change from 5.8 - > 5.10] The second bug worked around causes some kinds of failure in mo +dule loading, principally compilation errors in the loaded module, t +o be recorded in %INC as if they were successful, so later attempts +to load the same module immediately indicate success. This bug is pres +ent up to Perl 5.8.9, and is fixed in Perl 5.9.0. The workaround mean +s that a compilation error in a module loaded via this module won't be c +ached as a success. Modules loaded in other ways remain liable to produ +ce bogus %INC entries, and if a bogus entry exists then it will mislead +this module if it is used to re-attempt loading. [Note change from 5.12->5.14] The third bug worked around causes the wrong context to be seen + at file scope of a loaded module, if "require" is invoked in a location + that inherits context from a higher scope. This bug is present up t +o Perl 5.11.2, and is fixed in Perl 5.11.3. The workaround means that + a module loaded via this module will always see the correct conte +xt. Modules loaded in other ways remain vulnerable.
      I don't see it being a far stretch to think 5.14 isn't perfect after all that -- or, especially, that those changes broke programs that may have *unknowingly* been affected by them.

      In fact, From the above, it looks like major changes are in for 5.18 as well.

      FWIW, After fixing the spelling error in my program, I now get the errors I got in response ^5:

      > cnvWav2Flac Global symbol "$Filename2Fields" requires explicit package name at ./c +nvWav2Flac line 119. Global symbol "$Filename2Fields" requires explicit package name at ./c +nvWav2Flac line 127. Global symbol "$Filename2Fields" requires explicit package name at ./c +nvWav2Flac line 133. Global symbol "$Filename2Fields" requires explicit package name at ./c +nvWav2Flac line 137. Global symbol "$Filename2Fields" requires explicit package name at ./c +nvWav2Flac line 141. Global symbol "$Filename2Fields" requires explicit package name at ./c +nvWav2Flac line 145. Use of uninitialized value at ./cnvWav2Flac line 153.
      At this point, it looks like exporting vars just doesn't work right, as it isn't saying it's not defined --- and it should be imported, as I use Debug, and it is has the ISA line for Exporter, and the EXPORTS line for Filename2Fields -- with 'use', there is no need for a Begin block -- so it should be working...

      At this point I need to go look at the code some more, I still see no reason why Exporter isn't exporting the varname?...

      Thanks for a *helpful* post... a 2nd set of eyes is 75% of the reason I come here, having written in perl for over a decade...it's not like I hven't heard arguments about why one should do XYZY, but it's not how I want to design, and the language claims to allow otherwise, so I'm on the limits.../edge (in more ways than one)...

      -pd

Re^13: can't import using exporter
by Corion (Pope) on Mar 16, 2012 at 10:15 UTC

    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.

      You actually replied? For what purpose?

      Penchant for beating dead cows much?

      p.s. the documented spelling for 'the word after 800 in your last paragraph is 'line', no 's', please make a note of it. If it wasn't used as an adjective phrase for the next word, then the 's' would be appropriate. Guess we all can make spelling mistakes -- though as I stated earlier and you ignored, the word in the dictionary is spelled notational. The fact that the author misspelled it is a "UI" bug (i.e. the user-interface to the function causes confusion due to word misspelling or non-standard word usage).

        the word in the dictionary is spelled notational

        The 500 year old word "notional" means "pertaining to or expressing the idea of". It may be a poor UI choice, but is a valid word.

        I'm sorry - English is not my first language, nor my second or third, so I'm not necessarily familiar with all the colloquialisms. I know of the phrase "flogging a dead horse", but I'm unaware of the meaning of "beating a dead cow". Is this cockney slang for some sexual activity? It is maybe a bit telling, but my knowledge of the English language is mostly restricted to phrases that occur in polite conversation. I'm happy that you try to contribute back by helping me widen my vocabulary, but maybe you can explain in simple words what this phrase is supposed to express.

        As for the parts more closely related to Perl - it might not have been an explicit lesson by either merlyn or brian d foy, but neither Perl nor the authors of Perl modules are restricted to using only words in your dictionary. This fact might have come to your attention already as Perl let you use variable names such as $Filename2Fields instead of $File_name_to_fields. If the author of a module you use documents the name of a function, it is conventional to use that documented name to access that function instead of another name you'd have chosen instead. Perl supports you to modify your code to use the cromulent function names chosen by others, as it advises you when you use a different name for a function that the module author did not name in the same way.

        Of course, you are free to lament these literary disagreements and claim them as "bugs". You can of course write copy-edited Perl-code, but to expect that Perl and Perl authors adhere to your seemingly limited dictionary strikes me as a quite surprising stance, especially as there are quite a lot of Perl module authors who do not share your upbringing nor a copy of your dictionary. If you think that your vocabulary is the be-all end-all epitome of literacy, I recommend you start an initiative to convince all Perl programmers to only use words you approve of in function names and variable names. Until then though, I recommend that you start reading and understanding the error messages Perl so helpfully tries to provide you with, instead of claiming bugs in Perl. Especially reading the documentation of modules, and if in doubt, reading the source code of modules usually brings great enlightenmend as towards the vocabulary that other module authors use and offer to you to use as well.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2014-07-24 20:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls