Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Get value from object

by NetWallah (Canon)
on Feb 10, 2019 at 01:41 UTC ( [id://1229694]=note: print w/replies, xml ) Need Help??


in reply to Get value from object

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1229694]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-03-29 04:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found