I do not care about your personal details, I was asking about your programming background, so that we'd know where you are coming from and what topics to use when trying to help you. Pascal is not really what I would have expected, but truth be told I've seen a (to my great surprise functional) program in pascal that started with a declaration of labels and variables and the it went from BEGIN to END. You are not a programmer by trade, OK, that's perfectly fine. What are you by trade? We do not want to know to belittle you, we want to know so that we can help. To be able to choose similes and examples that would make sense to you.

The solution is not Raku and as you convert more and more code you'll encounter the very same problems you are facing now. I can see use for a package sharing constants, but if you have a package for sharing global variables, you are doing it all wrong.

Maybe instead of trying to understand OOP, you ought to try using it. I don't mean using an OOP module made by someone else. I mean designing a tiny little module of your own. You'll likely go through several designs before things start to make sense, but that's to be expected. Back when I was starting with OOP I designed and redesigned and reredesigned a little text-mode menu and dialog library in Pascal and while I never used it in anything that anyone else would ever use, it was a great learning experience.

Perhaps you need to ignore all that inheritance and encapsulation talk and just start stuffing some data and subroutines changing that data into a separate package and eventually go from

my $results1 = doTheSearch(p1,p2,p3,p4,p5,p6,p7,...p55); my $results2 = doTheSearch(p1,p2,p3,otherp4,p5,differentp6,p7,...p55);
to
my $search = new Search(p1,p2,p3); $search->setLocalizationOptions(p21,p22,p23,p24); $search->enableThis(); $search->disableThat(); $search->setFulltextEngine('server', $username, $password); ... my $results1 = $search->searchFor(p4, p5, p6); my $results2 = $search->searchFor(otherp4, p5, differentp6);

In reality most classes never get subclassed and never import any traits or participate in any other OO stuff, so don't worry about those and don't worry that it all doesn't make sense. An object is not some esoteric concept, it's just a bunch of variables and methods. Something you can feed parameters to in chunks and have it keep the state. If you tend to call your search subroutine with 50+ parameters severa times and most parameters stay the same, then it should have been an object instead. And object that first receives (most of) the stuff that stays same and then each time gets called to do the work with just the stuff that changes passed at that particular place.

Jenda
1984 was supposed to be a warning,
not a manual!


In reply to Re^4: Ordering of parameters - Re^9: Converting Unicode by Jenda
in thread Converting Unicode by BernieC

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.