
Robert Acock
- Website: lnation.org
Recent Actions
-
Commented on Learning XS - Closures
Is this the correct way to free the HV? ``` void euthanase(kitty) CV * kitty CODE: SvREFCNT_dec(CvXSUBANY(kitty).any_ptr); ```...
-
Commented on Learning XS - Closures
I have only been learning C/XS for a short period of time, I have touched typemaps but would need to 'experiment' with them more before I could write a post. My current understanding to what they allow you todo is...
-
Posted Learning XS - Closures to Robert Acock
Over the past year, I’ve been self-studying XS and have now decided to share my learning journey through a series of blog posts. This tenth post introduces you to what I call closures in XS.
-
Posted Learning XS - C data types to Robert Acock
Over the past year, I’ve been self-studying XS and have now decided to share my learning journey through a series of blog posts. This ninth post introduces you to C data types and how to expose them in…
-
Posted Learning XS - Regular Expressions to Robert Acock
Over the past year, I’ve been self-studying XS and have now decided to share my learning journey through a series of blog posts. This eighth post introduces you to Perl regular expressions in…
-
Posted Learning XS - Exporting to Robert Acock
Over the past year, I’ve been self-studying XS and have now decided to share my learning journey through a series of blog posts. This seventh post introduces you to exporting XSUBS.
-
Posted Learning XS - Invocation to Robert Acock
Over the past year, I’ve been self-studying XS and have now decided to share my learning journey through a series of blog posts. This sixth post introduces you to subroutine invocation in…
-
Posted Learning XS - Prototyping to Robert Acock
Over the past year, I’ve been self-studying XS and have now decided to share my learning journey through a series of blog posts. This fifth post introduces you to subroutine(method/function) prototypes in…
-
Posted Learning XS - Overloading to Robert Acock
Over the past year, I’ve been self-studying XS and have now decided to share my learning journey through a series of blog posts. This fourth post introduces you to overloading operators in…
-
Posted Learning XS - List context to Robert Acock
Over the past year, I’ve been self-studying XS and have now decided to share my learning journey through a series of blog posts. This third post introduces you to list context in XS.
-
Posted Learning XS - What is in my variable to Robert Acock
Over the past year, I’ve been self-studying XS and have now decided to share my learning journey through a series of blog posts. This second post introduces the fundamentals of type checking variables in…
-
Posted Learning XS - How to create an object to Robert Acock
Over the past year, I’ve been self-studying XS and have now decided to share my learning journey through a series of blog posts. This first post introduces the fundamentals of creating an perl object from XS.
-
Commented on Faster Readonly variables with Const::XS
My benchmark measures both instantiation and access. If I were to benchmark only access, Const::Fast and Const::XS would show very similar performance. I include both in the benchmark because it's relevant in scripting scenarios, where the process isn't long-running, and...
-
Commented on Faster Readonly variables with Const::XS
Thanks updated the link and no such limitations with Const::XS they are just 'variables' so concatenating like "$STRING $HASH{ONE} $ARRAY[0]" is fine....
-
Posted Faster Readonly variables with Const::XS to Robert Acock
So, what exactly is a Readonly variable in Perl? A readonly variable is one that, once assigned a value, cannot be changed. Any attempt to modify it will trigger a runtime error. This mechanism enforces immutability, ensuring that critical values remain untouched and are protected from accidental…
-
Commented on I want to display NA instead of UNKKONW in CPAN Testers
Then decides to look at your link - Argument "8.0_beta" isn't numeric in numeric lt (...
-
Commented on I want to display NA instead of UNKKONW in CPAN Testers
Die inside your Makefile, doesn't have to be in a BEGIN block. For example if I wanted a module only to work for macOS then: die "OS unsupported" unless $^O eq 'darwin';...
-
Commented on C::Blocks Advent Day 1
David Mertens++....
-
Commented on I create "Perl Tweet Timeline News" Web site
Takes back previous comment, improvements....
-
Commented on I create "Perl Tweet Timeline News" Web site
Just a thought, because I don't think the content returned via twitter is actually that useful. What you could do... is search for the links and generate some content from them title, description ect. Majority of modern web sites(blogs) support...
-
Commented on Social Media Meta Tags
I should add thank you to those that have emailed me some feedback, It's appreciated and I'll take it forward in my next release....
-
Commented on Social Media Meta Tags
Hey Ron, I submitted a post to prepan back on the 12/12/2015 you can find it here... http://prepan.org/module/nY8EjAnEF8c like many other posts on prepan it has no comments and no feedback. I apologise for my lack of proof reading....
-
Commented on Social Media Meta Tags
Hey Dudes, I know you're all really busy and probably care very little about this module. But I'm a junior developer who really wants to learn and improve. What I was hoping from this post was at least some critical...
-
Posted Social Media Meta Tags to Robert Acock
Social Media Meta Tags
Social media meta tags are HTML tags that allow you to make the most out of the content you share from a URL. You can determine what information is displayed from a post in Twitter, Facebook, LinkedIn, Pinterest and beyond. It gives developers control over the expe…

Comment Threads
-
Sebastian Schleussner commented on
Faster Readonly variables with Const::XS
Line 38ff:
"Const::XS::PP::const" should be "Const::PP::const". -
Tony Cook commented on
Learning XS - Closures
That should work, you might want to set any_ptr to NULL.
An option to automatically manage the lifetime of your
self
object would be to store it in MAGIC. See https://metacpan.org/release/PEVANS/Future-XS-0.13/source/hax/cv_set_anysv_refcounted.c.inc for an example for code that uses CvREFCOUNTED_ANYSV_on() when available and magic when it isn't (thanks toddr who brought this up in IRC) -
Leon Timmermans commented on
Learning XS - Closures
I agree with Tony, using typemaps can make handling C datatypes much easier.
-
bulk88 commented on
Learning XS - Closures
There are SV*/CV* memory and refcnt leaks in this code, see https://www.nntp.perl.org/group/perl.perl5.porters/2025/06/msg270057.html
"XSANY" macro, which is better written as "CvXSUBANY(kitty).any_ptr" or "CvXSUBANY(kitty)" is the correct way to attach and store random private data to a CV*, aslong as the private data's type is <= sizeof(void*). A example of what can not be stuffed inside CvXSUBANY(), is a type NV or a type double, since those are min 8/10/12/16 max bytes long dependi… -
bulk88 commented on
Learning XS - Closures
Nitpicks:
SV * name = *hv_fetch(self, "name", 4, 0);
never hand count a string with your finger or cursor unless there is no other tool in the world available
Perl API has this call for "" string literals that auto calcs the length for you of your string literal
hv_fetchs(stash, "_tie_it", 0);
Next:
RETVAL = newSVpvf("%s curls up and waits for attention", SvPV(name, retlen));
Use type "const char *" and "SvPV_const()" macro where-ever po…

About blogs.perl.org
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.