From f567d54b143b2a21ab2d67067f68e059edff1831 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Thu, 18 May 2006 02:02:49 +0000 Subject: [PATCH] added the quick() convenience method --- docs/changelog/6.x.x.txt | 1 + lib/WebGUI/Session.pm | 26 +++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index df5e7ab77..2d2468418 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -30,6 +30,7 @@ - Fixed a problem where last reply column wasn't being updated in the thread. - fix [ 1488556 ] blank page after setup - fix [ 1489528 ] HTTP header contains invalid time-stamp + - Added the quick() convenience method to WebGUI::Session. 6.99.0 diff --git a/lib/WebGUI/Session.pm b/lib/WebGUI/Session.pm index 9f3108fba..bbcf51aa6 100644 --- a/lib/WebGUI/Session.pm +++ b/lib/WebGUI/Session.pm @@ -53,10 +53,10 @@ B It is important to distinguish the difference between a WebGUI session $session = WebGUI::Session->open($webguiRoot, $configFile); $sessionId = $session->getId; + ($form, $db, $user) = $session->quick("form", "db", "user"); $session->close; $session->asset - $session->close $session->config $session->datetime $session->db @@ -64,11 +64,9 @@ B It is important to distinguish the difference between a WebGUI session $session->env $session->errorHandler $session->form - $session->getId $session->http $session->icon $session->id - $session->open $session->output $session->os $session->privilege @@ -432,6 +430,28 @@ sub privilege { #------------------------------------------------------------------- +=head2 quick ( methods ) + +A convenience method that returns a list of object references. + +=head3 methods + +An array of method names of the objects you want returned. + +=cut + +sub quick { + my $self = shift; + my @methods = shift; + my @list = (); + foreach my $method (@methods) { + push(@list, $self->$method); + } + return @list; +} + +#------------------------------------------------------------------- + =head2 request ( ) Returns the Apache request (aka $r) object, or undef if it doesn't exist.