Hey I thought about writing a function that prompts me in certain situations (perl had a bad exit status and the warning it prints starts with “Could not find * in @INC) with maybe re-running the command.
Do you think this is feasable?
I have found that TRAPZERR function. but i don’t even get the name of the last command in there, only the last argument, so one concrete point would be: how can I get the command-name out of it? !!:0 doesn’t work.
Next thing is: i think i might have to do some tricks with preexec to catch the first line of the stderr (if that doesn’t work that’s not a big problem, but it would be interesting anyway), I thought about appending an 2> to a pipe or something but I’m not sure how to get that pipe constructed in the first place. But as stated above, this is a minor issue.
But really, if you think: No this task is impossible! Please tell me so (although I would be interested why).
From the one answer i got until now I think i can narrow down the problem a little:
Is it possible to wrap a MULTIOS redirection around a perl script? ( I thought about some special kind of exec, but came up with none that worked)
Here’s a start.
But maybe you want to do something at the language level like How can I hook into Perl's use/require so I can throw an exception?