UR::Object::View::Default::Text(3) object views in text format

SYNOPSIS


$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;

DESCRIPTION

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.

WRITING A SUBCLASS

  # 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;