Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Why does the array not reset each time I call the function?

by tuxy94 (Initiate)
on Apr 02, 2008 at 09:55 UTC ( [id://677926]=note: print w/replies, xml ) Need Help??


in reply to Re: Why does the array not reset each time I call the function?
in thread Why does the array not reset each time I call the function?

The data needed to run this are a shadow file, a passwd file and a group file from a Linux system. This script is supposed to parse the files, retrieve some specific groups, users from those groups and of course the password and then regenerate the new file in order to have them used in another linux server.

Replies are listed 'Best First'.
Re^3: Why does the array not reset each time I call the function?
by radiantmatrix (Parson) on Apr 02, 2008 at 14:47 UTC

    Having just implemented something that does exactly what you describe, I have one recommendation: use Text::CSV_XS. Treat the passwd, group, and shadow files as CSVs separated by ':'. Build data structures, compare then, then use the same module to output the new files.

    You will save yourself a lot of hassle.

    Also, don't use DATA as the name of a file handle, it's special. Also, always use strict and warnings. You'll save yourself loads of debugging time.

    <radiant.matrix>
    Ramblings and references
    The Code that can be seen is not the true Code
    I haven't found a problem yet that can't be solved by a well-placed trebuchet

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-03-29 10:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found