It would be a great help if you could boil this code down to something small which reproduces the error, it might also help you work out why you are getting the error.

Looking at how you are using IPC::Shareable I think this is the root of the issue - If you look at the documents, you should be tie-ing variables like so:

use strict; use IPC::Shareable; my $glue = 'data'; my %options = ( create => 'yes', exclusive => 0, mode => 0644, destroy => 'yes', ); my %colours; tie %colours, 'IPC::Shareable', $glue, { %options } or die "server: tie failed\n";

Not like you did, ($deDuppedArrayHandle is effectively the return value of the tie, not a handle on the tied variable) :

my $glue = 'data'; my %options = ( create => 1, exclusive => 0, mode => 0644, destroy => 0, ); my $deDuppedArrayHandle = tie @deDuppedArray, 'IPC::Shareable', undef, + \%options; my $filesDownloadedHandle = tie @filesDownloaded, 'IPC::Shareable', un +def, \%options;

IPC::Shareable docs tells you that

"The association between variables in distinct processes is provided by GLUE. This is an integer number or 4 character string1 that serves as a common identifier for data across process space."
While you define $glue you don't actually use it in the tie, and furthermore you then use undef as the 'glue' for both your ties.

IPC::Shareable also tells you that

"exclusive If exclusive field is set to a true value, calls to tie() will fail (returning undef) if a data binding associated with GLUE already exists. If set to a false value, calls to tie() will succeed even if a shared memory segment associated with GLUE already exists. The default is false "

The result of which is that I would imagine that either your ties are failing (and returning undef) or the tie is working, but you are then overwriting the first tie (because you didn't make the tie exclusive, or provide an alternate glue), so when you come to use it, the data isn't there. I would suspect the first though.

I might be wrong about your error (i haven't tested my theory), but IPC::Shareable can be hard to use properly, so when i do, i stick rigidly to the examples given, or experiment fully before deploying it in anything important! HTH!

Just a something something...

In reply to Re: undefined value as an ARRAY reference: Using Tie with IPC::Shareable : New Code. by BioLion
in thread undefined value as an ARRAY reference: Using Tie with IPC::Shareable : New Code. by mr_p

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.