GeoDB::Modify::Setattr.3pm

Langue: en

Autres versions - même langue

Version: 2009-11-10 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

Setattr - Add your own attributes

DESCRIPTION

START HELP

The ``Setattr'' plugin (short for 'Set Attributes') allows you to add your own ``attributes'' to waypoint(s). You must specify the command line option ``--save'' to get them to be saved permenently to the database though. You can pick any attribute name you want, although some other modify plugins (like the ``solved'' plugin) may expect particular attribute names.

Atttributes can be used for just about anything. For example, you can use them to store notes, remember hints from other people, collect data for a complex puzzle cache, etc.

Example of storing a note:

   > geoqo -s ident:GCABCD -m 'setattr:notes=I hate this puzzle' --save
 
 

Example of something silly:

   > geoqo -s ident:GCABCD -m 'setattr:foo=bar' --save
 
 

Then you can search for all caches with that name and value later:

   > geoqo -s attr:foo=bar -l
 
 

Example of solving a puzzle and saving it:

   > geoqo -s ident:GCABCD -m 'setattr:puzn=N38 42.444,puzw=W121 42.444' --save
 
 

Example of exporting it with the replaced coordinates:

   > geoqo -s ident:GCABCD -e 'solved:+loc:out.loc'
 
 

The setattr plugin lets you store your own information about a cache into the database. Some of the other plugins use attributes to manipulate things (see the solved plugin for an example). Sometimes you may want your own ``notes''. As an example, I modify Unknown puzzles that you solve in the field (instead of ``in advance'' puzzles like cross puzzles) with ``setattr:infield=1''. (then I can use that attribute with the modifier: plugin to drop all unknowns that don't have that attribute set or don't have a 'puzn' coordinate assigned showing I've solved it.

IMPORTANT NOTE: You must specify --save to the command line to have geoqo save your attribute changes back to the database. Otherwise you're only setting attributes temporarily during the one-time call of geoqo.

Math and Substitution

Math and Substition can be done by prefixing the values with ``math:'' and ``substitute:'' where the contents will be searched for names with other attribute names in ()s and replaced with the attribute values. And if the math: was used, it will then be evaluated. Multiple depth replacements/math will work.

Here's a more complex than needed example (the puzw attribute needs to be set as well for this to work):

   > geoqo -s ident:GCABCD -m 'setattr:puzn=substitute:N38 42.(A)(B)(C)' --save
   > geoqo -s ident:GCABCD -m 'setattr:A=4' --save
   > geoqo -s ident:GCABCD -m 'setattr:B=math:(A)*2' --save
   > geoqo -s ident:GCABCD -m 'setattr:C=math:(B)-(A)' --save
   > geoqo -s ident:GCABCD -m solved: -e out.gpx
 
 

Note that the actual equation will still be stored as the attribute; The calculation is done when the attribute is later read (for example, by the ``solved'' modify plugin).

END HELP