(based on a script by Jeff Grills) This is a protect meta-file parser. The meta-data allows for setting different kinds of type setups. The meta-file contains a collection of "blocks", where each block defines a type of setup. The block contents are parsed into protect lines based on what the block header defines as the variables. A block header is defined as: { [ [name]=[value] [; [name]=[value] ... ] ] } value value ... The block header does not need to be all on the same line. Name-Value pairs can be separated by lines or a semi-colon (";"). To read the value entries, the parser knows what variables are set in the block, and the value entries fill in the spaces. It expects the variables in this order: 1. access (list, read, write, super, open, ...) 2. user type (user or group) 3. user/group name 4. path The corresponding variable names are, for purposes of definition in the blocks: 1. access 2. type 3. name 4. path The path does not need to be directly referenced, since the parser will detect the "//" and "-//" starting text and recognize that as a path. You can also specify the IP in the block header (to override the global IP, see below) with the variable name "ip". Within the value line, if you specify one more value than is expected, then that is considered additional text to append to the block's path. If the block does not define a path (either in the line or in the header), then this is an error. You can define a global IP which will be used unless a block declares the IP itself. If you do not define a global IP, the IP used is "*" (any). The global IP may be changed at any point in the meta file. The global IP is defined in block headers using the variable name "globalip". IP addresses can define ranges within each dotted octet. You specify a range within "[" and "]" markers. Currently, the following syntax is supported: [1,2,3] use values 1, 2, and 3. [1-3] use the values between 1 and 3, inclusive. Also, the IP setting can contain multiple IP range settings, separated by a slash ("/"), amperstand ("&"), or pipe ("|"). You can prefix each IP range with "proxy-" to indicate that the permission can only be used from a Proxy. You should run the script like this: perl protect.pl sample > protect.txt (examine protect.txt here to make sure it's correct) p4 protect -i < protect.txt You can, of course, pipe the output directly into p4 protect like so: perl protect.pl sample | p4 protect -i