Re: [Maypole] Why is moniker used instead of of table name when looking for table specific templates?

From: Dave Howorth (Dave.Howorth at acm.org)
Date: Mon Dec 27 2004 - 21:40:44 GMT


Peter Speltz wrote:
> Really , really a nice try, Dave :) HOwever, in mysql table names are
> actually " Any character that is allowed in a directory name, except
> `/', `\', or `.' " So table name should be able to map to directory
> name no problem. Maybe other databases are different though.

(a) yes, other databases are different and (b) I agree for the case of
MySQL but I wouldn't be confident that Maypole is coded carefully enough
to handle it and I'm very sure you'd find it a pain to navigate in the
shell to create and manage those directories (as you demonstrated to
yourself).

But remember that Maypole is pretty simple-minded about table names and
such. If you want sensible text in the output HTML, they'd better be
just one singular noun. Not plural, not multiple words, no id suffixes etc.

> But how the heck do i know what it is? Its not documented anywhere
> and its overridable. Only through experimentation did i find it
> lowercases the whole thing. But what does it do to '_'? I don't know
> cause cdbi loader makes classes CamelCase.

Well UNIVERSAL::moniker doesn't spell out the rules in its pod but it's
very short so reading the code is really not unreasonable in this case.
Perhaps there should be an acronym in the documentation of such modules?
:) I guess UTSL comes closest (Use The Source Luke).

> I tried in creating a mysql table with all of these "characters you
> shouldn't use in unix file/directory names ( | ; , ! @ # $ ( ) < > /
> \ " ' ` ~ { } [ ] = + & ^ <space> <tab>j) and couldn't do it from
> the shell.

It's one way of finding out how good people are with the shell :) My
favourite was always creating files with newlines in their name. But I
can't remember how you get rid of them now :(

>> I get worked up about Maypole plugging raw table names and monikers
>> into the HTML output seen by users, but personally I don't care
>> that much what name is used for the template directory :)

> Me too. I was hoping to override moniker to fix this. I remember a
> thread on it and maypole being internally dependent on it. I hope
> that can be fixed.

There's no point in overriding moniker, IMHO. That's just adding a fudge
to a fudge. It would make the code even more confusing to read. My vote
would go for throwing out moniker entirely; just use the table name and
provide a means for the user-developer to override that if she wants
(similar to colnames or to the Class::DBI name mechanism that you can
use to stop it mangling your table names in the SQL interface).

This whole mess is a large part of why I set out to write my own Maypole
loader so the only name mangling that goes on is what I do and it's all
done explicitly in one place.

Cheers, Dave

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.298 / Virus Database: 265.6.5 - Release Date: 26/12/04

_______________________________________________ maypole mailing list maypole at lists.netthink.co.uk http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT