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


in reply to Re^5: Correct syntax for using $INC to keep modules in same file
in thread can't import using exporter

You do so the same way you tell Perl that sort should load files and grep should shell out to Nethack.
So you can't really say. That's why I listen but when told to leap over the cliff, I don't join the lemmings. When I asked that question on the p5p list, I was told "you don't", perl doesn't support using in-memory versions of modules, and we like it that way. It's not a matter of not being able to do it, it's religious zealotry.

I'm not working against perl, I'm working against the tainted Koolaid. I know it can be better, and I know people are against it being better. My code doesn't work when I try to follow the manpages and manual -- when I go all quirky -- that's when my code works. I hate myself later, but I resolve to keep pushing for change. Usually, the changes I want come about -- but usually happen long after people have forgotten that I tried to push for them years earlier.

I have trouble debugging my code? The reason I posted here was because perl claims to be UTF-8 compliant, but has a big whole in it's implementation -- in that it treats U+0-U-127 as Unicode, U+128-255 as Latin1, and U+256 and above as UTF-8. That's broken. That has nothing to do with the way I am programming.

You didn't answer my questions you just continue to speak in riddles referring grep to using nethack while not answering how what I was doing was re-implementing modules and was not implementing same-file Classes that perl lacks?

You seem to think perl doesn't change, but just looking at the changes from 5.10->5.12-- there was a change in isa -- it went from not working with inheritance to working;

"object->isa('Foo') would report false if the package Foo didn't exist, even if the object's @ISA contained Foobject->isa('Foo') would report false if the package Foo didn't exist, even if the object's @ISA contained Foo.

Bugs in autoload related to ISA were fixed, and autoload methods often didn't:"Various bugs in the new-to 5.10.0 mro code, triggered by manipulating @ISA, have been found and fixed.In the 5.10.0 release, a dynamically created AUTOLOAD method might be missed (method cache issue) RT #60220,60232."

What works in perl in any given release changes. It's documented. You may believe it hasn't changed, but oh well.

As for the previous anonidjit, knowing when to Export and when to make something a class is a sign of knowing your tools. Always using the same methodology for each problem is... a sure way to obsolescence.

