[ic] Problem with using %Db in local usertags (4.7.x)

Mike Heins mikeh@minivend.com
Thu, 19 Apr 2001 15:45:14 -0400


Quoting David Totten (akopia@davetotten.com):
> On Thu, Apr 19, 2001 at 07:44:08PM +0200, Stefan Hornburg (Racke) wrote:
> > I'm having a usertag like this:
> > 
> > UserTag example Routine <<EOF
> > sub {
> >     $db = $Db{'whatever'};
> >     unless ($db) {
> >         Log ("No such database: %s", 'whatever');
> >         return;
> >     }
> > }
> > EOF
> > 
> > If I call [example] on a page, I get an error "No such database".
> > The error can be avoided by placing [perl tables=whatever]
> > anywhere before [example]. This seems rather clumsy to me.
> > 
> > The database in question is SQL.
> > 
> > Any hints to improve this ?
> > 
> 
> This is how I was able to get a database handle in a usertag:
> 
>  UserTag example Routine <<EOF
>  sub {
> 
>      #I hacked this out by reading in the Interchange perl modules 
>      my $db = Vend::Data::database_exists_ref('database_name'); 
> 

If it is a global UserTag, that is the way. There is no other
way in a UserTag running under Safe.

We could revive [tag touch table][/tag] I suppose. But it really
wouldn't be any different than [perl tables=table][/perl].

We could make an "AlwaysOpen" or something, but then if we opened
the table in read-only what would happen when you wanted to write?

-- 
Red Hat, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <mheins@redhat.com>

Being against torture ought to be sort of a bipartisan thing.
-- Karl Lehenbauer