in reply to Registering DLLs, lots of them
The first note from Thor is incomplete - @ARGV is not auto-globbed on any platform, although unix shells automatically expand wildcards. You'd have to do something like:
to get it to work on Windows. I'm making a wild assumption you don't care about Linux or Unix ;-). Then you'd call your script like perl rereg.pl *.dll.foreach my $dll (map { glob $_ } @ARGV) { register($dll); }
The next part is what you want to do with it. There may be a way to find out if a DLL is already registered properly - whether you use the Win32::* functions/modules, or if regsvr32 has a query mode. Then you can skip that DLL and go on to the next. Ideally you'd use the Win32::* functions/modules, but you could use regsvr32 querying, if it exists, as a quick fix for the short term. Or you could blindly call regsvr32 on each DLL - I would recommend logging the $? from doing so, though - it's incredibly useful information which may cause you to figure out a way later to detect when a second registration has failed, and reattempt registering it immediately (left as an excersise for a future PM question ;->).
As for "I'm pretty sure this is a pretty stupid way of doing this" - I'm unconvinced. Stupid problem, maybe. Stupid solution, no.
|
|---|