UR::Ob...t::Html(3pm)

πŸ“¦
version 0.470 Β· 2 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

okay so bestie, you just opened UR::Ob...t::Html(3pm) and honestly? it's a lil guy but it's an important lil guy. it's giving "HTML views of objects" energy and we're gonna walk through it together, no cap. πŸ’–


✨ NAME ✨

UR::Object::View::Default::Html β€” represent object state in HTML format 🌸

like, literally what it says on the tin. it takes an object and renders its state as HTML. iconic behavior honestly.


πŸŽ€ SYNOPSIS πŸŽ€

here's the whole vibe, verbatim, don't @ me:

#####

package Acme::Product::View::OrderStatus::Html;

class Acme::Product::View::OrderStatus::Html {
  is => 'UR::Object::View::Default::Html',
};

sub _generate_content {
  my $self = shift;
  my $subject = $self->subject;
  my $html = ...
  ....
  return $html;
}

#####

$o = Acme::Product->get(1234);

$v = $o->create_view(
    perspective => 'order status',
    toolkit => 'html',
    aspects => [
      'id',
      'name',
      'qty_on_hand',
      'outstanding_orders' => [
        'id',
        'status',
        'customer' => [
          'id',
          'name',
        ]
      ],
    ],
);

$html1 = $v->content;

$o->qty_on_hand(200);

$html2 = $v->content;

so like, you subclass it with is => 'UR::Object::View::Default::Html', you write your own _generate_content that grabs $self->subject and hands back some $html, and then you can create_view on an object with a perspective, a toolkit => 'html', and a whole nested aspects list. then $v->content gives you the HTML. change the object ($o->qty_on_hand(200)), grab $v->content again, boom β€” fresh view. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so this class implements basic HTML views of objects. that's the whole thing. it's got standard behavior for all text views β€” nothing extra, nothing weird, just the solid baseline you build your cute custom HTML on top of. ✨


πŸ’œ SEE ALSO πŸ’œ

go read your sisters, bestie, they're all right here:

  • UR::Object::View::Default::Text
  • UR::Object::View
  • UR::Object::View::Toolkit::XML
  • UR::Object::View::Toolkit::Text
  • UR::Object

and that's the whole page, periodt 🫢 this one's running on perl v5.32.1 and the docs got stamped 2022-01-17 β€” so yeah, vintage but still serving. go build something pretty. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from