tphyahoo has asked for the wisdom of the Perl Monks concerning the following question:

Note: I answer my own question at the bottom of this post, so maybe this shouldn't be on SOPW. If posting this kind of thing is annoying, sorry... I would have deleted my message except there's no function for doing this that I can see :)

Fletch, thanks for the tip (below)!

I have only been programming perl 6 months or so and am just getting my sea legs, so maybe I shouldn't be asking an xs question. But I'm just curious, and I'm not sure what I should be feeding into the search engines to get an answer to this, and perhaps there are others like me... so here goes. I was browsing cpan

http://search.cpan.org/src/JDUNCAN/Regexp-Copy-0.06/lib/Regexp/Copy.pm
for module "regexp::copy" where we have
package Regexp::Copy; use strict; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); use Regexp::Storable; require Carp; require Exporter; require DynaLoader; require AutoLoader; @ISA = qw(Exporter DynaLoader); @EXPORT = qw( ); @EXPORT_OK = qw(re_copy); $VERSION = '0.06'; bootstrap Regexp::Copy $VERSION; sub re_copy { for (@_) { if (uc(ref($_)) eq ref($_) && !$_->isa('Regexp')) { Carp::croak "parameters to re_copy must be blessed and isa(Regex +p)"; } } re_copy_xs(@_); } 1; __END__
My question concerns the line
re_copy_xs(@_);
What is this? From my (admittedly pretty nebulous) understanding of xs, I am guessing that this function is somehow autogenerated... maybe autogenerated in c. Is that correct? Or barking up the wrong tree? Where can I learn more about modules that end in
some_function_xs
(If this is something one sees commonly that is!) Thanks for your wisdom! thomas.

UPDATE: On second thought, I just noticed we have

use Regexp::Storable;
I'm guessing the answer to my question lies in this module, and not in some cryptic xs thing. Never mind!

UPDATE 2: Anyway, for what it's worth, whatever re_copy_xs is doing, the source is here:

http://search.cpan.org/src/JDUNCAN/Regexp-Copy-0.06/Copy.xs

I will now stop mucking with things I don't understand :)

Replies are listed 'Best First'.
Re: xs question - is function_xs autogeneraged?
by Fletch (Bishop) on Dec 03, 2004 at 19:04 UTC

    Erm, if you look in Copy.xs from that module you'll see the definition. Read perldoc perlxstut for a quick introduction to XS that (may :) get you less confuzzled.

Re: xs question - is function_xs autogeneraged?
by Old_Gray_Bear (Bishop) on Dec 03, 2004 at 20:17 UTC
    Please don't delete the question, even if you figured out the answer.

    There will be another Seeker in the future who may be able to use this as a guide post. Your experiences now may give Them a hint at other things to look into. (And don't worry about asking a 'stupid question'. The only stupid questions are the ones you don't ask. We are All Students Here.)

    And, you are not the only one here who learns by 'mucking with things', we all learn in different ways. I find that the process of trying to explain my confusion (either in an email/memo or talking it out to a co-worker over a cup of tea) often clarifies the Thing I Am Stuck On. Consider the Monastery as Your Father Confessor....

    ----
    I Go Back to Sleep, Now.

    OGB