SlideShare una empresa de Scribd logo
1 de 16
Hi!
I HATE JSON
{ “users”: [
{ “name”: “Joe” },
{ “name”: “Katy” },
]}
{“users”:[{ “name”:“Joe” },{ “name”:“Katy” }]}
my $var = { users => [
{ name => ‘Joe’ },
{ name => ‘Katy’ },
]
};
foreach my $user @{ $var->{ users } } {
…
}
Parsing JSON gives you this
Access to the data is like this
Working with complex datastructures:
{ users => [
{ name => ‘Joe’ },
{ name => ‘Katy’ },
]
}
USERLIST
USER
MooseX::DataModel
Why not express the structure like this?
package UserList;
use MooseX::DataModel;
array users (isa => ‘User’);
1;
package User;
use MooseX::DataModel;
key name => (isa => ‘Str’, required => 1);
1;
my $ul =UserList->parse($json);
say $ul->users->[0]->name;
This even validates the JSON to the schema!
We can even tack methods on the objects!
package UserList;
use MooseX::DataModel;
array users (isa => ‘User’);
sub send_mail_to_all { … for ($self->users) { … } … };
1;
package User;
key name => (isa => ‘Str’, required => 1);
1;
my $ul = UserList->parse($json);
$ul->send_mail_to_all;
I HATE working with JSON
complex datastructures
(that convey object-ish things)
And JSON
Because this… is not valid JSON 
{ “users”: [
{ “name”: “Joe” },
{ “name”: “Katy” },
]}
Because this… is not valid JSON 
{ “users”: [
{ “name”: “Joe” },
{ “name”: “Katy” },
]}
Trailing comma is a syntax error 
GitHub
http://github.com/pplu/moosex-datamodel
Join me if you have the same pain
Note: highly experimental code. Not released on CPAN until it looks a
bit decent
Thanks!

Más contenido relacionado

La actualidad más candente

FormValidator::LazyWay で検証ルールをまとめよう
FormValidator::LazyWay で検証ルールをまとめようFormValidator::LazyWay で検証ルールをまとめよう
FormValidator::LazyWay で検証ルールをまとめようDaisuke Komatsu
 
Topological indices (t is) of the graphs to seek qsar models of proteins com...
Topological indices (t is) of the graphs  to seek qsar models of proteins com...Topological indices (t is) of the graphs  to seek qsar models of proteins com...
Topological indices (t is) of the graphs to seek qsar models of proteins com...Jitendra Kumar Gupta
 
Embedding a language into string interpolator
Embedding a language into string interpolatorEmbedding a language into string interpolator
Embedding a language into string interpolatorMichael Limansky
 
Being Google
Being GoogleBeing Google
Being GoogleTom Dyson
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBMongoDB
 
Native json in the Cache' ObjectScript 2016.*
Native json in the Cache' ObjectScript 2016.*Native json in the Cache' ObjectScript 2016.*
Native json in the Cache' ObjectScript 2016.*Timur Safin
 
Persistencia de datos con Parse
Persistencia de datos con ParsePersistencia de datos con Parse
Persistencia de datos con ParseAlfonso Alba
 
How Much Immutability Is Enough?
How Much Immutability Is Enough?How Much Immutability Is Enough?
How Much Immutability Is Enough?Yegor Bugayenko
 
ABV_fastcontact
ABV_fastcontactABV_fastcontact
ABV_fastcontactarjun rao
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Groupkchodorow
 
supporting t-sql scripts for IndexPage, Datapage and IndexDefragmentation
supporting t-sql scripts for IndexPage, Datapage and IndexDefragmentationsupporting t-sql scripts for IndexPage, Datapage and IndexDefragmentation
supporting t-sql scripts for IndexPage, Datapage and IndexDefragmentationMahabubur Rahaman
 
MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2Takahiro Inoue
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)MongoSF
 

La actualidad más candente (20)

FormValidator::LazyWay で検証ルールをまとめよう
FormValidator::LazyWay で検証ルールをまとめようFormValidator::LazyWay で検証ルールをまとめよう
FormValidator::LazyWay で検証ルールをまとめよう
 
Couchdb
CouchdbCouchdb
Couchdb
 
Topological indices (t is) of the graphs to seek qsar models of proteins com...
Topological indices (t is) of the graphs  to seek qsar models of proteins com...Topological indices (t is) of the graphs  to seek qsar models of proteins com...
Topological indices (t is) of the graphs to seek qsar models of proteins com...
 
Embedding a language into string interpolator
Embedding a language into string interpolatorEmbedding a language into string interpolator
Embedding a language into string interpolator
 
Being Google
Being GoogleBeing Google
Being Google
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
 
Everyday's JS
Everyday's JSEveryday's JS
Everyday's JS
 
