Is there away of setting a cookie to timeout if one of the two happens, if the users haven't visit some pages for 15 mins or if they close the bowser.

I am working on creating a control panel in perl.