Just to see if this could be done :)

NOTE: I faked the rest of your object since yours was incomplete :(

#!/usr/bin/perl -l # https://perlmonks.org/?node_id=1229668 use strict; use warnings; my $CustomField = bless { foo => 1, values => bless({ maxvalues => 1, name => 'Case type', }, 'ClassOne'), bar => 2, }, 'ClassTwo'; use Data::Dumper; print Dumper $CustomField; print '$CustomField->Values->Name = ', $CustomField->Values->Name; ######################## just add this ( hehehe :) sub UNIVERSAL::AUTOLOAD { my $basename = (split /::/, $UNIVERSAL::AUTOLOAD)[-1]; $basename eq 'DESTROY' and return; my ($realname) = grep lc $basename eq lc, keys %{ $_[0] }; defined $realname or die "Missing the key '$basename'"; return $_[0]{$realname}; }

Outputs:

$VAR1 = bless( { 'values' => bless( { 'name' => 'Case type', 'maxvalues' => 1 }, 'ClassOne' ), 'bar' => 2, 'foo' => 1 }, 'ClassTwo' ); $CustomField->Values->Name = Case type

In reply to Re: Get value from object by tybalt89
in thread Get value from object by danny20085

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.