Global Scope of Hash

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aesculus
    Senior Member
    • Jan 2008
    • 450

    Global Scope of Hash

    > What is the correct way to define this hash so it can be seen in
    > routines in both files?


    Create an accessor method to get the variable (or a reference to it)
    from whereever you need

    sub getMyHash {
    \%myHash;
    }

    my $hashRef = Plugins:enonAvpControl::Plugin::getMyHash();
    Chris
  • Aesculus
    Senior Member
    • Jan 2008
    • 450

    #2
    Global Scope of Hash

    Sorry to ask a basic PERL question but ...

    I have a hash variable that I declare in my Plugin.pm file at the top.

    I need this to be available both globally in Plugin.pm which it is, but also to other files too such as

    use Plugins:enonAvpControl:enonAvpComms;

    I have tried using both my and our with errors during starting LMS.

    What is the correct way to define this hash so it can be seen in routines in both files?
    Chris

    Comment

    • Aesculus
      Senior Member
      • Jan 2008
      • 450

      #3
      Thank you. Programming is not my strong suit and PERL is way down the list. :-)

      Of course thinking more about this I could probably also just pass the values back in a command in this context. In this case one file obtains and displays the results of actions performed by another file.
      Last edited by Aesculus; 2021-05-10, 16:00.
      Chris

      Comment

      Working...