This document summarizes a talk given at YAPC Tokyo 2010 about calling C code from Perl using various techniques. It discusses Ctypes, a module for directly calling C functions without XS; Libperl++, a C++ library for embedding and extending Perl; and XS++, which allows writing C++ classes that integrate seamlessly with Perl using a special syntax.
Asynchronous PHP and Real-time MessagingSteve Rhoades
With every major browser supporting WebSockets, HTML 5 has changed how we handle client to server communications. The high demand for real time client and server messaging has developers flocking away from PHP to languages such as Node.js. In this session we'll explore the libraries and extensions that make Asynchronous PHP possible and analyze the performance differences with Node.js. In addition we'll identify use cases and walk through examples of how Asynchronous PHP can handle everything from WebSockets and Message Queues to MySQL.
From ReactPHP to Facebook Hack's Async implementation and many more, asynchronous programming has been a 'hot' topic lately. But how well does async programming support work in PHP and what can you actually use it for in your projects ? Let's look at some real-world use cases and how they leverage the power of async to do things you didn't know PHP could do.
Asynchronous PHP and Real-time MessagingSteve Rhoades
With every major browser supporting WebSockets, HTML 5 has changed how we handle client to server communications. The high demand for real time client and server messaging has developers flocking away from PHP to languages such as Node.js. In this session we'll explore the libraries and extensions that make Asynchronous PHP possible and analyze the performance differences with Node.js. In addition we'll identify use cases and walk through examples of how Asynchronous PHP can handle everything from WebSockets and Message Queues to MySQL.
From ReactPHP to Facebook Hack's Async implementation and many more, asynchronous programming has been a 'hot' topic lately. But how well does async programming support work in PHP and what can you actually use it for in your projects ? Let's look at some real-world use cases and how they leverage the power of async to do things you didn't know PHP could do.
Event looped, asynchronous programming is possible with PHP! Streams, promises, async IO, web sockets -- you can do it all, with React PHP. Presented by Luke Kysow.
Slowly but surely, promises have spread throughout the JavaScript ecosystem, standardized by ES 2015 and embraced by the web platform. But the world of asynchronous programming contains more patterns than the simple single-valued async function call that promises represent. What about things like streams, observables, async iterators—or even just cancelable promises? How do they fit, both in the conceptual landscape and in your day-to-day programming?
For the last year, I've been working to bring an implementation of I/O streams to the browser. Meanwhile, designs for a cancelable promise type (sometimes called "tasks") are starting to form, driven by the needs of web platform APIs. And TC39 has several proposals floating around for more general asynchronous iteration. We'll learn about these efforts and more, as I guide you through the frontiers of popular libraries, language design, and web standards.
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...Zyxware Technologies
A workshop on "An introduction to BASH shell scripting". Conducted at CSI Students Convention at TKM College of Engineering, Kollam, Kerala on 15th September, 2012
http://www.zyxware.com/articles/3080/zyxware-conducts-workshop-on-bash-scripting-at-tkm-college-of-engineering-kollam
Domains were added to Node.js in 0.8, but their use and workings have been a relative mystery. In short, domains are a structured way of reacting to uncaught exceptions; for example, when creating an HTTP server, you can use domains to send 500 errors when exceptions occur instead of crashing your server. This talk will go over what domains are, how to use them, and some of the subtleties behind how they work.
PyCon lightning talk on my Toro module for Tornadoemptysquare
With Tornado’s gen module, you can turn Python generators into full-featured coroutines, but coordination among these coroutines is difficult without mutexes, semaphores, and queues.
Toro provides to Tornado coroutines a set of locking primitives and queues analogous to those that Gevent provides to Greenlets, or that the standard library provides to threads.
Using Mikko Koppanen's PHP ZMQ extension we will look at how you can easily distribute work to background processes, provide flexible service brokering for your next service oriented architecture, and manage caches efficiently and easily with just PHP and the ZeroMQ libraries. Whether the problem is asynchronous communication, message distribution, process management or just about anything, ZeroMQ can help you build an architecture that is more resilient, more scalable and more flexible, without introducing unnecessary overhead or requiring a heavyweight queue manager node.
Event looped, asynchronous programming is possible with PHP! Streams, promises, async IO, web sockets -- you can do it all, with React PHP. Presented by Luke Kysow.
Slowly but surely, promises have spread throughout the JavaScript ecosystem, standardized by ES 2015 and embraced by the web platform. But the world of asynchronous programming contains more patterns than the simple single-valued async function call that promises represent. What about things like streams, observables, async iterators—or even just cancelable promises? How do they fit, both in the conceptual landscape and in your day-to-day programming?
For the last year, I've been working to bring an implementation of I/O streams to the browser. Meanwhile, designs for a cancelable promise type (sometimes called "tasks") are starting to form, driven by the needs of web platform APIs. And TC39 has several proposals floating around for more general asynchronous iteration. We'll learn about these efforts and more, as I guide you through the frontiers of popular libraries, language design, and web standards.
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...Zyxware Technologies
A workshop on "An introduction to BASH shell scripting". Conducted at CSI Students Convention at TKM College of Engineering, Kollam, Kerala on 15th September, 2012
http://www.zyxware.com/articles/3080/zyxware-conducts-workshop-on-bash-scripting-at-tkm-college-of-engineering-kollam
Domains were added to Node.js in 0.8, but their use and workings have been a relative mystery. In short, domains are a structured way of reacting to uncaught exceptions; for example, when creating an HTTP server, you can use domains to send 500 errors when exceptions occur instead of crashing your server. This talk will go over what domains are, how to use them, and some of the subtleties behind how they work.
PyCon lightning talk on my Toro module for Tornadoemptysquare
With Tornado’s gen module, you can turn Python generators into full-featured coroutines, but coordination among these coroutines is difficult without mutexes, semaphores, and queues.
Toro provides to Tornado coroutines a set of locking primitives and queues analogous to those that Gevent provides to Greenlets, or that the standard library provides to threads.
Using Mikko Koppanen's PHP ZMQ extension we will look at how you can easily distribute work to background processes, provide flexible service brokering for your next service oriented architecture, and manage caches efficiently and easily with just PHP and the ZeroMQ libraries. Whether the problem is asynchronous communication, message distribution, process management or just about anything, ZeroMQ can help you build an architecture that is more resilient, more scalable and more flexible, without introducing unnecessary overhead or requiring a heavyweight queue manager node.
Unix has always had a philosophy of composable tools, where one tool outputs to the next in a pipeline.
But the technique of piping a *textual* stream of data, and having to extract data out of it is looking a bit long in the tooth. Microsoft (not historically an innovator in its shell environment :-) has stolen a march with its Powershell.
Can we do better in Perl? With composable streams of objects? Written in a modern OO framework (Moose)?
You bet we can!
This talk was given at the London Perl Workshop 2009, http://conferences.yapceurope.org/lpw2009/talk/2456
Usually, a current account is opened for commercial or business purposes and is a form of demand deposit from which the holder can withdraw money any number of times or upto an agreed amount. Opening a current account is a risky proposition for the banks. For instance, if the bank makes an overdraft by mistake, then the bank has to bear the loss if it is unpaid. There is no restriction to the amount deposited in the current account. This form of account is liable for transaction tax especially if the individual or a Hindu Undivided Family (HUF) withdraws Rs 50,000 in cash on any single day. Similar tax is also levied on a corporate entity if the withdrawal is Rs 1,00,000 and above. Although no interest or countervailing interest is payable on a current account however banks are entitled to pay interest to the account of a regional rural bank or the account of a deceased individual. As far as nomination is concerned a single depositor can make nominations while nominations cannot be made by incorporated entities or other trade bodies. With respect to current accounts there are several prohibitions placed on the banks. For example, the bank cannot lure the depositors by announcing prizes or attractive lottery schemes. Similarly, banks also cannot pay brokerage or gifts to agents for deposits placed at the bank.
Savings account is focused on individuals and puts a limit to the amount of money the depositor can withdraw from the same. Except specified institutions a saving account cannot be opened in the name of a government department. The procedure for opening a saving account is similar to the procedure followed for opening any other type of bank account. In times of calamities however RBI has permitted banks to allow an individual to open a saving account either against electricity bill or any other document of identity or through an introduction from another account holder. When it comes to depositing money in a saving account, a holder cannot deposit third party cheques into the saving account. There is no transaction tax to be paid in case of a saving account. Interest paid to saving account (3.5%) is calculated by taking into account the lowest balance on the 10th and end of the month. An additional 1% interest is payable to retired employees or spouse of a retired employee if the latter is deceased. The operation of saving account is stopped if the customer dies or becomes insane or insolvent. If the customer cannot be traced then the bank will place the balance in an unclaimed deposit account.
The presentation shows major features of the new C++ standard (language and the library). The full list of new things is very broad, so I've categorized them to be easier to understand.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
Building RAG with self-deployed Milvus vector database and Snowpark Container...Zilliz
This talk will give hands-on advice on building RAG applications with an open-source Milvus database deployed as a docker container. We will also introduce the integration of Milvus with Snowpark Container Services.
In the rapidly evolving landscape of technologies, XML continues to play a vital role in structuring, storing, and transporting data across diverse systems. The recent advancements in artificial intelligence (AI) present new methodologies for enhancing XML development workflows, introducing efficiency, automation, and intelligent capabilities. This presentation will outline the scope and perspective of utilizing AI in XML development. The potential benefits and the possible pitfalls will be highlighted, providing a balanced view of the subject.
We will explore the capabilities of AI in understanding XML markup languages and autonomously creating structured XML content. Additionally, we will examine the capacity of AI to enrich plain text with appropriate XML markup. Practical examples and methodological guidelines will be provided to elucidate how AI can be effectively prompted to interpret and generate accurate XML markup.
Further emphasis will be placed on the role of AI in developing XSLT, or schemas such as XSD and Schematron. We will address the techniques and strategies adopted to create prompts for generating code, explaining code, or refactoring the code, and the results achieved.
The discussion will extend to how AI can be used to transform XML content. In particular, the focus will be on the use of AI XPath extension functions in XSLT, Schematron, Schematron Quick Fixes, or for XML content refactoring.
The presentation aims to deliver a comprehensive overview of AI usage in XML development, providing attendees with the necessary knowledge to make informed decisions. Whether you’re at the early stages of adopting AI or considering integrating it in advanced XML development, this presentation will cover all levels of expertise.
By highlighting the potential advantages and challenges of integrating AI with XML development tools and languages, the presentation seeks to inspire thoughtful conversation around the future of XML development. We’ll not only delve into the technical aspects of AI-powered XML development but also discuss practical implications and possible future directions.
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofsAlex Pruden
This paper presents Reef, a system for generating publicly verifiable succinct non-interactive zero-knowledge proofs that a committed document matches or does not match a regular expression. We describe applications such as proving the strength of passwords, the provenance of email despite redactions, the validity of oblivious DNS queries, and the existence of mutations in DNA. Reef supports the Perl Compatible Regular Expression syntax, including wildcards, alternation, ranges, capture groups, Kleene star, negations, and lookarounds. Reef introduces a new type of automata, Skipping Alternating Finite Automata (SAFA), that skips irrelevant parts of a document when producing proofs without undermining soundness, and instantiates SAFA with a lookup argument. Our experimental evaluation confirms that Reef can generate proofs for documents with 32M characters; the proofs are small and cheap to verify (under a second).
Paper: https://eprint.iacr.org/2023/1886
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
GridMate - End to end testing is a critical piece to ensure quality and avoid...ThomasParaiso2
End to end testing is a critical piece to ensure quality and avoid regressions. In this session, we share our journey building an E2E testing pipeline for GridMate components (LWC and Aura) using Cypress, JSForce, FakerJS…
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfMalak Abu Hammad
Discover how MongoDB Atlas and vector search technology can revolutionize your application's search capabilities. This comprehensive presentation covers:
* What is Vector Search?
* Importance and benefits of vector search
* Practical use cases across various industries
* Step-by-step implementation guide
* Live demos with code snippets
* Enhancing LLM capabilities with vector search
* Best practices and optimization strategies
Perfect for developers, AI enthusiasts, and tech leaders. Learn how to leverage MongoDB Atlas to deliver highly relevant, context-aware search results, transforming your data retrieval process. Stay ahead in tech innovation and maximize the potential of your applications.
#MongoDB #VectorSearch #AI #SemanticSearch #TechInnovation #DataScience #LLM #MachineLearning #SearchTechnology
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
Maruthi Prithivirajan, Head of ASEAN & IN Solution Architecture, Neo4j
Get an inside look at the latest Neo4j innovations that enable relationship-driven intelligence at scale. Learn more about the newest cloud integrations and product enhancements that make Neo4j an essential choice for developers building apps with interconnected data and generative AI.
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
2. We have XS, don’t we? XS is hard Not true. The syntax is simple XS is not hard But when writing XS you are using: XS syntax Perl guts Typesmaps C Learning all these in the same time, is hard
3. We are not going to talk about XS XS is a known problem A lot of documentation on the web Most of it outdated or just wrong We will talk about: Ctypes– calling C libraries from Perl Libperl++ - embedding and extending Perl using C++ library XS++ - XS – C++ binding
4. Who am I A Perl programmer from Israel I’m here learning Japanese Just started a three month course My first YAPC talk So, yoroshekoonegaishimasu
5. What is Ctypes? Port from Python’s Ctypes Good idea / interface Still in making Not on CPAN yet Enable to call C functions inside DLLs, without making XS / intermediate DLL
6. Ctypes Now let’s see some code: use Ctypes;print chr CDLL->msvcrt->toupper({sig=>"cii"})->(ord("y"));# prints ‘Y’ # a more verbose style:my $func = Ctypes::Function->new ( { lib => 'msvcrt', name => 'toupper', argtypes => 'ii', restype => 'c' } ); print chr $func->(ord("y")); # prints ‘Y’
7. Ctypes Let’s see more: my $func = WinDLL->user32-> MessageBoxA({sig=>"sipppI"}); $func->(0, "Hi", "BoxBox", 0);
8. Ctypes – built-in types Signature details: First char – call type. ‘s’ for stdcall, ‘c’ for cdecl. Second char – return type The rest - arguments v => c_void,c => c_byte,C => c_char,s => c_short,S => c_ushort,i => c_int,I => c_uint, l => c_long,L => c_ulong,f => c_float,d => c_double,D => c_longdouble,p => c_void_p,
12. Ctypes – Libraries types CDLL Return type ‘i’, calling style ‘cdecl’ WinDLL Return type ‘i’, calling style ‘stdcall’ OleDLL Calling style “stdcall” Return type HRESULT Will throw exception automatically on error
13. Ctypes – Libraries types PerlDLL For calling Perl XS functions provides XS environment for the called function Checks the Perl error flag after the call If there was an exception – re-throws
14. Libperl++ Extending and Embedding Perl The goal: to let C++ do the hard work for you Reference counting Call stack operations Type conversions Exception conversions http://github.com/Leont/libperl--
15. Libperl++ - Embedding Let’s see some code: Interpreter universe;universe.use("Carp", 1.000); bool success = universe.eval("print qq{Hello World}"); # acessing / creating global variables universe.scalar("status") = 404; universe.hash("table").exists("hello"); # creates @Module::data : Array data = universe.array("Module::data");
16. Libperl++ - Extending Let’s say we have this C++ code: class player { string get_name() const; pair<int, int> get_position() const; void set_position(pair<int, int>); double get_strength() const; void set_strength(double); void die(string); };
17. Libperl++ - Extending It can be exported like this: Class<player> player_class = universe.add_class("Player"); player_class.add("get_name", &player::get_name); player_class.add("get_position", &player::get_position); player_class.add("set_position", &player::set_position); player_class.add("get_strength", &player::get_strength); player_class.add("set_strength", &player::set_strength); player_class.add("die", &player::die); The first line connects a C++ class “player” with Perl class “Player”, then we add each method
18. Libperl++ - Extending Of course, we can add a plain (non-object) module Package somewhere = universe.package("foo"); somewhere.add("other_name", some_function);
19. Libperl++ - Extending And the Perl side: package Extend; use strict; use warnings; use Exporter 5.57 qw/import/; our @EXPORT_OK = qw/hello/; use Perlpp::Extend; 1;
20. Libperl++ - Calling Perl You really don’t want to know how much work is to call Perl function from C Here is how to do it with Libperl++: Ref<Code> some_function = universe.code("some_function"); some_function("Hello World"); // in scalar context some_function.list("Hello World"); // in list context
21. Libperl++ - Calling Perl Also works for objects: Ref<Any> testr = universe.package("Tester").call("new", 1); testr.call("print"); testr.call("set", 3); testr.call("print"); // automatically calls ‘DESTROY’
22. Libperl++ - Scalars Scalar value = universe.value_of(1); value += 2; // can use all normal operators: + - * / % == > < = value = "1"; // the same as setting to 1 String value = universe.value_of("test"); value == std::string("test"); // convertible to/from std::string value.replace(2, 2, value); // now contains ‘tetest’ value.insert(2, "st"); // now contains ‘testtest’ value = "test"; // simple assignment
23. Libperl++ - Arrays first max min shuffledsum any all none begin/end rbegin/rend push pop shift unshift reverse remove exists length clear each each_index map grep reduce Array bar = universe.list("a", "b");int length = bar.length();cout << "bla is " << baz[1] << endl; bar[4] = "e"; void test(const Scalar::Base& val); std::for_each(bar.begin(), bar.end(), test); int converter(int arg); Array singles = universe.list(1, 2, 3, 4); singles.map(converter).each(test);
25. Libperl++ - References Any Perl variable support take_ref() Ref<Scalar> value = universe.value_of(1).take_ref(); Reference can be specific or generic Ref<Scalar>, Ref<Integer>, Ref<Number>, Ref<Any>, Ref<Hash> Reference tries to give operations shortcuts to the contained element Ref<Hash> ref = hash.take_ref(); ref["foo"] = "rab"; is_object isa is_exactly weaken bless get_classname
26. Libperl++ - custom type convertion structmy_type { int value; my_type(int _value) : value(_value) {} };namespace perl { namespace typecast { template<> structtypemap<my_type> { static my_typecast_to(const Scalar::Base& value) { return my_type(value.int_value()); } typedef boost::true_typefrom_type; static intcast_from(Interpreter&, const my_type& variable) { return variable.value; } }; } } Signals that this type can be converted to Perl type Can construct any Perl type, (using the interpreter) or any type convertible
27. ExtUtils::XSpp XS does not handle objects Only functions and constants You can write the object binding yourself Much fun XS++ fills the gap “transparent C++ objects in Perl”
28. ExtUtils::XSpp It is still XS So you need to know all the XS keywords, Perl internals and typemaps Plus adds its own little language Everything is translated back to XS for compilation Module::Build::WithXSpp See ExtUtils::XSpp’s example
29. XS++ - XSpp::Example.pm package XSpp::Example; use strict; use warnings; our $VERSION = '0.01'; require XSLoader; XSLoader::load('XSpp::Example', $VERSION); 1;
30. XS++ - C++ headers class Animal { public: Animal(const std::string& name); void SetName(const std::string& newName); std::string GetName() const; void MakeSound() const; private: std::string fName; }; class Dog : public Animal { public: Dog(const std::string& name); void Bark() const; void MakeSound() const; };
31. XS++ - xsp file #include "Animals.h" %module{XSpp::Example}; class Animal { %name{new} Animal(std::string& name); ~Animal(); void MakeSound(); void SetName(std::string& newName); std::string GetName(); }; class Dog : public Animal { %name{new} Dog(std::string& name); ~Dog(); void MakeSound(); void Bark(); };
37. Building Libffi Download from: http://github.com/atgreen/libffi Target platform: Strawberry Perl 5.12 Needed tools: cygwin with make, without gcc To build: copy src/x86/ffitarget.h to include/ffitarget.h run bash run configure run make It will produce binaries in the “.lib” directory: Libffi.* => strewberryperl/c/lib cygffi-5.dll => strewberryperl/c/bin
38. Building Ctypes Download from: http://gitorious.org/perl-ctypes http://socghop.appspot.com/gsoc/student_project/show/google/gsoc2010/tpf/t127230763807 Make sure that cygwin is not available perl Makefile.pl, dmake – test – install
39. Building Libperl++ You need C++ Boost http://www.boost.org/ But only the headers Libperl++ is a heavy C++ templates user Using Module::Build style installer perl Build.PL perl Build perl Build test perl Build install
40. Building types - Point package t_POINT;use strict;use warnings;use Ctypes;use Ctypes::Type::Struct;our @ISA = qw|Ctypes::Type::Struct|;our $_fields_ = [ ['x',c_int], ['y',c_int], ]; sub new { my $class = ref($_[0]) || $_[0]; shift; my $self = $class->SUPER::new({fields => $_fields_, values => [ @_ ] }); return bless $self => $class if $self;}
41. Building types - Point my $point = new t_POINT( 30, 40 );$$point->{x} == 30;$$point->{y} == 40;$$point->[0] == 30;$$point->[1] == 40; # yes, it is overloaded my $point_2 = new t_POINT([ y => 30, x => 40 ]);my $point_3 = new t_POINT([ y => 50 ]);