Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A lisp library for easily persisting variables. Ideal for use in scripts where you don't want to hardcode the values, nor deal with configuration files.

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

persistent-variables

1 Overview

Persistent variables can be serialized to and from streams.

They come with niceties, like restarts for failed serialization, late binding (loaded values are cached until the variable is defined), and a test suite.

(defpvar *my-account-password*) ;; Don't give it a value in the source file!

;; At the Repl: 
(setf *my-account-password* "the-password")
(with-open-file (s "/path/to/somewhere/else")
  (p-save s))

;; Later, at startup:
(with-open-file (s "/path/to/somewhere/else")
  (p-load s))

1.1 Features

  • Group variables into 'sets' that are saved and loaded independently.
  • Late binding of variables: load you the saved values before loading your code.
  • Ignores deleted/missing symbols and unbound symbols.
  • Errors for serialization and deserialization problems, with nice restarts.
  • Low line of code count (around 100 lines of code)

2 Installation

2.1 Quick Lisp

Install Quick Lisp and then run:

(ql:quickload 'persistent-variables)

If you have problems, see the support section, and you may want to run the tests.

2.2 Gentoo

As root,

emerge persistent-variables

Once the emerge is finished, the package can be loaded using ASDF:

(asdf:operate 'asdf:load-op :persistent-variables)

If you have problems, see the support section, otherwise you may want to run the tests.

2.3 Ubunto

sudo apt-get install persistent-variables

Once the installation is finished, the package is loadable using ASDF:

(asdf:operate 'asdf:load-op :persistent-variables)

If you have problems, see the support section, otherwise you may want to run the tests.

2.4 Manual Installation

In summary: Untar the .tar package and then symlink the .asd files into a place where ASDF can find them.

  1. Untar the files where you want them to be. On windows download the .zip and unzip it instead, it's the same files.
  2. ASDF could be looking anywhere -- it depends on your setup. Run this in your lisp repl to get a clue as to where ASDF is seeking libraries:

    (mapcan #'funcall asdf:default-source-registries)
  3. Symlink the .asd files to the source directory. If you use windows, these instructions on symlink alternatives apply to you.

Once the files are in place, the package can be loaded with ASDF by:

(asdf:operate 'asdf:load-op :persistent-variables)

If you have problems, see the support section. If you don't have problems you may want to run the tests anyway, because you can.

2.5 Running the Tests

Once the system is loaded, it can be tested with asdf.

(asdf:operate 'asdf:test-op :persistent-variables)

This should display something like the following. There should be zero failures, if you have failures see the support section of this document.

RUNNING PERSISTENT-VARIABLE TESTS...
PERSISTENT-VARIABLE TEST RESULTS: 
     Tests: 8
   Success: 8
  Failures: 0

2.6 Getting Support

You can find support on this libraries website and/or github repository. Or you can email Warren Wilkinson.

3 License

Persister is distributed under the LGPL2 License.

Something went wrong with that request. Please try again.