| UR::Object::View::Default::Text(3pm) | User Contributed Perl Documentation | UR::Object::View::Default::Text(3pm) |
UR::Object::View::Default::Text - object views in text format
$o = Acme::Product->get(1234); # generates a UR::Object::View::Default::Text object: $v = $o->create_view( toolkit => 'text', aspects => [ 'id', 'name', 'qty_on_hand', 'outstanding_orders' => [ 'id', 'status', 'customer' => [ 'id', 'name', ] ], ], ); $txt1 = $v->content; $o->qty_on_hand(200); $txt2 = $v->content;
This class implements basic text views of objects. It is used for command-line tools, and is the base class for other specific text formats like XML, HTML, JSON, etc.
# In Acme/Product/View/OutstandingOrders/Text.pm
package Acme::Product::View::OutstandingOrders::Text;
use UR;
class Acme::Product::View::OutstandingOrders::Text {
is => 'UR::Object::View::Default::Text'
};
sub _initial_aspects {
return (
'id',
'name',
'qty_on_hand',
'outstanding_orders' => [
'id',
'status',
'customer' => [
'id',
'name',
]
],
);
}
$v = $o->create_view(perspective => 'outstanding orders', toolkit => 'text');
print $v->content;
UR::Object::View, UR::Object::View::Toolkit::Text, UR::Object
| 2024-06-15 | perl v5.38.2 |