[TxMt] tiny improvements for perlmate.rb

Alexander Ross alex.j.ross at gmail.com
Fri Dec 1 23:05:06 UTC 2006


Hans,

I tried the version with `exit(1) if(!$^S);` but it didn't mimic the  
true behavior of die.  Specifically, if die is called inside of eval,  
the $@ value is not set up appropriately.

- Alex

On Dec 1, 2006, at 12:52 AM, Hans-Joerg Bibiko wrote:

>
> On 1 Dec 2006, at 07:49, Alexander Ross wrote:
>
>> James,
>>
>> I tried this out but couldn't get it to work.  $@ wasn't set when  
>> the END block was called.
>
> ? Did you tried out my version with 'exit(1) if(!$^S);'?
> If yes could you please send me an example script which doesn't work.
>
> What do you mean with: "$@ wasn't set when the END block was called"?
> I'm dealing with $^S.
>
>
>>
>> The good news is if we are in an eval block,  
>> exception_handler::die can call Carp::croak[1].  Which "dies of  
>> errors (from perspective of caller)".
>>
>
> Yes, to use Carp is a very good idea. You can call in perlmate.rb
>
>   def args
>     ["-I#{e_sh(Pathname.new(ENV['TM_BUNDLE_SUPPORT']) + "PerlMate")}",
>      "-Mexception_handler", "-MCarp=verbose"]
>   end
>
> and write within the 'sub die' (excep... .pm)
>
> print TM_ERROR_FD "<p>".Carp::longmess()."</p";
>
> which will print something like
>
> at /Users/.../untitled.pl line 8 eval {...} called at /Users/.../ 
> untitled.pl line 6
>
>
> -Hans
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list