lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Javier Guerra wrote:
nice project! i've heard good things about APR, but don't know what kind of apps does it targets (apart from web servers, i guess). can you throw a line or two about this?

I'd describe it as a combination of a portable OS interface and general purpose library (mostly everything vital missing from the C standard libraries, which Lua uses). Amongst the modules are UUID, MD4/MD5, Base64, file i/o, pipes, sockets, filename matching (initial motivation to bind APR), directory manipulation, filepath manipulation, string transcoding, the list goes on[1]... A few projects currently using APR[2]:

 * Apache HTTP Server
 * Flood load tester
 * FreeSwitch
 * JXTA-C
 * mod_jk v2 and mod_webapp (part of Tomcat)
 * mod_spin
 * Subversion
 * libbtt (part of mod_bt)
 * Bloglines
 * Various Covalent Products

*Bitfields*
JG> my vote goes for numbers
AQ> Make your function accept a list of strings
RL> As always, I'd suggest using strings

Strings do seem to be `the Lua way'. And less prone to mistakes. Still considering...

RL> Are these really too expensive to retrieve, compared with the overhead of a scripting language? Otherwise, it's probably easier all round to just retrieve all of them.

I've considered this myself and this is the approach Perl, Python and Ruby have taken. However apr_stat() also returns permissions which I represent in three tables, user, group and world. Now if someone needs just the mtime of say a 1000 files this will require 4000 tables while a 1000 lua_Number's would have sufficed. My current implementation, apr.stat(path, what), has two modes: if just one property is requested, this is the property returned. More than one property means a table is returned. This works really well for filesystem-entry-type testing, for example:

if apr.stat(path, 't') == 'directory' then ...

And I'm *certainly* not going to implement filectime/filemtime/fileatime/file_exists/file_readable/is_directory/etc.. functions like PHP has :P

*Microseconds*
JG> i like fractional seconds. i.e. 1.0 = 1 sec, 0.001 = 1msec, 0.000001 = 1usec
AQ> Use fractional seconds.
RL> I like seconds.

Good, my preference as well. Thank you all!

 - Peter

[1] http://apr.apache.org/docs/apr/1.2/modules.html
    http://apr.apache.org/docs/apr-util/1.2/modules.html
[2] http://apr.apache.org/projects.html