Did you have similar moments in your career as a Perl hacker? It would be interesting for us to know “just how did you cope?”. Is it reasonable to turn away such requests or pursue them with vigor?
If you're competent you can expect a lot of "special" requests throughout your career. Pulling one off can be great for visibility, but the results can be a mixed bag for a couple of reasons:
Having survived many "special" requests, here's the approach I've settled on:
Keep Your Boss in the Loop. If you go off your boss's radar, you risk making him/her look bad. It can be really embarrasing to be a manager in a meeting with other managers and your boss, and have it come out that one of your folks is working on something you don't know about. It can make you look like an incompetent. So keep your boss in the loop. A boss who is in the loop may shut down the request, perhaps for reasons you don't have visibility on. That's life.
Let People Know the Tradeoffs. Once you have an idea of the effort to satisfy the special request, let your boss know. I've found that it especially helps to phrase it in terms of "X, Y, and Z" will be delayed for N days while I do this," since it reminds a (possibly busy and distracted) boss that your time isn't free. And let people who're depending on you for X, Y, and Z know. This gives them the opportunity to escalate, rather than blindsiding them. You may be upstream of stuff that's more important than you realize.
Leave a Solution that Doesn't Depend on You. To avoid perpetual maintenance resposibility, work the system to have people designated to take over your solution. Train them if necessary, and make sure you're leaving them with documentation that is adequate for them. Sometimes, sadly, this means not doing something in Perl when nobody else knows Perl. :(
Credit Where Credit is Due. When you do pull a rabbit out of your hat, take care to visibly thank the people who help (e.g., email to their manager(s), cc'ing them.) This keeps you from looking like a prima donna, helps encourage helpfulness, and gives visibility to others who deserve it. And what goes around comes around. I've gotten great support later from people who I've taken extra steps to acknowledge.
Write an "After Action" Report. To help keep corporate memory from forgetting the past, write a short memo explaining what you were asked to do, how you did it, how long it took, what the tradeoffs were (i.e., what projects slipped or took a hit), and what could have been done to avoid the problem in the first place. Try to be neutral and avoid finger pointing. (Think of this as something that you'd like the boss to pull out of their files when review time comes.) Get this report to your boss, and, if politically possible, to their boss. Here's a good place to thank other people who were helpful.