C# 3.5 Features
C# 3.5 FeaturesC# 3.5 Features
C# 3.5 Features
 
Native json in the Cache' ObjectScript 2016.*
Native json in the Cache' ObjectScript 2016.*Native json in the Cache' ObjectScript 2016.*
Native json in the Cache' ObjectScript 2016.*
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Persistencia de datos con Parse
Persistencia de datos con ParsePersistencia de datos con Parse
Persistencia de datos con Parse
 
How Much Immutability Is Enough?
How Much Immutability Is Enough?How Much Immutability Is Enough?
How Much Immutability Is Enough?
 
ABV_fastcontact
ABV_fastcontactABV_fastcontact
ABV_fastcontact
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
 
supporting t-sql scripts for IndexPage, Datapage and IndexDefragmentation
supporting t-sql scripts for IndexPage, Datapage and IndexDefragmentationsupporting t-sql scripts for IndexPage, Datapage and IndexDefragmentation
supporting t-sql scripts for IndexPage, Datapage and IndexDefragmentation
 
Xpath & xquery
Xpath & xqueryXpath & xquery
Xpath & xquery
 
Swift & JSON
Swift & JSONSwift & JSON
Swift & JSON
 
MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2
 
Underscore
UnderscoreUnderscore
Underscore
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
 

Destacado

Paws - Perl AWS SDK Update - November 2015
Paws - Perl AWS SDK Update - November 2015Paws - Perl AWS SDK Update - November 2015
Paws - Perl AWS SDK Update - November 2015Jose Luis Martínez
 
Building an aws sdk for Perl - Granada Perl Workshop 2014
Building an aws sdk for Perl - Granada Perl Workshop 2014Building an aws sdk for Perl - Granada Perl Workshop 2014
Building an aws sdk for Perl - Granada Perl Workshop 2014Jose Luis Martínez
 
Writing plugins for Nagios and Opsview - CAPSiDE Tech Talks
Writing plugins for Nagios and Opsview - CAPSiDE Tech TalksWriting plugins for Nagios and Opsview - CAPSiDE Tech Talks
Writing plugins for Nagios and Opsview - CAPSiDE Tech TalksJose Luis Martínez
 
Infinity
InfinityInfinity
Infinityjs229
 
Questionnaire results
Questionnaire resultsQuestionnaire results
Questionnaire resultskamar95
 
Kutner and olsen
Kutner and olsenKutner and olsen
Kutner and olsenkamar95
 
θουκυδίδου ι αγνωστο θεμα
θουκυδίδου ι αγνωστο θεμαθουκυδίδου ι αγνωστο θεμα
θουκυδίδου ι αγνωστο θεμαEfi Manousaka
 
Pictures i have used in my magazine 2
Pictures i have used in my magazine 2Pictures i have used in my magazine 2
Pictures i have used in my magazine 2kamar95
 
How to use photoshop
How to use photoshopHow to use photoshop
How to use photoshopkamar95
 
Feedback from the first versions of my music
Feedback from the first versions of my musicFeedback from the first versions of my music
Feedback from the first versions of my musickamar95
 
Daniel & Ernesto's presentation
Daniel & Ernesto's presentationDaniel & Ernesto's presentation
Daniel & Ernesto's presentationErnesto Sepulveda
 
My fist drafts presnetation
My fist drafts presnetationMy fist drafts presnetation
My fist drafts presnetationkamar95
 

Destacado (20)

Paws - Perl AWS SDK Update - November 2015
Paws - Perl AWS SDK Update - November 2015Paws - Perl AWS SDK Update - November 2015
Paws - Perl AWS SDK Update - November 2015
 
Perl and AWS
Perl and AWSPerl and AWS
Perl and AWS
 
Paws - A Perl AWS SDK
Paws - A Perl AWS SDKPaws - A Perl AWS SDK
Paws - A Perl AWS SDK
 
Building an aws sdk for Perl - Granada Perl Workshop 2014
Building an aws sdk for Perl - Granada Perl Workshop 2014Building an aws sdk for Perl - Granada Perl Workshop 2014
Building an aws sdk for Perl - Granada Perl Workshop 2014
 
Writing plugins for Nagios and Opsview - CAPSiDE Tech Talks
Writing plugins for Nagios and Opsview - CAPSiDE Tech TalksWriting plugins for Nagios and Opsview - CAPSiDE Tech Talks
Writing plugins for Nagios and Opsview - CAPSiDE Tech Talks
 
Boosting MySQL (for starters)
Boosting MySQL (for starters)Boosting MySQL (for starters)
Boosting MySQL (for starters)
 
Plenv and carton
Plenv and cartonPlenv and carton
Plenv and carton
 
Sophiie compu
Sophiie compuSophiie compu
Sophiie compu
 
