On 29/03/2003 06:53:45 perl-win32-users-admin wrote:

>On 3/27/2003 5:24 AM, Stuart Arnold wrote:
>> I want to be able to somehow reformat the error/warn messages that perl
>> dumps out so that I can format it (override it).
[snip]
>
>perldoc perlvar
>
>"Certain internal hooks can be also set using the %SIG hash. The routine
>indicated by $SIG{__WARN__} is called when a warning message is about to
>be printed. The warning message is passed as the first argument."
>

Note that the parameter to that function already has the
"at myfile.pl line xx" at the end. You probably need to rearrange it
before printing.


SVC.pm:

----->8-----
package SVC;

BEGIN{

$SIG{__WARN__} = sub {
  $_ = shift;
  s!(.*)at (.*?) line (\d+)!$2($3) : $1!;
  warn $_;
};

}

1;
----->8-----


Then run

perl -MSVC -w yourscript.pl


--
Csaba Ráduly, Software Engineer, Sophos Anti-Virus
Email: [EMAIL PROTECTED], Tel: 01235 559933, Web: www.sophos.com
Add live virus info to your website: http://www.sophos.com/link/vfeed


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to