Skip to content
Browse files

Basic docs

  • Loading branch information...
1 parent 3024d7b commit 1700f9857f9b28841631c7a2aec2e9b893b38680 @perbu perbu committed Feb 17, 2012
Showing with 52 additions and 14 deletions.
  1. +52 −14 man/vmod_example.rst
View
66 man/vmod_example.rst
@@ -6,48 +6,86 @@ vmod_example
Varnish Example Module
----------------------
-:Author: Martin Blix Grydeland
-:Date: 2011-05-26
+:Author: Tollef Fog Heen
+:Date: 2011-09-28
:Version: 1.0
:Manual section: 3
SYNOPSIS
========
-import example;
+import var;
DESCRIPTION
===========
-Example Varnish vmod demonstrating how to write an out-of-tree Varnish vmod.
-
-Implements the traditional Hello World as a vmod.
+Association list in VCL. Can be used to mimick variables.
FUNCTIONS
=========
-hello
------
+set_string
+----------
Prototype
- hello(STRING S)
+ set_string(STRING S, STRING T)
+ set(STRING S, STRING T) - shorthand
+Return value
+ NONE
+Description
+ Sets the variable identified by S to the value T.
+Example
+ var.set_string("bar", "some random string");
+
+get_string
+----------
+
+Prototype
+ get_string(STRING S)
+ get(STRING S) - shorthand
Return value
STRING
Description
- Returns "Hello, " prepended to S
+ Returns the string identified by the supplied string.
+Example
+ set resp.http.foo = var.get_string("bar");
+
+Similar functions
+-----------------
+
+There are similar functions named:
+
+* set_int(STRING, INT)
+* get_int(STRING)
+* set_real(STRING, REAL)
+* get_real(STRING)
+* set_duration(STRING, DURATION)
+* get_duration(STRING)
+
+get and set are shorthand for get_string and set_string.
+
+clear
+-----
+
+Prototype
+ Function VOID clear()
+Returns
+ NONE
+Description
+ Clears out all the variables.
Example
- set resp.http.hello = example.hello("World");
+
HISTORY
=======
-This manual page was released as part of the libvmod-example package,
-demonstrating how to create an out-of-tree Varnish vmod.
+This manual page was written by Per Buer. It might contain
+errors. Patches are welcome.
COPYRIGHT
=========
This document is licensed under the same license as the
libvmod-example project. See LICENSE for details.
-* Copyright (c) 2011 Varnish Software
+* Copyright (c) 2012 Varnish Software

0 comments on commit 1700f98

Please sign in to comment.
Something went wrong with that request. Please try again.