Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Re: DB_File, not saving

by jsprat (Curate)
on Jul 17, 2003 at 19:20 UTC ( #275349=note: print w/ replies, xml ) Need Help??


in reply to Re: DB_File, not saving
in thread DB_File, not saving

Commenting out unlink "chat"; would probably help too...

Update: I meant in addition to sauoq's comment, not instead of.


Comment on Re: Re: DB_File, not saving
Download Code
Re: Re: Re: DB_File, not saving
by sauoq (Abbot) on Jul 17, 2003 at 19:34 UTC

    He's just doing that once at the beginning of the script to remove his old file before writing a new one. That shouldn't matter (as long as he wants to start fresh each time the script runs.)

    Update: jsprat is correct. The file should not be unlinked. (It is obvious, on closer inspection, that the script is useless without it.)

    -sauoq
    "My two cents aren't worth a dime.";
    
      I don't think he wants to start fresh each time. He wants to save the data so he can display more than one line.

      It looks like a CGI script that wants to accept a line of chat, then display the previous 10 lines. What it actually does is this:

      1. deletes all previous messages
      2. creates the db file, ties %chat
      3. unties %chat, thereby not storing any messages
      4. accepts a new message
      5. displays the last 10 messages (which were just deleted!)

      Not only is the %chat untied from the the DB_File when it's tied to TIE::IxHash (as you pointed out), the script is deleting the DB_File every time it is hit.

        You are right; he shouldn't delete it.

        -sauoq
        "My two cents aren't worth a dime.";
        
        You're right. This is a chat script (much like the chatterbox). It takes the latest 10 messages and prints to screen and it stores the rest for logs later on. I removed the unlink (no idea what it does/did but it was in the example I used) and the problem is still here (you probably knew that). I must be able to tie %chat to both objects otherwise it's useless, I'll look into using it as an array.

        Thank you for your help!

        "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

        sulfericacid

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://275349]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-09-20 20:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (161 votes), past polls