[ic] Proposal: Autoload bounce + inspect

Stefan Hornburg (Racke) racke at linuxia.de
Thu Feb 18 10:05:36 UTC 2010


Hello, Interchange enthusiasts!

Currently I'm working on my next Interchange/WellWell project, which is basically a spin-off
from http://www.f-shop.de/ for retailers. For this project, customers are required to login
to see any products or information.

The basic idea is to have code like the following in Autoload:

# check first whether user is logged in
unless ($Session->{logged_in} || $Session->{last_url} eq '/login') {
	$Tag->deliver({location => $Tag->area('login')});
	return 0;
}

Unfortunately this doesn't work because Interchange doesn't check for $Vend::Sent after
autoload processing, so the bounce doesn't take place. In addition, it just process any
other Autoload's sitting in the queue.

With WellWell [1], you can't just lump together all Autoload functionality in one routine,
as plugins like path_redirect [2] might define their own Autoload routines.

The attached patch addresses this by checking $Vend::Sent after executing one of
the dispatch routines and providing a new autoload_inspect SpecialSub which can
signal the end of autoload processing.

A sample routine for autoload_inspect could look like the following:

Sub autoload_inspect <<EOS
sub {
	my ($macro, $ret) = @_;

	if ($macro eq 'init' && ! $ret) {
		return 0;
	}

	return 1;
}
EOS

Regards
           Racke

[1] WellWell is an effort to enhance Interchange with a modern architecture and supersede
     a lot of unnecessary code by implementing hooks and plugins. WellWell is already in
     producution in some of my projects besides http://www.f-shop.de/. Email me for details.

[2] http://git.icdevgroup.org/?p=wellwell.git;a=tree;f=plugins/path_redirect

-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team


-------------- next part --------------
A non-text attachment was scrubbed...
Name: autoload.patch
Type: text/x-patch
Size: 1715 bytes
Desc: not available
URL: <http://www.icdevgroup.org/pipermail/interchange-users/attachments/20100218/f7c66688/attachment.bin>


More information about the interchange-users mailing list