SlideShare una empresa de Scribd logo
1 de 20
Light</HTML>
list - ls [options] elements
clean - cl elements
delete - de [options] elements
delete - de [options] elements
DEMO
Dispatch Table
hash of references to executable code
Dispatch Table
my $dispatchTable = {
! a => &func_a,
! b => &func_b,
! q => sub { exit(0) },
};
while ( 1 ) {
! print "Press a key!n";
! chomp (my $input = <STDIN>);
! if (defined $dispatchTable->($input)) {
! ! $dispatchTable->{$input}->();
! }
}
Hash table
Get user input
reference to function argvs
Dispatch Table
my $myFunc = {
! s => &saveFile,
! de => &deletTag,
! cl => &cleanUp,
! ls => &listTags,
! q => sub { $root = $root->delete; exit(0) },
! DEFAULT => sub {print ("Command not found.n")}
};
HTML::TreeBuilder
Parser that builds a HTML syntax tree
http://search.cpan.org/~cjm/HTML-Tree-5.03/lib/HTML/TreeBuilder.pm
HTML::Tree
make parse trees out of
HTML source
HTML::TreeBuilder
builds the parse trees
HTML::Element
parse trees are made up of
element class objects
create tree object
HTML::TreeBuilder
#!/usr/bin/perl -w
use warnings FATAL => 'all';
use strict;
use HTML::TreeBuilder;
use Term::ANSIColor;
(@ARGV == 1) || exit print "Usage: [HTML file].n";
(-e $ARGV[0]) || exit print "Input file does not exist.n";
my $root = HTML::TreeBuilder->new;
$root->parse_file($ARGV[0]) || die "$!";
include module
html
head
title meta
body
p
h1,h2...div
p p
Perl & LWP
by Sean M. Burke
"Fetching web pages, Parsing HTML,
Writing Spiders, & More"
http://lwp.interglacial.com/index.html
Chapter 9
HTML Processing with Trees
Chapter 10
Modifying HTML with Trees
Light</HTML>
GitHub : LightHTML
https://github.com/Conrad-Lo/LightHTML

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

week-14x
week-14xweek-14x
week-14x
 
