(hope this will not produce a duplicate post)

Hi

Don't know if this is trivially answered...

I'm thinking about using org-mode for a collection of code-snippets which are executed by a click on a link

My first idea was to use orgs hyperlink syntax but there I have two problems
1. something like [[shell:code][NAME]] can't be multiline
2. for  perl  code I'll need to escape certain characters when using [[shell:...] or [[elisp:...]

my second idea was org-babel, but AFAI see
1. it seems to execute code-snippets only when exporting
2. the code can't be hidden behind a NAME in a link text

Is there a way to combine both ways?

A hyperlink which executes a codesnippet (which is per default folded away)?

something like?
* [[exec:following snippet][name]
#+begin_src perl
for $i (1..9){
print $i;
}
#+end_src

or


* Title
#+begin_src perl :hyperlink name
for $i (1..9){
print $i;
}
#+end_src


Thanks for any help

-- rolf