Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Execute code after session expire

by rjit17@gmail.com (Initiate)
on Apr 24, 2014 at 05:08 UTC ( [id://1083518]=perlquestion: print w/replies, xml ) Need Help??

rjit17@gmail.com has asked for the wisdom of the Perl Monks concerning the following question:

Is it possible to run server side code, just after session will expire?

Replies are listed 'Best First'.
Re: Execute code after session expire
by roboticus (Chancellor) on Apr 24, 2014 at 05:29 UTC

    rjit17@gmail.com--

    That depends on the situation. So ... what's the situation? Care to give any clues about your environment and what you're trying to do?

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      My situation is like : I made one web site where user can upload text file. I want to delete that text file from my server when session will expire for that particular user. I also want to set the time for 10 min for session expire.

        rjlt17@gmail.com:

        OK, then when you create your text files, log them into a database along with their expiration date. Then have a cron job wake up every five minutes, and run a script to delete all files whose expiration date has passed.

        ...roboticus

        When your only tool is a hammer, all problems look like your thumb.

        so this "session expire" is some kind of jar of pickles?
Re: Execute code after session expire
by CountZero (Bishop) on Apr 24, 2014 at 05:57 UTC
    There has to be *some* code *somewhere* that makes your session expire. Add your "post expiry" code to the end of that code.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
      hi CountZero, Their is a simple code for session expire called expire(); But I am not able to do my job using these method.Can u give me one example ,how to do it.
        "That depends on the situation. So ... what's the situation?" (robotics)
        "Some kind of jar of pickles?" (Anonymous Monk)
        "There has to be *some* code *somewhere*" (CountZero)
        "Their is a simple code for session expire called expire()" (rjit17@gmail.com AKA you)

        But where is your "simple code"?

        N.B.: The monk with direct access to the Crystal_ball is away on vacation.

        Best regards, Karl

        «The Crux of the Biscuit is the Apostrophe»

        The code in expire could be anything. Without knowing what it is, I cannot help you. Some information why you cannot use that code would be helpful too.

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

        My blog: Imperial Deltronics
Re: Execute code after session expire
by davido (Cardinal) on Apr 24, 2014 at 15:51 UTC

    This dialogue seems kind of like the following:

    Q: "I would like to enter the house."

    A: "Open the front door and walk in."

    Q: "I cannot use the front door."

    A: "Why not?"

    Q: "There is a front door but I can't use it."

    A: "Why can't you use it?"

    Q: "There's a door at the front, and it's called front door, but I can't use it."

    A: "Can you show a floorplan, and a picture of the front door?"

    Q: "I want to enter the house."

    After reading this dialogue, do you (the OP) have any idea why our character can't enter through the front door? Do you have a mental picture of what the door looks like? Do you know anything about its hardware? (lock, knob, etc) At the end of the dialogue you know only that there's a door, that the person wants to enter, and that there is some inexplicable reason why he believes he can't use the door. We don't know if he just needs a key, if the door is broken, if he's not invited and thus needs to find a partially open window in the basement to sneak through... maybe there's a giant piece of furniture inside the front door blocking its use. Maybe the front door is not to be used, and there's a service entrance.

    But we don't know. And we don't know what obstacles YOU are facing either, which means we are unable to help you until you start explaining yourself.

    Show some minimal amount of real code that demonstrates your session handling as it currently exists. When someone asks "why", don't say "doesn't work" or "can't", explain your situation. Whatever problem you're facing, we probably can find someone to solve it, but we don't know enough about the problem yet.


    Dave

Re: Execute code after session expire
by DrHyde (Prior) on Apr 24, 2014 at 10:13 UTC

    If there was no computer involved, and just people communicating with each other with hand-written bits of paper, how would you implement it?

    ... pause ...

    OK, now port that to perl.

Re: Execute code after session expire
by Bloodnok (Vicar) on Apr 24, 2014 at 09:28 UTC
    Do you mean something along the lines of the shell .bash_logout script a la this?

    A user level that continues to overstate my experience :-))
        Yep, I appreciate that, I was merely trying to ascertain whether, or not, the .logout functionality is the sorta thing the OP is after.

        A user level that continues to overstate my experience :-))
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1083518]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-19 16:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found