I have a Perl script that creates files, and I want to write into their resource forks, in order to specify the default application they should be opened with (I can't just change it using get information in Finder, it keeps reverting).
I could find out about Apple's arcane resource fork stuff, but for my purposes I'm happy to read the data from an existing resource fork that opens with the right application, and hard-code it into my script. The trouble is, I'm too new to Perl to know how to read the hex numbers from the file, copy and paste it into my script, and have it written correctly as hex into my new .rsrc
files.
I want to do something like:
my $theHex="DEADBEEF" #<---this is where I would paste the hex from the existing rsrc file
open (OUT, ">$filename/rsrc"); #<--this is the resource fork for file $filename
printf OUT "%x" $theHex #<----I'm not sure that this formatting is right
Edit: Yes I know, resource forks are deprecated. Please tell that to Apple so they can stop using them in their OS to determine things like what application opens a particular file. Sheesh!