[Templates-cvs] cvs commit: Template2/xs Stash.xs

cvs@template-toolkit.org cvs@template-toolkit.org


cvs         06/02/10 10:53:54

  Modified:    xs       Stash.xs
  Log:
  * applied changes based on patch from Tom Insam to further refine the
    way the stash handles failed method calls.  Now we explicitly check
    which package it was reported in.
  
  Revision  Changes    Path
  1.20      +5 -5      Template2/xs/Stash.xs
  
  Index: Stash.xs
  ===================================================================
  RCS file: /template-toolkit/Template2/xs/Stash.xs,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Stash.xs	2006/01/30 16:51:02	1.19
  +++ Stash.xs	2006/02/10 10:53:54	1.20
  @@ -26,7 +26,7 @@
   *
   *---------------------------------------------------------------------
   *
  -* $Id: Stash.xs,v 1.19 2006/01/30 16:51:02 abw Exp $
  +* $Id: Stash.xs,v 1.20 2006/02/10 10:53:54 abw Exp $
   *
   *=====================================================================*/
   
  @@ -89,11 +89,10 @@
   static SV*      scalar_dot_defined(pTHX_ SV*, AV*);
   static SV*      scalar_dot_length(pTHX_ SV*, AV*);
   
  -static char rcsid[]  = "$Id: Stash.xs,v 1.19 2006/01/30 16:51:02 abw Exp $";
  +static char rcsid[]  = "$Id: Stash.xs,v 1.20 2006/02/10 10:53:54 abw Exp $";
   
   #define THROW_SIZE 64
  -static char throw_str[THROW_SIZE+1];
  -static char throw_fmt[] = "Can't locate object method \"%s\"";
  +static char throw_fmt[] = "Can't locate object method \"%s\" via package \"%s\"";
   
   /* dispatch table for XS versions of special "virtual methods",
    * names must be in alphabetical order 		
  @@ -321,6 +320,7 @@
                   SPAGAIN;
                   
                   if (SvTRUE(ERRSV)) {
  +                    char throw_str[THROW_SIZE+1];
                       (void) POPs;		/* remove undef from stack */
                       PUTBACK;
                       result = NULL;
  @@ -344,7 +344,7 @@
                            * into throw_str then snprintf() doesn't add the 
                            * terminating NULL
                            */
  -                        snprintf( throw_str, THROW_SIZE, throw_fmt, item);
  +                        snprintf(throw_str, THROW_SIZE, throw_fmt, item, HvNAME(stash));
                           throw_str[THROW_SIZE] = '\0';
   
                           if (! strstr( SvPV(ERRSV, PL_na), throw_str))