Arxaia b gymn
Arxaia b gymnArxaia b gymn
Arxaia b gymn
 
Infinity
InfinityInfinity
Infinity
 
Questionnaire results
Questionnaire resultsQuestionnaire results
Questionnaire results
 
Kutner and olsen
Kutner and olsenKutner and olsen
Kutner and olsen
 
θουκυδίδου ι αγνωστο θεμα
θουκυδίδου ι αγνωστο θεμαθουκυδίδου ι αγνωστο θεμα
θουκυδίδου ι αγνωστο θεμα
 
Pictures i have used in my magazine 2
Pictures i have used in my magazine 2Pictures i have used in my magazine 2
Pictures i have used in my magazine 2
 
How to use photoshop
How to use photoshopHow to use photoshop
How to use photoshop
 
Feedback from the first versions of my music
Feedback from the first versions of my musicFeedback from the first versions of my music
Feedback from the first versions of my music
 
Daniel & Ernesto's presentation
Daniel & Ernesto's presentationDaniel & Ernesto's presentation
Daniel & Ernesto's presentation
 
My fist drafts presnetation
My fist drafts presnetationMy fist drafts presnetation
My fist drafts presnetation
 
Bloedsomloop versie 1.0
Bloedsomloop versie 1.0Bloedsomloop versie 1.0
Bloedsomloop versie 1.0
 
DBIx::Class
DBIx::ClassDBIx::Class
DBIx::Class
 

Similar a MooseX::Datamodel - Barcelona Perl Workshop Lightning talk

BGOUG15: JSON support in MySQL 5.7
BGOUG15: JSON support in MySQL 5.7BGOUG15: JSON support in MySQL 5.7
BGOUG15: JSON support in MySQL 5.7Georgi Kodinov
 
Developing Applications with MySQL and Java for beginners
Developing Applications with MySQL and Java for beginnersDeveloping Applications with MySQL and Java for beginners
Developing Applications with MySQL and Java for beginnersSaeid Zebardast
 
My sql presentation
My sql presentationMy sql presentation
My sql presentationNikhil Jain
 
Ex[1].3 php db connectivity
Ex[1].3 php db connectivityEx[1].3 php db connectivity
Ex[1].3 php db connectivityMouli Chandira
 
The State of Lithium
The State of LithiumThe State of Lithium
The State of LithiumNate Abele
 
Protocol Oriented JSON Parsing in Swift
Protocol Oriented JSON Parsing in SwiftProtocol Oriented JSON Parsing in Swift
Protocol Oriented JSON Parsing in SwiftJason Larsen
 
Test du futur avec Spock
Test du futur avec SpockTest du futur avec Spock
Test du futur avec SpockCARA_Lyon
 
JSON Support in MariaDB: News, non-news and the bigger picture
JSON Support in MariaDB: News, non-news and the bigger pictureJSON Support in MariaDB: News, non-news and the bigger picture
JSON Support in MariaDB: News, non-news and the bigger pictureSergey Petrunya
 
Getting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NETGetting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NETTomas Jansson
 
Php update and delet operation
Php update and delet operationPhp update and delet operation
Php update and delet operationsyeda zoya mehdi
 
Angular 2 Component Communication - Talk by Rob McDiarmid
Angular 2 Component Communication - Talk by Rob McDiarmidAngular 2 Component Communication - Talk by Rob McDiarmid
Angular 2 Component Communication - Talk by Rob McDiarmidAmrita Chopra
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency InjectionRifat Nabi
 
Data models in Angular 1 & 2
Data models in Angular 1 & 2Data models in Angular 1 & 2
Data models in Angular 1 & 2Adam Klein
 
JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)Raghu nath
 

Similar a MooseX::Datamodel - Barcelona Perl Workshop Lightning talk (20)

BGOUG15: JSON support in MySQL 5.7
BGOUG15: JSON support in MySQL 5.7BGOUG15: JSON support in MySQL 5.7
BGOUG15: JSON support in MySQL 5.7
 
Functional es6
Functional es6Functional es6
Functional es6
 
Developing Applications with MySQL and Java for beginners
Developing Applications with MySQL and Java for beginnersDeveloping Applications with MySQL and Java for beginners
Developing Applications with MySQL and Java for beginners
 
My sql presentation
My sql presentationMy sql presentation
My sql presentation
 
Ex[1].3 php db connectivity
Ex[1].3 php db connectivityEx[1].3 php db connectivity
Ex[1].3 php db connectivity
 
FNT 2015 PDIS CodeEU - Zanimljiva informatika - 02 Djordje Pavlovic - Live_ch...
FNT 2015 PDIS CodeEU - Zanimljiva informatika - 02 Djordje Pavlovic - Live_ch...FNT 2015 PDIS CodeEU - Zanimljiva informatika - 02 Djordje Pavlovic - Live_ch...
FNT 2015 PDIS CodeEU - Zanimljiva informatika - 02 Djordje Pavlovic - Live_ch...
 
