SlideShare a Scribd company logo
XS Fun

Sawyer X ( @PerlSawyer)
XS is...
A glue layer between Perl and C/C++
Sections, macros, functions
Requires knowledge with C, Perl API, XS, typemaps
Written by our very best
Complex, difficult, strenuous, laborious, painful, formidable
(additional words can be found in thesaurus.com )
An impediment to Modern Perl
XS is
misunderstood
No need to be an expert
Basic Perl API is simple
XS is not too difficult
Lots of options
All documented
Except...
... except those that aren't documented
... except that the official tutorial sucks
... except that there's no better (or any other full) tutorial
(at least not one I could find)
I guess I'll write one then!
XS Fun
A tutorial making XS fun
Starts easy, progresses slowly
Split to chapters, each taking a small task
A lot of explanations for beginners
All examples work
Features
Already on Github
A few chapters already covered
Functions (XS, C)
Constructor
Simple methods
Missing
Complex methods
Converting objects with typemaps
Advanced XS
Quick glossary
SV = Scalar Value
Of:
IV = Integer Value (m $ = - 0
y i
3)
UV = Unsigned Integer Value (m $ = 3 0 . .
y u
00.)
NV = Double Value (m $ = 3 . 7 )
y d
071
PV = String Value (m $ = ' e l w r d )
y s
hlo ol'
SV = (another) Scalar Value
AH = Array Value (m @ = q < e l w r d )
y a
whlo ol>
HV = Hash Value (m % = ( h l o = ' o l ' )
y h
el > wrd )
RV = Reference Value (m $ a h e =  h
y hsrf
%)
That's it for now
Examples
XSFun.pm
pcaeXFn
akg Su;
uesrc;
s tit
uewrig;
s anns
ueEpre;
s xotr
ueXLae;
s Sodr
uebs 'xotr;
s ae Epre'
or$ESO
u VRIN
='.0'
001;
or%XOTTG =('l'= [wgtvrin])
u EPR_AS
al > q<e_eso> ;
or@XOTO
u EPR_K =(@ $XOTTG{al}})
{ EPR_AS'l'
;
XLae:la('Su' $ESO )
Sodr:od XFn, VRIN ;
1
;
XSFun.xs
#nld "XENh
icue ETR."
#nld "elh
icue pr."
#nld "SBh
icue XU."
#nld "poth
icue ppr."
MDL =XFn
OUE
Su

PCAE=XFn
AKG
Su

dul
obe
adnmesdul a dul b
d_ubr(obe , obe )
CD:
OE
RTA =a+b
EVL
;
OTU:
UPT
RTA
EVL
S *
V
adnmespr(V*,S *)
d_ubr_elS a V b
CD:
OE
{
cntdul sm=SN()+SN()
os obe u
vVa
vVb;
RTA =nwVvsm;
EVL
eSn(u)
}
OTU:RTA
UPT EVL
XSFun.xs (more)
#nld <hoarn.>
icue crmpith
/ i tecd scin*
* n h oe eto /
cntca *
os hr
gtvrin)
e_eso(
CD:
OE
RTA =crmpitgtvrin)
EVL
hoarn_e_eso(;
OTU:RTA
UPT EVL
#i vrint
n eso.:
ueXFn'al;
s Su :l'
i(gtvrin) '..' 'hoarn vrini 600 )
s e_eso(, 600, crmpit eso s ..' ;
tvrint. o
/eso. . k
Altssscesu.
l et ucsfl
Fls1 Tss1 0wlcoksc (00 ur 00 ss+ 00 cs
ie=, et=,
allc es
.3 s
.1 y
.2 ur
00 cy = 00 CU
.0 ss
.6 P)
Rsl:PS
eut AS
Audio::Chromaprint
Interface to Chromaprint library
Audio/Chromaprint.pm
pcaeAdo:hoarn;
akg ui:Crmpit
uesrc;
s tit
uewrig;
s anns
ueXLae;
s Sodr
or$ESO ='.0'
u VRIN
001;
XLae:la('ui:Crmpit,$ESO )
Sodr:od Ado:hoarn' VRIN ;
1
;
Chromaprint.xs
#nld "XENh
icue ETR."
#nld "elh
icue pr."
#nld "SBh
icue XU."
#nld "poth
icue ppr."
#nld <hoarn.>
icue crmpith
MDL =Ado:hoarn
OUE
ui:Crmpit

PCAE=Ado:hoarn
AKG
ui:Crmpit
Chromaprint.xs
cntca *
os hr
vrinS *ef
eso(V sl)
CD:
OE
RTA =crmpitgtvrin)
EVL
hoarn_e_eso(;
OTU:RTA
UPT EVL
Constructor
#I Pr:
n el
sbnw{bes{,sit}
u e
ls } hf
#o..
r.
sbnw{
u e
m $ls =sit #o $[]
y cas
hf;
r _0
m %ah =(;
y hs
)
m $ef =hs;
y sl
%ah
rtr bes$ef $ls;
eun ls sl, cas
}
#Pr-el
uePr
sbnw{
u e
m $ls =sit #o $[]
y cas
hf;
r _0
m %ah =(;
y hs
)
m $ef =hs;
y sl
%ah
rtr bes$ef $ls;
eun ls sl, cas
}
/ i X *
* n S /
S *
V
nw cntca *ls )
e( os hr cas
CD:
OE
/ Cet ahs *
* rae
ah /
H*hs =nwV)
V ah
eH(;
/ Cet arfrnet tehs *
* rae
eeec o h ah /
S*cntsl =nwVnic (V*hs )
V os ef
eR_on( S )ah ;
/ besit tepoe pcae*
* ls no h rpr akg /
RTA =s_ls(sl,g_tsp(cas 0))
EVL
vbes ef vsahv ls,
;
OTU:RTA
UPT EVL
Conclusions
XS is not that complex
XS can be fun
You can do it!
Thank you
Homework:
github.com/xsawyerx/xs-fun
perldoc perlguts
perldoc perlapi
perldoc perlxs

More Related Content

Similar to XS Fun

Javascript: The Important Bits
Javascript: The Important BitsJavascript: The Important Bits
Javascript: The Important Bits
Zumba Fitness - Technology Team
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
Pavlo Baron
 
C to perl binding
C to perl bindingC to perl binding
C to perl binding
Shmuel Fomberg
 
Java 8 - project lambda
Java 8 - project lambdaJava 8 - project lambda
Java 8 - project lambda
Ivar Østhus
 
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term RewritingCompiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Eelco Visser
 
Ff to-fp
Ff to-fpFf to-fp
Ff to-fp
Andy Petrella
 
Build a custom (micro)framework with ZF2 Components (as building blocks)
Build a custom (micro)framework with ZF2 Components (as building blocks)Build a custom (micro)framework with ZF2 Components (as building blocks)
Build a custom (micro)framework with ZF2 Components (as building blocks)
Corley S.r.l.
 
Building modern web apps with html5, javascript, and java
Building modern web apps with html5, javascript, and javaBuilding modern web apps with html5, javascript, and java
Building modern web apps with html5, javascript, and java
Alexander Gyoshev
 
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term RewritingCS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
Eelco Visser
 
OOP in Rust
OOP in RustOOP in Rust
OOP in Rust
KENZ_gelsoft
 
JavaFX, because you're worth it
JavaFX, because you're worth itJavaFX, because you're worth it
JavaFX, because you're worth it
Thierry Wasylczenko
 
Kotlin Language Features - A Java comparison
Kotlin Language Features - A Java comparisonKotlin Language Features - A Java comparison
Kotlin Language Features - A Java comparison
Ed Austin
 
Beginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at GoogleBeginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at Google
Ari Lerner
 
Elixir cheatsheet
Elixir cheatsheetElixir cheatsheet
Elixir cheatsheet
Héla Ben Khalfallah
 
Compilation of COSMO for GPU using LLVM
Compilation of COSMO for GPU using LLVMCompilation of COSMO for GPU using LLVM
Compilation of COSMO for GPU using LLVM
Linaro
 
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
Johannes Hoppe
 
Scala - brief intro
Scala - brief introScala - brief intro
Scala - brief intro
Razvan Cojocaru
 
What I learned from Seven Languages in Seven Weeks (IPRUG)
What I learned from Seven Languages in Seven Weeks (IPRUG)What I learned from Seven Languages in Seven Weeks (IPRUG)
What I learned from Seven Languages in Seven Weeks (IPRUG)Kerry Buckley
 
Rust_Threads.pdf
Rust_Threads.pdfRust_Threads.pdf
Rust_Threads.pdf
Mario Alexandro Santini
 

Similar to XS Fun (20)

Javascript: The Important Bits
Javascript: The Important BitsJavascript: The Important Bits
Javascript: The Important Bits
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
 
C to perl binding
C to perl bindingC to perl binding
C to perl binding
 
Java 8 - project lambda
Java 8 - project lambdaJava 8 - project lambda
Java 8 - project lambda
 
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term RewritingCompiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
 
Ff to-fp
Ff to-fpFf to-fp
Ff to-fp
 
Build a custom (micro)framework with ZF2 Components (as building blocks)
Build a custom (micro)framework with ZF2 Components (as building blocks)Build a custom (micro)framework with ZF2 Components (as building blocks)
Build a custom (micro)framework with ZF2 Components (as building blocks)
 
Building modern web apps with html5, javascript, and java
Building modern web apps with html5, javascript, and javaBuilding modern web apps with html5, javascript, and java
Building modern web apps with html5, javascript, and java
 
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term RewritingCS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
 
OOP in Rust
OOP in RustOOP in Rust
OOP in Rust
 
JavaFX, because you're worth it
JavaFX, because you're worth itJavaFX, because you're worth it
JavaFX, because you're worth it
 
Kotlin Language Features - A Java comparison
Kotlin Language Features - A Java comparisonKotlin Language Features - A Java comparison
Kotlin Language Features - A Java comparison
 
Beginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at GoogleBeginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at Google
 
Elixir cheatsheet
Elixir cheatsheetElixir cheatsheet
Elixir cheatsheet
 
Compilation of COSMO for GPU using LLVM
Compilation of COSMO for GPU using LLVMCompilation of COSMO for GPU using LLVM
Compilation of COSMO for GPU using LLVM
 
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
 
Scala - brief intro
Scala - brief introScala - brief intro
Scala - brief intro
 
JavaScript pitfalls
JavaScript pitfallsJavaScript pitfalls
JavaScript pitfalls
 
What I learned from Seven Languages in Seven Weeks (IPRUG)
What I learned from Seven Languages in Seven Weeks (IPRUG)What I learned from Seven Languages in Seven Weeks (IPRUG)
What I learned from Seven Languages in Seven Weeks (IPRUG)
 
Rust_Threads.pdf
Rust_Threads.pdfRust_Threads.pdf
Rust_Threads.pdf
 

More from xSawyer

Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)
xSawyer
 
Moose - YAPC::NA 2012
Moose - YAPC::NA 2012Moose - YAPC::NA 2012
Moose - YAPC::NA 2012
xSawyer
 
Our local state, my, my - Understanding Perl variables
Our local state, my, my - Understanding Perl variablesOur local state, my, my - Understanding Perl variables
Our local state, my, my - Understanding Perl variables
xSawyer
 
Your first website in under a minute with Dancer
Your first website in under a minute with DancerYour first website in under a minute with Dancer
Your first website in under a minute with Dancer
xSawyer
 
Moose talk at FOSDEM 2011 (Perl devroom)
Moose talk at FOSDEM 2011 (Perl devroom)Moose talk at FOSDEM 2011 (Perl devroom)
Moose talk at FOSDEM 2011 (Perl devroom)
xSawyer
 
PerlDancer for Perlers (FOSDEM 2011)
PerlDancer for Perlers (FOSDEM 2011)PerlDancer for Perlers (FOSDEM 2011)
PerlDancer for Perlers (FOSDEM 2011)
xSawyer
 
Perl Dancer for Python programmers
Perl Dancer for Python programmersPerl Dancer for Python programmers
Perl Dancer for Python programmers
xSawyer
 
When Perl Met Android (YAPC::EU 2010)
When Perl Met Android (YAPC::EU 2010)When Perl Met Android (YAPC::EU 2010)
When Perl Met Android (YAPC::EU 2010)
xSawyer
 
Perl Dancer on Android (first attempt)
Perl Dancer on Android (first attempt)Perl Dancer on Android (first attempt)
Perl Dancer on Android (first attempt)
xSawyer
 
Source Code Management systems
Source Code Management systemsSource Code Management systems
Source Code Management systems
xSawyer
 
Moose (Perl 5)
Moose (Perl 5)Moose (Perl 5)
Moose (Perl 5)
xSawyer
 
Red Flags in Programming
Red Flags in ProgrammingRed Flags in Programming
Red Flags in Programming
xSawyer
 

More from xSawyer (12)

Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)
 
Moose - YAPC::NA 2012
Moose - YAPC::NA 2012Moose - YAPC::NA 2012
Moose - YAPC::NA 2012
 
Our local state, my, my - Understanding Perl variables
Our local state, my, my - Understanding Perl variablesOur local state, my, my - Understanding Perl variables
Our local state, my, my - Understanding Perl variables
 
Your first website in under a minute with Dancer
Your first website in under a minute with DancerYour first website in under a minute with Dancer
Your first website in under a minute with Dancer
 
Moose talk at FOSDEM 2011 (Perl devroom)
Moose talk at FOSDEM 2011 (Perl devroom)Moose talk at FOSDEM 2011 (Perl devroom)
Moose talk at FOSDEM 2011 (Perl devroom)
 
PerlDancer for Perlers (FOSDEM 2011)
PerlDancer for Perlers (FOSDEM 2011)PerlDancer for Perlers (FOSDEM 2011)
PerlDancer for Perlers (FOSDEM 2011)
 
Perl Dancer for Python programmers
Perl Dancer for Python programmersPerl Dancer for Python programmers
Perl Dancer for Python programmers
 
When Perl Met Android (YAPC::EU 2010)
When Perl Met Android (YAPC::EU 2010)When Perl Met Android (YAPC::EU 2010)
When Perl Met Android (YAPC::EU 2010)
 
Perl Dancer on Android (first attempt)
Perl Dancer on Android (first attempt)Perl Dancer on Android (first attempt)
Perl Dancer on Android (first attempt)
 
Source Code Management systems
Source Code Management systemsSource Code Management systems
Source Code Management systems
 
Moose (Perl 5)
Moose (Perl 5)Moose (Perl 5)
Moose (Perl 5)
 
Red Flags in Programming
Red Flags in ProgrammingRed Flags in Programming
Red Flags in Programming
 

Recently uploaded

Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 

Recently uploaded (20)

Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 

XS Fun

  • 1. XS Fun Sawyer X ( @PerlSawyer)
  • 2. XS is... A glue layer between Perl and C/C++ Sections, macros, functions Requires knowledge with C, Perl API, XS, typemaps Written by our very best Complex, difficult, strenuous, laborious, painful, formidable (additional words can be found in thesaurus.com ) An impediment to Modern Perl
  • 3.
  • 4. XS is misunderstood No need to be an expert Basic Perl API is simple XS is not too difficult Lots of options All documented
  • 5. Except... ... except those that aren't documented ... except that the official tutorial sucks ... except that there's no better (or any other full) tutorial (at least not one I could find)
  • 6. I guess I'll write one then!
  • 7. XS Fun A tutorial making XS fun Starts easy, progresses slowly Split to chapters, each taking a small task A lot of explanations for beginners All examples work
  • 8. Features Already on Github A few chapters already covered Functions (XS, C) Constructor Simple methods
  • 9. Missing Complex methods Converting objects with typemaps Advanced XS
  • 10. Quick glossary SV = Scalar Value Of: IV = Integer Value (m $ = - 0 y i 3) UV = Unsigned Integer Value (m $ = 3 0 . . y u 00.) NV = Double Value (m $ = 3 . 7 ) y d 071 PV = String Value (m $ = ' e l w r d ) y s hlo ol' SV = (another) Scalar Value AH = Array Value (m @ = q < e l w r d ) y a whlo ol> HV = Hash Value (m % = ( h l o = ' o l ' ) y h el > wrd ) RV = Reference Value (m $ a h e = h y hsrf %) That's it for now
  • 12. XSFun.pm pcaeXFn akg Su; uesrc; s tit uewrig; s anns ueEpre; s xotr ueXLae; s Sodr uebs 'xotr; s ae Epre' or$ESO u VRIN ='.0' 001; or%XOTTG =('l'= [wgtvrin]) u EPR_AS al > q<e_eso> ; or@XOTO u EPR_K =(@ $XOTTG{al}}) { EPR_AS'l' ; XLae:la('Su' $ESO ) Sodr:od XFn, VRIN ; 1 ;
  • 13. XSFun.xs #nld "XENh icue ETR." #nld "elh icue pr." #nld "SBh icue XU." #nld "poth icue ppr." MDL =XFn OUE Su PCAE=XFn AKG Su dul obe adnmesdul a dul b d_ubr(obe , obe ) CD: OE RTA =a+b EVL ; OTU: UPT RTA EVL S * V adnmespr(V*,S *) d_ubr_elS a V b CD: OE { cntdul sm=SN()+SN() os obe u vVa vVb; RTA =nwVvsm; EVL eSn(u) } OTU:RTA UPT EVL
  • 14. XSFun.xs (more) #nld <hoarn.> icue crmpith / i tecd scin* * n h oe eto / cntca * os hr gtvrin) e_eso( CD: OE RTA =crmpitgtvrin) EVL hoarn_e_eso(; OTU:RTA UPT EVL #i vrint n eso.: ueXFn'al; s Su :l' i(gtvrin) '..' 'hoarn vrini 600 ) s e_eso(, 600, crmpit eso s ..' ; tvrint. o /eso. . k Altssscesu. l et ucsfl Fls1 Tss1 0wlcoksc (00 ur 00 ss+ 00 cs ie=, et=, allc es .3 s .1 y .2 ur 00 cy = 00 CU .0 ss .6 P) Rsl:PS eut AS
  • 16. Audio/Chromaprint.pm pcaeAdo:hoarn; akg ui:Crmpit uesrc; s tit uewrig; s anns ueXLae; s Sodr or$ESO ='.0' u VRIN 001; XLae:la('ui:Crmpit,$ESO ) Sodr:od Ado:hoarn' VRIN ; 1 ;
  • 17. Chromaprint.xs #nld "XENh icue ETR." #nld "elh icue pr." #nld "SBh icue XU." #nld "poth icue ppr." #nld <hoarn.> icue crmpith MDL =Ado:hoarn OUE ui:Crmpit PCAE=Ado:hoarn AKG ui:Crmpit
  • 18. Chromaprint.xs cntca * os hr vrinS *ef eso(V sl) CD: OE RTA =crmpitgtvrin) EVL hoarn_e_eso(; OTU:RTA UPT EVL
  • 19. Constructor #I Pr: n el sbnw{bes{,sit} u e ls } hf #o.. r. sbnw{ u e m $ls =sit #o $[] y cas hf; r _0 m %ah =(; y hs ) m $ef =hs; y sl %ah rtr bes$ef $ls; eun ls sl, cas }
  • 20. #Pr-el uePr sbnw{ u e m $ls =sit #o $[] y cas hf; r _0 m %ah =(; y hs ) m $ef =hs; y sl %ah rtr bes$ef $ls; eun ls sl, cas } / i X * * n S / S * V nw cntca *ls ) e( os hr cas CD: OE / Cet ahs * * rae ah / H*hs =nwV) V ah eH(; / Cet arfrnet tehs * * rae eeec o h ah / S*cntsl =nwVnic (V*hs ) V os ef eR_on( S )ah ; / besit tepoe pcae* * ls no h rpr akg / RTA =s_ls(sl,g_tsp(cas 0)) EVL vbes ef vsahv ls, ; OTU:RTA UPT EVL
  • 21. Conclusions XS is not that complex XS can be fun You can do it!