Steve wrote:
> Nick Ing-Simmons wrote:
> > So
> >
> >    PL_curcop->cop_file = __FILE__;
> >    PL_curcop->cop_line = __LINE__;
> >    count = call_method("do_something", G_SCALAR);
> >
> > may do what I think you want.
>
> That got me much closer. Apparently, "cop_file" is not a member of
> "cop" unless one has built with ithreads, I'm not sure what the
> relationship is.  The alternative preprocessor block *does* include a
> "cop_filegv".  I fooled around with it a little, but the results
> weren't very interesting. Assigning "cop_line" had the desired affect
> though.
>
>     fprintf(stderr, "PL_curcop->cop_line: %d\n",
>         PL_curcop->cop_line);
>
>     PL_curcop->cop_line            = __LINE__;
>     sv_setpv(PL_curcop->cop_filegv , __FILE__);

Ah, I found a macro that seems to do what I need:

  CopFILE_set(PL_curcop, __FILE__);

results in:

  doing it... at Eg.c line 142

So, I got the behavior I needed. I do need to consider the
warnings/caveats you mentioned more carefully though.

thanks for all your help,
steve

Reply via email to