Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Basic docs

  • Loading branch information...
commit 1700f9857f9b28841631c7a2aec2e9b893b38680 1 parent 3024d7b
Per Buer perbu authored

Showing 1 changed file with 52 additions and 14 deletions. Show diff stats Hide diff stats

  1. +52 14 man/vmod_example.rst
66 man/vmod_example.rst
Source Rendered
@@ -6,43 +6,81 @@ vmod_example
6 6 Varnish Example Module
7 7 ----------------------
8 8
9   -:Author: Martin Blix Grydeland
10   -:Date: 2011-05-26
  9 +:Author: Tollef Fog Heen
  10 +:Date: 2011-09-28
11 11 :Version: 1.0
12 12 :Manual section: 3
13 13
14 14 SYNOPSIS
15 15 ========
16 16
17   -import example;
  17 +import var;
18 18
19 19 DESCRIPTION
20 20 ===========
21 21
22   -Example Varnish vmod demonstrating how to write an out-of-tree Varnish vmod.
23   -
24   -Implements the traditional Hello World as a vmod.
  22 +Association list in VCL. Can be used to mimick variables.
25 23
26 24 FUNCTIONS
27 25 =========
28 26
29   -hello
30   ------
  27 +set_string
  28 +----------
31 29
32 30 Prototype
33   - hello(STRING S)
  31 + set_string(STRING S, STRING T)
  32 + set(STRING S, STRING T) - shorthand
  33 +Return value
  34 + NONE
  35 +Description
  36 + Sets the variable identified by S to the value T.
  37 +Example
  38 + var.set_string("bar", "some random string");
  39 +
  40 +get_string
  41 +----------
  42 +
  43 +Prototype
  44 + get_string(STRING S)
  45 + get(STRING S) - shorthand
34 46 Return value
35 47 STRING
36 48 Description
37   - Returns "Hello, " prepended to S
  49 + Returns the string identified by the supplied string.
  50 +Example
  51 + set resp.http.foo = var.get_string("bar");
  52 +
  53 +Similar functions
  54 +-----------------
  55 +
  56 +There are similar functions named:
  57 +
  58 +* set_int(STRING, INT)
  59 +* get_int(STRING)
  60 +* set_real(STRING, REAL)
  61 +* get_real(STRING)
  62 +* set_duration(STRING, DURATION)
  63 +* get_duration(STRING)
  64 +
  65 +get and set are shorthand for get_string and set_string.
  66 +
  67 +clear
  68 +-----
  69 +
  70 +Prototype
  71 + Function VOID clear()
  72 +Returns
  73 + NONE
  74 +Description
  75 + Clears out all the variables.
38 76 Example
39   - set resp.http.hello = example.hello("World");
  77 +
40 78
41 79 HISTORY
42 80 =======
43 81
44   -This manual page was released as part of the libvmod-example package,
45   -demonstrating how to create an out-of-tree Varnish vmod.
  82 +This manual page was written by Per Buer. It might contain
  83 +errors. Patches are welcome.
46 84
47 85 COPYRIGHT
48 86 =========
@@ -50,4 +88,4 @@ COPYRIGHT
50 88 This document is licensed under the same license as the
51 89 libvmod-example project. See LICENSE for details.
52 90
53   -* Copyright (c) 2011 Varnish Software
  91 +* Copyright (c) 2012 Varnish Software

0 comments on commit 1700f98

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