Nette framework (WebElement #27 lightning talk)
Nette framework (WebElement #27 lightning talk)Nette framework (WebElement #27 lightning talk)
Nette framework (WebElement #27 lightning talk)
 
wget.pl
wget.plwget.pl
wget.pl
 
Array menu
Array menuArray menu
Array menu
 
Tips for using Firebird system tables
Tips for using Firebird system tablesTips for using Firebird system tables
Tips for using Firebird system tables
 
PL/SQL Blocks
PL/SQL BlocksPL/SQL Blocks
PL/SQL Blocks
 
An Elephant of a Different Colour: Hack
An Elephant of a Different Colour: HackAn Elephant of a Different Colour: Hack
An Elephant of a Different Colour: Hack
 
PHP object calisthenics
PHP object calisthenicsPHP object calisthenics
PHP object calisthenics
 
Perl Fitxers i Directoris
Perl Fitxers i DirectorisPerl Fitxers i Directoris
Perl Fitxers i Directoris
 
array implementation
 array implementation array implementation
array implementation
 
Final ds record
Final ds recordFinal ds record
Final ds record
 
Migrare da symfony 1 a Symfony2
 Migrare da symfony 1 a Symfony2  Migrare da symfony 1 a Symfony2
Migrare da symfony 1 a Symfony2
 
Password.php
Password.phpPassword.php
Password.php
 
Node.js - Demnächst auf einem Server in Ihrer Nähe
Node.js - Demnächst auf einem Server in Ihrer NäheNode.js - Demnächst auf einem Server in Ihrer Nähe
Node.js - Demnächst auf einem Server in Ihrer Nähe
 
C program to implement linked list using array abstract data type
C program to implement linked list using array abstract data typeC program to implement linked list using array abstract data type
C program to implement linked list using array abstract data type
 
Codigos
CodigosCodigos
Codigos
 
20191116 custom operators in swift
20191116 custom operators in swift20191116 custom operators in swift
20191116 custom operators in swift
 
8.1
8.18.1
8.1
 
Data structure output 1
Data structure output 1Data structure output 1
Data structure output 1
 
Array imp of list
Array imp of listArray imp of list
Array imp of list
 

Destacado

210140010 강민지 12주차 수시과제
210140010 강민지 12주차 수시과제210140010 강민지 12주차 수시과제
210140010 강민지 12주차 수시과제Minji Kang
 
소셜매니저 3차미션(130602)
소셜매니저  3차미션(130602)소셜매니저  3차미션(130602)
소셜매니저 3차미션(130602)Hwa Yeon Park
 
School Laws Protecting Students with Food Allergies
School Laws Protecting Students with Food AllergiesSchool Laws Protecting Students with Food Allergies
School Laws Protecting Students with Food AllergiesLynda Mitchell
 
Asio4 all v2 instruction manual
Asio4 all v2 instruction manualAsio4 all v2 instruction manual
Asio4 all v2 instruction manualJonas Souza
 
76157598 pr-mihai-andrei-aldea-despre-colinde-și-colindat
76157598 pr-mihai-andrei-aldea-despre-colinde-și-colindat76157598 pr-mihai-andrei-aldea-despre-colinde-și-colindat
76157598 pr-mihai-andrei-aldea-despre-colinde-și-colindatRaluca Mihaela
 
Hipertension portal
Hipertension portalHipertension portal
Hipertension portalLiz Ruiz
 
都道府県の記念日等の一覧(第1版)
都道府県の記念日等の一覧(第1版)都道府県の記念日等の一覧(第1版)
都道府県の記念日等の一覧(第1版)GXDXlab
 
A language for learning (thinking maps)
A language for learning (thinking maps)A language for learning (thinking maps)
A language for learning (thinking maps)Sandra Herrera
 
Powerpoint taylor swift
Powerpoint taylor swiftPowerpoint taylor swift
Powerpoint taylor swiftDenissepaz13
 
Parenteral controlled release drug delivery system -by varsha phirke
Parenteral controlled release drug delivery system -by varsha phirkeParenteral controlled release drug delivery system -by varsha phirke
Parenteral controlled release drug delivery system -by varsha phirkeVarsha Phirke
 
Parenteral controlled release drug delivery system - by varsha phirke
Parenteral controlled release drug delivery system - by varsha phirkeParenteral controlled release drug delivery system - by varsha phirke
Parenteral controlled release drug delivery system - by varsha phirkeVarsha Phirke
 

Destacado (15)

210140010 강민지 12주차 수시과제
210140010 강민지 12주차 수시과제210140010 강민지 12주차 수시과제
210140010 강민지 12주차 수시과제
 
소셜매니저 3차미션(130602)
소셜매니저  3차미션(130602)소셜매니저  3차미션(130602)
소셜매니저 3차미션(130602)
 
Clothes
ClothesClothes
Clothes
 
School Laws Protecting Students with Food Allergies
School Laws Protecting Students with Food AllergiesSchool Laws Protecting Students with Food Allergies
School Laws Protecting Students with Food Allergies
 
Asio4 all v2 instruction manual
Asio4 all v2 instruction manualAsio4 all v2 instruction manual
Asio4 all v2 instruction manual
 
76157598 pr-mihai-andrei-aldea-despre-colinde-și-colindat
76157598 pr-mihai-andrei-aldea-despre-colinde-și-colindat76157598 pr-mihai-andrei-aldea-despre-colinde-și-colindat
76157598 pr-mihai-andrei-aldea-despre-colinde-și-colindat
 
Alex
AlexAlex
Alex
 
Slideshare
SlideshareSlideshare
Slideshare
 
Alex (2)
Alex (2)Alex (2)
Alex (2)
 
Hipertension portal
Hipertension portalHipertension portal
Hipertension portal
 
都道府県の記念日等の一覧(第1版)
都道府県の記念日等の一覧(第1版)都道府県の記念日等の一覧(第1版)
都道府県の記念日等の一覧(第1版)
 
A language for learning (thinking maps)
A language for learning (thinking maps)A language for learning (thinking maps)
A language for learning (thinking maps)
 
Powerpoint taylor swift
Powerpoint taylor swiftPowerpoint taylor swift
Powerpoint taylor swift
 
Parenteral controlled release drug delivery system -by varsha phirke
Parenteral controlled release drug delivery system -by varsha phirkeParenteral controlled release drug delivery system -by varsha phirke
Parenteral controlled release drug delivery system -by varsha phirke
 
Parenteral controlled release drug delivery system - by varsha phirke
Parenteral controlled release drug delivery system - by varsha phirkeParenteral controlled release drug delivery system - by varsha phirke
Parenteral controlled release drug delivery system - by varsha phirke
 

Similar a COMP2021 Final Project - LightHTML

2014 database - course 2 - php
2014 database - course 2 - php2014 database - course 2 - php
2014 database - course 2 - phpHung-yu Lin
 
Refactor like a boss
Refactor like a bossRefactor like a boss
Refactor like a bossgsterndale
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming LanguageArkadeep Dey
 
Crafting Custom Interfaces with Sub::Exporter
Crafting Custom Interfaces with Sub::ExporterCrafting Custom Interfaces with Sub::Exporter
Crafting Custom Interfaces with Sub::ExporterRicardo Signes
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQueryorestJump
 
C programming array & shorting
C  programming array & shortingC  programming array & shorting
C programming array & shortingargusacademy
 
Single linked list
Single linked listSingle linked list
Single linked listSayantan Sur
 
Elixir in a nutshell - Fundamental Concepts
Elixir in a nutshell - Fundamental ConceptsElixir in a nutshell - Fundamental Concepts
Elixir in a nutshell - Fundamental ConceptsHéla Ben Khalfallah
 
Php tips-and-tricks4128
Php tips-and-tricks4128Php tips-and-tricks4128
Php tips-and-tricks4128PrinceGuru MS
 
ภาษาซี
ภาษาซีภาษาซี
ภาษาซีkramsri
 
FP in scalaで鍛える関数型脳
FP in scalaで鍛える関数型脳FP in scalaで鍛える関数型脳
FP in scalaで鍛える関数型脳Yuri Inoue
 
perl usage at database applications
perl usage at database applicationsperl usage at database applications
perl usage at database applicationsJoe Jiang
 
Data Structure using C
Data Structure using CData Structure using C
Data Structure using CBilal Mirza
 
PHP tips and tricks
PHP tips and tricks PHP tips and tricks
PHP tips and tricks Damien Seguy
 
Template Haskell とか
Template Haskell とかTemplate Haskell とか
Template Haskell とかHiromi Ishii
 
DBIx-DataModel v2.0 in detail
DBIx-DataModel v2.0 in detail DBIx-DataModel v2.0 in detail
DBIx-DataModel v2.0 in detail Laurent Dami
 

Similar a COMP2021 Final Project - LightHTML (20)

2014 database - course 2 - php
2014 database - course 2 - php2014 database - course 2 - php
2014 database - course 2 - php
 
My First Ruby
My First RubyMy First Ruby
My First Ruby
 
Refactor like a boss
Refactor like a bossRefactor like a boss
Refactor like a boss
 
PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDESPHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming Language
 
Crafting Custom Interfaces with Sub::Exporter
Crafting Custom Interfaces with Sub::ExporterCrafting Custom Interfaces with Sub::Exporter
Crafting Custom Interfaces with Sub::Exporter
 
Php 101: PDO
Php 101: PDOPhp 101: PDO
Php 101: PDO
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQuery
 
C programming array & shorting
C  programming array & shortingC  programming array & shorting
C programming array & shorting
 
Single linked list
Single linked listSingle linked list
Single linked list
 
Elixir in a nutshell - Fundamental Concepts
Elixir in a nutshell - Fundamental ConceptsElixir in a nutshell - Fundamental Concepts
Elixir in a nutshell - Fundamental Concepts
 
Php tips-and-tricks4128
Php tips-and-tricks4128Php tips-and-tricks4128
Php tips-and-tricks4128
 
ภาษาซี
ภาษาซีภาษาซี
ภาษาซี
 
FP in scalaで鍛える関数型脳
FP in scalaで鍛える関数型脳FP in scalaで鍛える関数型脳
FP in scalaで鍛える関数型脳
 
perl usage at database applications
perl usage at database applicationsperl usage at database applications
perl usage at database applications
 
Data Structure using C
Data Structure using CData Structure using C
Data Structure using C
 
PHP tips and tricks
PHP tips and tricks PHP tips and tricks
PHP tips and tricks
 
Ds
DsDs
Ds
 
Template Haskell とか
Template Haskell とかTemplate Haskell とか
Template Haskell とか
 
DBIx-DataModel v2.0 in detail
DBIx-DataModel v2.0 in detail DBIx-DataModel v2.0 in detail
DBIx-DataModel v2.0 in detail
 

Último

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Último (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

COMP2021 Final Project - LightHTML