Here is a more traditional way to accomplish this (Compared to tybalt89's far more elegant solution):
#!/usr/bin/perl -l # https://perlmonks.org/?node_id=1229668 use strict; use warnings; my $OutsideObject= bless( { 'first_row' => 0, 'aliases' => [], 'is_limited' => 1, 'joins_are_distinct' => undef, 'limit_clause' => '', 'custom_field' => bless( { '_class' => 'RT::CustomField', 'original_user' => undef,'_SB_Record_Primary_RecordCache_ke +y' => 'id=17', 'fetched' => {'valuesclass' => 1, 'order' => 1, 'canonicalizeclass' => 1 }, 'values' => { 'description' => 'Tipo de caso a ser tratado', 'maxvalues' => 1, 'name' => 'Case type', 'valuesclass' => undef, }, #### LINES ADDED #### To complete }, 'CUSTOMCLASS'), #### Missing information }, "OUTER_CLASS"); ### From your post my $CustomField = $OutsideObject->{custom_field}; print "VALUES->NAME = ", $CustomField->Values->Name , "\n"; BEGIN{ package CUSTOMCLASS; sub Values { my ($self) = @_; $self->{_INTERNAL_POINTER} = "values"; return $self; # Allow chaining } sub Name{ my ($self) = @_; $self->{_INTERNAL_POINTER} and return $self->{ $self->{_INTERNAL_P +OINTER} }->{name}; return $self->{name}; } 1; }
OUTPUT:
VALUES->NAME = Case type

                As a computer, I find your faith in technology amusing.


In reply to Re: Get value from object by NetWallah
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.