GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Template::Iterator::AlzaboWrapperCursor(3) User Contributed Perl Documentation Template::Iterator::AlzaboWrapperCursor(3)

Template::Iterator::AlzaboWrapperCursor - Turns a Class::AlzaboWrapper::Cursor object into a TT2 iterator

  my $users =
      Template::Iterator::AlzaboWrapperCursor->new($cursor);
  # pass $users to a template

  my $users_with_pages =
      Template::Iterator::AlzaboWrapperCursor->new($users_with_pages);

In a template:

  [% FOREACH user = users %]
    Name: [% user.name %]<br />
  [% END %]

  [% FOREACH user_with_page = users_with_pages %]
    [% user_with_page.user.name %]: [% user_with_page.page.title %]
  [% END %]

This module allows a "Class::AlzaboWrapper::Cursor" object to be used as a TT2 iterator.

For a cursor which returns one object at a time, the iterator simply returns one object per iteration. When the cursor returns multiple objects, the iterator returns a hash reference where the keys are the table name of the object's class in lower-case, with camel-casing turned into underscores. The values of the hash are the objects.

So if the cursor returns "Foo::User" and "Foo::Page" objects, the keys are "user" and "page".

This class provides the following methods:

This method accepts a "Class::AlzaboWrapper::Cursor" object and returns an iterator suitable for use in TT2 templates.

I wish that TT2 allowed multiple assignment in "FOREACH" loops so we could just do this:

  [% FOREACH user, page = users_with_pages %]

That's so much cleaner.

Dave Rolsky, <autarch@urth.org>

Initially written for Socialtext, Inc.

Please report any bugs or feature requests to "bug-template-iterator-alzabowrappercursor@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

Copyright 2006 Dave Rolsky, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2022-04-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.