Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: get new item name

by rob_au (Abbot)
on Jan 19, 2002 at 03:31 UTC ( [id://139999]=note: print w/replies, xml ) Need Help??


in reply to get new item name

Your code still exhibits a race condition between the point of generation of the 'unique' name and the later use of it in the code - There is no subsequent check for existence of uniqueness at the point of usage.

While your code certainly has merit, it would be better written within a while loop, actually creating the destination object rather than simply determing the object name, in the event of the available 'unique' name. Alternatively, there still exists the possibility that a similarly named object is created between the time of your determination of the available unique name and the point of object creation. I dicussed this point in a recent meditation I posted with regard to the usage of temporary files within Perl here.

 

perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-16 22:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found