Show
Ignore:
Timestamp:
01/08/10 10:13:17 (7 months ago)
Author:
ssm
Message:

Document multiple subroutine definitions a bit more

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/varnish-cache/man/vcl.7so

    r4421 r4435  
    283283Subroutines in VCL do not take arguments, nor do they return values. 
    284284.Pp 
    285 If multiple subroutines with the same name are defined, they are 
    286 concatenated in the order in which the appear in the source. 
    287 .Pp 
    288285To call a subroutine, use the 
    289286.Cm call 
     
    468465.Sx EXAMPLES 
    469466section for a listing of the default code. 
     467.Ss Multiple subroutines 
     468If multiple subroutines with the same name are defined, they are 
     469concatenated in the order in which the appear in the source. 
     470.Pp 
     471Example: 
     472.Bd -literal -offset 4n 
     473# in file "main.vcl" 
     474include "backends.vcl"; 
     475include "purge.vcl"; 
     476 
     477# in file "backends.vcl" 
     478sub vcl_recv { 
     479  if (req.http.host ~ "example.com") { 
     480    set req.backend = foo; 
     481  } elsif (req.http.host ~ "example.org") { 
     482    set req.backend = bar; 
     483  } 
     484} 
     485 
     486# in file "purge.vcl" 
     487sub vcl_recv { 
     488  if (client.ip ~ admin_network) { 
     489    if (req.http.Cache-Control ~ "no-cache") { 
     490      purge_url(req.url); 
     491    } 
     492  } 
     493} 
     494.Ed 
     495.Pp 
     496The builtin default subroutines are implicitly appended in this way. 
    470497.Ss Variables 
    471498Although subroutines take no arguments, the necessary information is