Replies are listed 'Best First'.
Re^7: Correct syntax for using $INC to keep modules in same file
by chromatic (Archbishop) on Jul 02, 2012 at 22:01 UTC
    I was told ... perl doesn't support using in-memory versions of modules.

    Nonsense.

    You have been told repeatedly in this thread that the semantics of the order of operations of bareword checking and importing have been long established and documented and tested and unchanged for years. You have been given several suggestions as to how to fix your problem.

    Download any of several dozen of releases of Perl and try the various examples multiple people have given you in this thread. It's easy. It's empiricism.

    You seem to think perl doesn't change...

    I'm not interested in helping you if you're going to put strawmen arguments in my mouth.

      Nonsense.
      Really? Show me how I can have 'use' default to NOT searching for something without me poking into perl internals like $::INC{magic_name_change(A::B::C)=1};.

      Historically we didn't have computers, so none of your arguments regarding "established perl behavior" hold water. Things CHANGE. Just because perl did something a certain way in the past, doesn't mean it HAS to do it in the future.

      Defaulting to full UTF-8 compatibility is very possible. The idea that all new products must remain backward compatible with things created 20 years ago is ludicrous and a way to extinction.

      Microsoft *tried*, and they have alot more money and resources than perl does -- and they failed.

      Many things have been ***deprecated*** then removed or changed. Demanding that the perl remain Anglo-centric and default to the English languages' 8-bit charset LATIN-1 (or more specifically ISO-8859-1), is incredibly selfish and short-sighted. I can't believe how Anglo-Centric this list is - that you don't care about other countries or other language -- and what's your excuse for things remaining broken?

      Compatibility with programs written when 640K was considered good enough for any program... (or close to it). That's insane!

      5.8.0 did it wrong -- they didn't go through a use 'feature' stage, or a deprecation stage...they just shifted things to utf-8, which still is hard to believe -- that they didn't even check the users locale or environment like every other user-interactive program. Why would perl do that? Now everyone is gunshy about doing the right thing.

      If you want your 10-20 year old program to keep running, then keep your perl that you wrote it with. Don't expect that there won't be deprecations -- because there has been and there will be. To argue against change is to argue against life in multiple senses, but most of all, the life of the language. If you freeze it, you'll end up with Cobol. There isn't one language in use today that hasn't been revised if it is > a decade (probably > 3-5 years) old.

      I'm not interested in helping you if you're going to put strawmen arguments in my mouth.
      Huh?... I simply listed code that works... I didn't ask for help on this subthread. The code works very well. As I run it on more examples, I will probably find more things I need to account for, but at least it's in a modular format with separate classes for different functions that I can choose to replace or split out at will.

      And I am splitting out commonly used modules... (got complaints about that when someone couldn't get my code to run because my module wasn't in CPAN.

      So let me ask you -- you think CPAN is going to accept my modules? -- things like 'mem' which are completely empty of code (and take 1 line to code inline). Unlikely.

      So if I want to use modular code, I don't have a choice but to put it all in 1 file -- as its very unlikely my code would be accepted into CPAN.

      So how are you going to help that? Tell me to completely change the way I program? To program like some mindless drone? My time is too limited.

      Download which examples... are you talking about all the ones I tried that don't work, or the one I posted that works? I'm 98% sure the one written in all BEGIN's will work, as that's pretty much the only thing 'use mem' does (a sub for BEGIN).

      Since I'm writing most of my headers twice or in BEGINS now, how can you say I am not listening to any of the advice on here? That's exactly the 1 completely working test case that was posted.

      That I'm doing it in my own way, and not verbatim copying, is that your issue?

      How can you say I didn't end up doing it almost exactly the way, I think it was Corian, demonstrated? Think about it functionally rather than by form and name. I'm using BEGIN all over the place to get around the problems I earlier had. So can you be a bit more precise about what it is that you are trying to fix (since this program works), or what example I should or shouldn't be following, since functionally, I'm basically using Corian's technique of forcing half my definitions or more into BEGIN blocks.

      What is your beef? The fact that I want perl to process unicode as well as any other console text program? Gosh, how evil I am...

      Even the writeups about how perl can't handle UTF-8 in source are ridiculous... All Perl needs to do is call 'file <source>', and it will tell perl what encoding to use. I mean if it can do it, and perl can't, then just call it and use it's results.

        What is your beef? The fact that I want perl to process unicode as well as any other console text program? Gosh, how evil I am...

        What are you going on about? I've never said anything to you about Unicode. (I even just now deleted a response to your final paragraph.)

        Demanding that the perl remain Anglo-centric and default to the English languages' 8-bit charset LATIN-1 (or more specifically ISO-8859-1), is incredibly selfish and short-sighted.... So how are you going to help that? Tell me to completely change the way I program? To program like some mindless drone? My time is too limited.

        More strawmen. I'm sorry I bothered. I don't believe you're responding in good faith, and I'm done here.

Re^7: Correct syntax for using $INC to keep modules in same file
by Anonymous Monk on Jul 02, 2012 at 07:03 UTC

    That's why I listen but when told to leap over the cliff, I don't join the lemmings.

    How dare you insult the poor lemmings by implying you're somehow smarter?

Re^7: Correct syntax for using $INC to keep modules in same file
by Anonymous Monk on Jul 02, 2012 at 07:12 UTC

    (method cache issue) RT #60220,60232."

    What works in perl in any given release changes. It's documented. You may believe it hasn't changed, but oh well.

    You code contained no such dynamic classes where caching/AUTOLOAD was an issue -- Your problem was basic misunderstanding of compile phases and of syntax