random background

I am trying to add something to my .fvwm2rc that would make every PAGE on every DESKTOP have a random image (a PNG image from /home//.fvwm/background/) set as the background. Currently though, I am having trouble just trying to simply set a random image as the background for ALL OF THE DESKTOPS (I am captilizing because I would like it if somebody told me how to clarify). I have found a perl script that does this, and I have been fooling around with it (although I dont know any perl) and this is what I have:

Module FvwmPerl --export PerlEval

# find all background pixmaps for a later use
PerlEval $a = $ENV{HOME} . "/.fvwm/background"; \
  opendir DIR, $a; @b = grep { /PNG$/ } readdir(DIR); closedir DIR

# choose a random background to load on start-up
PerlEval cmd("AddToFunc \
  InitFunction + I Exec exec fvwm-root $a/" . $b[int(random(@b))])

(original source:
It seems, like it should work, but it doesnt for some reason. I was also hoping though that somebody might be able to tell me what code I should put it in so that there is a random image for each PAGE on each DESK. Thanks!

for random wallpaper of all the desktops, I suggest you this:

xs4all.nl/~hanb/software/fbs … setbg.html

It can set random wallpapers by its bultin functions, and support more
file formats, besides png.

for the other, I think you need FvwmBacker, but it’s really cpu exausting…