UR::Object::View::Default::Text(3pm)

UR::Object::View::Default::Text3pm

Object views in text format

Usage

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

Overview

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;

Releases

6 releases since Debian 8 (Jessie); the text changed 4 times.

  1. 8
  2. 9
  3. 10–11
  4. 12
  5. 13

From libur-perl 0.470+ds-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.