I think that what you're doing *should* be working, but I guess something isn't quite right, most likely with the way that you're calling js_init_call. I would imagine that the reason you're not seeing any errors in the firebug is that it's not being included for some reason. Are you seeing any references to M.block_foobar in the page source? You shoudl at least see a call to your init function. If you're not, then I would imagine that you're somehow not calling the js_init_call at all.
You don't say what version of Moodle you're developing for, but I'd really recommend reading the latest version of the JS documentation, specifically the YUI Module documentation at http://docs.moodle.org/dev/YUI/Modules. Although it's still a work in progress (sorry - I will get around to finishing them soon) they should give you a point in the right direction to how we're pushing JS in Moodle now.