The person you talked to was obviously an idiot. You don't give out code owned by a previous employer for any reason.

OTOH, it's not unreasonable to mandate that applicants have some specific free software contribution they can point to as an example. This shows several things. First, it shows that the person is geek enough to enjoy coding on their free time. Second, it gives you an idea of what they think is their best work, since you generally have more time perfect your free software code than code you are paid to write (unless of course the two overlap).

As a semi-aside, one of the best things you can do for your career is make noticeable contributions to free software projects and/or start your own. This is basically free publicity to insiders at hundreds (thousands?) of companies.

My current full time job came about because one of the company's other employees, Brian Ingerson of Kwiki fame, knew about my various Perl modules and thought I'd be a good fit as a new hire based on that, even though he and I hadn't worked together previously.

Much of the work I've gotten in the past few years has come to me at least in part because of my free software contributions. I've obviously spent a pretty large amount of my own time on this stuff, but it's definitely made my career path much, much easier. Since I like to code but I hate to look for work, this has worked out well for me.

Given that employment is not a sure thing, it can't hurt to start building up a free software profile right now. If you're not sure where to start, there's things like the Phalanx Project, or the Linux Kernel Janitor Project. These can be nice ways to get a start. Even better, see if you can get your current employer to let you release some code, or to work on improving existing CPAN modules you use in house.

OTOH, it's not unreasonable to mandate that applicants have some specific free software contribution they can point to as an example. This shows several things. First, it shows that the person is geek enough to enjoy coding on their free time.

Actually, as an architect that is part of the interviewing team, I've found that the best programmers we've hired are people that do have outside interests. When they go to program, they bring the wealth of other experiences with them.

Not only that, but those who spend the majority of their time coding seem to lose social skills which make them a viable part of the team atmosphere we engender at work.

Doing free software work in one's free time is not the same as not having other interests. Besides coding, I do animal rights activism, read a lot, play go, watch films, hang out with friends, etc. So yes, if the only thing the person ever does is code, that might be problematic. OTOH, if coding is purely a day job, and not something they enjoy enough to do in their free time as well, they probably aren't going to be as good a coder as the person who pursues it out of sheer interest.