call a sub function and return

2009-10-14 Thread Daniel Bruessler
Hi!

I'd like to call a sub function and use the return-function. But is
there a return-function?


#called from vcl_fetch: call vcl_custom_cachingtime;
sub vcl_custom_cachingtimes {

if (req.url ~ ^/abc/* {
set obj.ttl = 10m;
#return (0);
}

if (req.url ~ ^/def/* {
set obj.ttl = 30s;
}

}

thanks in advance and cheers!
Daniel

:: Daniel Bruessler - Emilienstr. 10 - 90489 Nuernberg
___
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc


Re: call a sub function and return

2009-10-14 Thread Poul-Henning Kamp
In message 4ad5d327.9040...@danielbruessler.de, Daniel Bruessler writes:
Hi!

I'd like to call a sub function and use the return-function. But is
there a return-function?

#called from vcl_fetch: call vcl_custom_cachingtime;
sub vcl_custom_cachingtimes {

if (req.url ~ ^/abc/* {
set obj.ttl = 10m;
#return (0);
}

if (req.url ~ ^/def/* {
set obj.ttl = 30s;
}

}

It's not clear from you example what you would use the return for,
but you can simulate it, but putting you return value in a header
instead

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
___
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc


Re: call a sub function and return

2009-10-14 Thread Daniel Bruessler
Hello,

I don't need a return to return a value, I just want to jump out
before the end of the function. I posted a simplified version of my
function, the real one has several if-clauses.

Cheers!
Daniel

 Hi!

 I'd like to call a sub function and use the return-function. But is
 there a return-function?

 #called from vcl_fetch: call vcl_custom_cachingtime;
 sub vcl_custom_cachingtimes {

if (req.url ~ ^/abc/* {
set obj.ttl = 10m;
#return (0);
}

if (req.url ~ ^/def/* {
set obj.ttl = 30s;
}

 }
 
 It's not clear from you example what you would use the return for,
 but you can simulate it, but putting you return value in a header
 instead
 

___
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc


Re: call a sub function and return

2009-10-14 Thread Poul-Henning Kamp
In message 4ad5e2bb.2020...@danielbruessler.de, Daniel Bruessler writes:
Hello,

I don't need a return to return a value, I just want to jump out
before the end of the function. I posted a simplified version of my
function, the real one has several if-clauses.

Use elseif ?

if (foo) {
} elseif (bar) {
} elseif (foomble) {
} else {
}



-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
___
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc