Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi everyone, I am a beginner of perl and I also work on CA Single Sign On. I am writing a script which will collect some values (called realms) from a Domain and store them into a perl array. There should be 272 elements stored in the array, however the perl array is only able to store 82 of them. Here is the code snippet
@realms=$domain->GetAllRealms(); $i=0; $realmSize=@realms; print fileWrite "\nSize of the Realm array is " . $realmSize; #Show +s size 82, should be 272 foreach $realm(@realms) { print fileWrite "\nRealm Name is" . $realm->Name(); #Prints 82 times }
If you think it's a memory issue, is there way we can overcome it, using the script only. The script works perfectly if the number of elements which needs to be stored in the array, is less than 82.

Replies are listed 'Best First'.
Re: Perl Array not able to store all realm objects
by LanX (Saint) on Aug 10, 2018 at 12:33 UTC
    Your Perl code is fine, you should check if GetAllRealms really does what you think it should.

    I googled and found a CA library documentation stating (emphasize added)

    Programming Guide for Perl
    • GetAllRealms
      Method—Retrieves All Top-level Realms in the Domain
    ...
    • Remarks
      To retrieve all top-level realms under a realm, call the PolicyMgtRealm->GetAllChildRealms method.

    so probably you have 272-82 non top-level realms?

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Re: Perl Array not able to store all realm objects
by haj (Vicar) on Aug 10, 2018 at 12:34 UTC

    It is safe to assume that Perl can store 272 (or even a lot more) elements in an array. You should dig into the reason why the GetAllRealms interface only delivers 82 of them, or why you expect 272 realms. Just guessing: The interface seems to deliver top level realms. Maybe you need to iterate over your realms and examine them with GetAllChildRealms?

Re: Perl Array not able to store all realm objects
by Eily (Monsignor) on Aug 10, 2018 at 12:33 UTC

    There's a pretty good chance (like 100%) that the issue is with GetAllRealms() and not the arrays, so you'll have to give us more information on that.