How to do this, let me count the ways. I do have quite the knack for these types of things. I have no idea what type of door or light your planning on using but one of these should work or at least give you some ideas.
1. Go out to your car and open the door, light should come on. Usually this is done by having a push botton mounted next to the door hinge. They're usually black. Look next to the hinge and you can probably locate it. When the door is closed it depresses the switch and the light turns off. You could do the same thing if your door is thick like a house door.
2. OK open the ftidge, again light should go on. Usally done by having a trip switch that's depressed by the top of the door when it closes. You could use a contact switch from
www.digikey.com or some such place to do the same thing, just connect a battery to the switch and to a relay and a bigger battery and light to the other side of the relay.
3. Security system usually sense doors or windows opening by using a magnetic switch. Look for a cheap home alarm system or replacement parts where ever alarms are sold. Heck just ask around, my place has a bunch from an old system the last tenats had installed. Usually you can just hook them up between a battery and a light, and the light will go on when they're pulled apart.
4. When you walk into a 7-11 or similar store a tone usually sounds to tell the clerk to wake up or hide the porn mag they've been perusing. This is a light and sensor combo and a mirror. Normally the light reflects off the mirror and straight back to the sensor, but when you walk in you block the light. If you mounted the mirror on the door and aimed the light at it, it would trigger when the door started to open and the reflection angle changed.