MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] a sub routine in minivend



Quoting Di Zhao (zhao_di@hotmail.com):
> ******    message to minivend-users from "Di Zhao" <zhao_di@hotmail.com>     ******
> 
> Hi, I am just wondering if there is a way of writing a named subroutine in 
> minivend so that I can call it in different perl code?
> My thought comes from this: Sometimes the price scheme is bizaare so I
> decide to reimplement the subtotal tag by my own scheme(define a user tag 
> named subtotal). Then I have to reimplement tags:total, shipping. In every 
> tag I have to write the same code to calculate the same price scheme, it 
> will make my life much easier and happier if I can find something that I can 
> define a sub total_amount() in the catalog.cfg and call it in my 3 tags. Is 
> there a way to do this? Or am I wrong from the start?

Of course. Look at the FlyCat example; you can write your own module
and include it for use in global UserTag routines.

UserTag foo Routine <<EOR
sub {
	use MyModule;
}
EOR

UserTag bar Routine <<EOR
sub {
	return MyModule::etc();
}
EOR

-- 
Mike Heins                          http://www.minivend.com/  ___ 
                                    Internet Robotics        |_ _|____
Any man who is under 30, and is     131 Willow Lane, Floor 2  | ||  _ \
not liberal, has not heart; and     Oxford, OH  45056         | || |_) |
any man who is over 30, and is not  <mikeh@minivend.com>     |___|  _ <
a conservative, has not brains.     513.523.7621 FAX 7501        |_| \_\
 -- Winston Churchill              


Search for: Match: Format: Sort by: