**************************************************** * DOCUMENT DOWNLOADED FROM: * * gopher.floodgap.com/0/buck/dbrowse%3ffaquse%201a * **************************************************** Bucktooth: Gophermap and gopher globbing ---------------------------------------- This section is only valid if gopher globbing is enabled when you first built Bucktooth, and if you are using Bucktooth 0.2 or higher. Globbing in your Perl may depend on vagaries of implementation which I'll talk about at the end. I mentioned that in the gophermap file, something like 1src is automatically expanded into the right relative path, given the server's host name and port, and the filename is used as the display string. What if you used a wildcard here instead? If you are on Bucktooth 0.1-pr5 or earlier, or don't have gopher globbing on, then the server faithfully offers a filename with the wildcard in it, which will almost certainly not work and is probably not what you want unless you're the kind of person who rips wings off small birds and lets them roast to death in the sun. (In that case, carry on.) However, if you enable gopher globbing, then this line is expanded to match *every* filename that matches the spec, in the exact same way a shell would glob it (in terms of the Perl glob() function). This allows you to do many useful tricks such as smart directory listings, embedding listings inside of gophermap files (so that things autoupdate), or forcing a group of files en-masse into a particular itemtype context. What's even cooler is that because glob() is used, the old syntax is 100% upward compatible; a filename with no wildcards in it simply becomes a single filename as before. (As a side effect, however, if there is no file in the directory by that name, you will get no files matching and NO FILES SHOWN. Watch out!) Now, what about item types? Item types follow these rules: * The special item type "?" (chosen on purpose) tells Bucktooth that you want the server to assign item types for you. In that case, Bucktooth will give an appropriate item type based on the file type, extension and contents using the same rules it would use for a formatted directory listing. For example, ?* is the same as the regular formatted directory Bucktooth generates for a directory without any gophermap file. * For any other character item type, ALL of the filenames that match the glob will take that itemtype (whether it's appropriate or not). Example: i* displays a directory listing, but as informational text only (akin to the output from a command like "ls -1"). Another: 9binary??? forces all the files to be presented as binary data, no matter what they actually have. (This INCLUDES DIRECTORIES!!!) Similarly, 1stuff*.txt forces all the files to be presented as directories. This can be useful if the file(s) in question contain RFC-1436-compliant lines, but may also make clients confused. Be careful that snarky files don't sneak in with things like this. Any and all itemtype characters can be used in this fashion. Because it uses shell-globbing, dot-files are not fetched unless you explicitly ask for them in your pattern, and the special filenames gophermap, . and .. are never served, just like for regular directories, even if they do match. If you have smart linking on (see the previous manual section), then it is also applied to files that match the glob. Likewise, if you turn sorting on, then globs are also alpha-sorted too. If you have gophertags on (see the previous manual section), then if the particular resource being examined is a directory and it has a "gophertag" file, then the contents of that file become the display string. This occurs AFTER sorting is done, i.e., sort order is determined by file name, not by display string. Old, ancient and antediluvian Perls (< 5.6.0, < 5.005 and < 5.000 respectively) implement glob() in terms of a call to csh to ask the shell to do the work (for that matter, Perl 4 doesn't even have glob() anyway, just the <> operator). This doesn't require any modules, but is technically disgusting and can be slow on older systems. For this reason, you may take a performance hit on an old Perl with this option turned on, and it probably won't work anywhere else but Unix even though Bucktooth really isn't supported yet in non-Unix environments. However, on fast systems the performance hit may be minimal and therefore functionally imperceptible. Try and see. As of 5.6.0, glob() is implemented with File::Glob. This requires the presence of File/Glob.pm, which should come with the standard distribution, but slimline sites trying to pare down fat will need to make sure they include it. However, this approach (being internal) is much faster. .