The State of Lithium
The State of LithiumThe State of Lithium
The State of Lithium
 
Protocol Oriented JSON Parsing in Swift
Protocol Oriented JSON Parsing in SwiftProtocol Oriented JSON Parsing in Swift
Protocol Oriented JSON Parsing in Swift
 
Test du futur avec Spock
Test du futur avec SpockTest du futur avec Spock
Test du futur avec Spock
 
Week 12 code
Week 12 codeWeek 12 code
Week 12 code
 
JSON Support in MariaDB: News, non-news and the bigger picture
JSON Support in MariaDB: News, non-news and the bigger pictureJSON Support in MariaDB: News, non-news and the bigger picture
JSON Support in MariaDB: News, non-news and the bigger picture
 
Groovy
GroovyGroovy
Groovy
 
Getting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NETGetting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NET
 
MYSQL
MYSQLMYSQL
MYSQL
 
Php update and delet operation
Php update and delet operationPhp update and delet operation
Php update and delet operation
 
Angular 2 Component Communication - Talk by Rob McDiarmid
Angular 2 Component Communication - Talk by Rob McDiarmidAngular 2 Component Communication - Talk by Rob McDiarmid
Angular 2 Component Communication - Talk by Rob McDiarmid
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Data models in Angular 1 & 2
Data models in Angular 1 & 2Data models in Angular 1 & 2
Data models in Angular 1 & 2
 
Laravel
LaravelLaravel
Laravel
 
JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)
 

Más de Jose Luis Martínez

Más de Jose Luis Martínez (9)

Being cloudy with perl
Being cloudy with perlBeing cloudy with perl
Being cloudy with perl
 
Modern Perl toolchain (help building microservices)
Modern Perl toolchain (help building microservices)Modern Perl toolchain (help building microservices)
Modern Perl toolchain (help building microservices)
 
Escribir plugins para Nagios en Perl
Escribir plugins para Nagios en PerlEscribir plugins para Nagios en Perl
Escribir plugins para Nagios en Perl
 
NRD: Nagios Result Distributor
NRD: Nagios Result DistributorNRD: Nagios Result Distributor
NRD: Nagios Result Distributor
 
Writing nagios plugins in perl
Writing nagios plugins in perlWriting nagios plugins in perl
Writing nagios plugins in perl
 
Ficheros y directorios
Ficheros y directoriosFicheros y directorios
Ficheros y directorios
 
DBI
DBIDBI
DBI
 
The modern perl toolchain
The modern perl toolchainThe modern perl toolchain
The modern perl toolchain
 
Introducción a las Expresiones Regulares
Introducción a las Expresiones RegularesIntroducción a las Expresiones Regulares
Introducción a las Expresiones Regulares
 

Último

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 

Último (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 

MooseX::Datamodel - Barcelona Perl Workshop Lightning talk

  • 1. Hi!
  • 3. { “users”: [ { “name”: “Joe” }, { “name”: “Katy” }, ]}
  • 4. {“users”:[{ “name”:“Joe” },{ “name”:“Katy” }]}
  • 5. my $var = { users => [ { name => ‘Joe’ }, { name => ‘Katy’ }, ] }; foreach my $user @{ $var->{ users } } { … } Parsing JSON gives you this Access to the data is like this
  • 6. Working with complex datastructures:
  • 7. { users => [ { name => ‘Joe’ }, { name => ‘Katy’ }, ] } USERLIST USER
  • 9. Why not express the structure like this? package UserList; use MooseX::DataModel; array users (isa => ‘User’); 1; package User; use MooseX::DataModel; key name => (isa => ‘Str’, required => 1); 1; my $ul =UserList->parse($json); say $ul->users->[0]->name; This even validates the JSON to the schema!
  • 10. We can even tack methods on the objects! package UserList; use MooseX::DataModel; array users (isa => ‘User’); sub send_mail_to_all { … for ($self->users) { … } … }; 1; package User; key name => (isa => ‘Str’, required => 1); 1; my $ul = UserList->parse($json); $ul->send_mail_to_all;
  • 11. I HATE working with JSON complex datastructures (that convey object-ish things)
  • 13. Because this… is not valid JSON  { “users”: [ { “name”: “Joe” }, { “name”: “Katy” }, ]}
  • 14. Because this… is not valid JSON  { “users”: [ { “name”: “Joe” }, { “name”: “Katy” }, ]} Trailing comma is a syntax error 
  • 15. GitHub http://github.com/pplu/moosex-datamodel Join me if you have the same pain Note: highly experimental code. Not released on CPAN until it looks a bit decent