It's easy to write command-line programs in Perl. There are a million option parsers to choose from, and Perl makes it easy to deal with input, output, and all that stuff.
Once your program has gotten beyond just taking a few switches, though, it can be difficult to maintain a clear interface and well-tested code. App::Cmd is a lightweight framework for writing easy to manage CLI programs.
This talk provides an introduction to writing programs with App::Cmd.
Dask is a task scheduler that seamlessly parallelizes Python functions across threads, processes, or cluster nodes. It also offers a DataFrame class (similar to Pandas) that can handle data sets larger than the available memory.
It's quite hard to write cross-platform CPAN modules, especially when you use XS to interface with C libraries. Luckily, CPAN Testers tests your modules on many platforms for you. Come see how CPAN Testers helped me to create a fully portable module.
Presented at YAPC::Europe 2011.
I have 77 modules on the CPAN and I haven't
yet given a talk about most of them. I'll pick ten
useful but less-known modules of mine and give two
minute introductions to each
Starting with the system calll "getrusage", this returns synchronous, process-level information, mainly max RSS used. This talk describes the output from getrusage, the rusage formatting utility in ProcStats, and several examples of using it to examine time and memory use.
Optional first & final outputs to give baseline and total status, differencing avoids extraneous output, and user messages allow arbitrary stat's and tracking content.
The combination makes this nice for tracking both long-lived and shorter, more intensive processing.
Dask is a task scheduler that seamlessly parallelizes Python functions across threads, processes, or cluster nodes. It also offers a DataFrame class (similar to Pandas) that can handle data sets larger than the available memory.
It's quite hard to write cross-platform CPAN modules, especially when you use XS to interface with C libraries. Luckily, CPAN Testers tests your modules on many platforms for you. Come see how CPAN Testers helped me to create a fully portable module.
Presented at YAPC::Europe 2011.
I have 77 modules on the CPAN and I haven't
yet given a talk about most of them. I'll pick ten
useful but less-known modules of mine and give two
minute introductions to each
Starting with the system calll "getrusage", this returns synchronous, process-level information, mainly max RSS used. This talk describes the output from getrusage, the rusage formatting utility in ProcStats, and several examples of using it to examine time and memory use.
Optional first & final outputs to give baseline and total status, differencing avoids extraneous output, and user messages allow arbitrary stat's and tracking content.
The combination makes this nice for tracking both long-lived and shorter, more intensive processing.
Find out about hardware, software, protocols, digital video broadcasting, video formats, computer architectures, Perl modules and more as the speaker undertakes the project of a lifetime in his living room: fewer cables.
Modern Getopt for Command Line Processing in PerlNova Patch
Getopt modules, such as Getopt::Long, are used for processing command line options. There are over sixty Getopt modules on CPAN, which can be intimidating to select from. This talk highlights some of the Getopt pearls that have been released in the past few years.
Presented at YAPC::NA 2011, June 28, Asheville, NC.
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.
With more and more sites falling victim to data theft, you've probably read the list of things (not) to do to write secure code. But what else should you do to make sure your code and the rest of your web stack is secure ? In this tutorial we'll go through the basic and more advanced techniques of securing your web and database servers, securing your backend PHP code and your frontend javascript code. We'll also look at how you can build code that detects and blocks intrusion attempts and a bunch of other tips and tricks to make sure your customer data stays secure.
Here's a presentation I did for the Japanese Perl Association on April 21st, 2009.
It covers 10 aspects of Catalyst that may not be documented or discussed as much as they could be, that are very useful.
Logstash for SEO: come monitorare i Log del Web Server in realtimeAndrea Cardinale
Durante questo intervento verrà illustrato come si possono installare software di analisi in tempo reale dei log del server (ELK pattern: ElasticSearch, Logstash, Kibana) in modo da ottenere tutte le informazioni su Googlebot e per scoprire i punti di debolezza e gli eventi relativi ai nostri siti che non potremmo altrimenti conoscere.
Teaching Your Machine To Find FraudstersIan Barber
The slides from my talk at PHP Tek 11.
When dealing with money online, fraud is an ongoing problem for both
consumers and sellers. Researchers have been developing statistical
and machine learning techniques to detect shady sellers on auction
sites, spot fraudulent payments on e-commerce systems and catch click
fraud on adverts. While there is no silver bullet, you will learn to
flag suspicious activity and help protect your site from scammers
using PHP and a little help from some other technologies.
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.
Find out about hardware, software, protocols, digital video broadcasting, video formats, computer architectures, Perl modules and more as the speaker undertakes the project of a lifetime in his living room: fewer cables.
Modern Getopt for Command Line Processing in PerlNova Patch
Getopt modules, such as Getopt::Long, are used for processing command line options. There are over sixty Getopt modules on CPAN, which can be intimidating to select from. This talk highlights some of the Getopt pearls that have been released in the past few years.
Presented at YAPC::NA 2011, June 28, Asheville, NC.
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.
With more and more sites falling victim to data theft, you've probably read the list of things (not) to do to write secure code. But what else should you do to make sure your code and the rest of your web stack is secure ? In this tutorial we'll go through the basic and more advanced techniques of securing your web and database servers, securing your backend PHP code and your frontend javascript code. We'll also look at how you can build code that detects and blocks intrusion attempts and a bunch of other tips and tricks to make sure your customer data stays secure.
Here's a presentation I did for the Japanese Perl Association on April 21st, 2009.
It covers 10 aspects of Catalyst that may not be documented or discussed as much as they could be, that are very useful.
Logstash for SEO: come monitorare i Log del Web Server in realtimeAndrea Cardinale
Durante questo intervento verrà illustrato come si possono installare software di analisi in tempo reale dei log del server (ELK pattern: ElasticSearch, Logstash, Kibana) in modo da ottenere tutte le informazioni su Googlebot e per scoprire i punti di debolezza e gli eventi relativi ai nostri siti che non potremmo altrimenti conoscere.
Teaching Your Machine To Find FraudstersIan Barber
The slides from my talk at PHP Tek 11.
When dealing with money online, fraud is an ongoing problem for both
consumers and sellers. Researchers have been developing statistical
and machine learning techniques to detect shady sellers on auction
sites, spot fraudulent payments on e-commerce systems and catch click
fraud on adverts. While there is no silver bullet, you will learn to
flag suspicious activity and help protect your site from scammers
using PHP and a little help from some other technologies.
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.
Sly and the RoarVM: Exploring the Manycore Future of ProgrammingStefan Marr
The manycore future has several challenges ahead of us that suggest that fundamental assumptions of contemporary programming approaches do not apply anymore when scalability is required.
Sly is a language prototype designed to experiment with the inherently nondeterministic properties of parallel systems. It is designed to enable programmers to embrace nondeterminism instead of guiding them to fight it. Nature shows that complex system can be built from independent entities that achieve a common goal without global synchronization/communication. Sly is design to enable the prototyping of algorithms that show such emerging behavior. It will be introduced in the first part of the talk.
The second part of the talk will focus on the underlying problems of building virtual machines for the manycore future, which allow to harness the available computing power. The RoarVM was design to experiment on the Tilera TILE64 manycore processor architecture which provides 64 cores and characteristics that are distinctly different from today's commodity multicore processors. Memory bandwidth, caches and communication are the biggest challenges on such architectures and this talk will give a brief overview over the design choices of the RoarVM which tackle the characteristics of the TILE64 architecture.
Acknowledgement: Sly and the RoarVM were designed and implemented by David Ungar and Sam Adams at IBM Research.
See the top reasons once hot consumer, fashion and tech entrepreneurs and founders start to fail. The leadership issues that start to harm the culture, organization and sales.
SyScan 2015 Bonus Slides - death of the vmsize=0 dyld trickStefan Esser
During my talk at SyScan 2015 i promised to disclose among all the fail of Apple how their patches for "Patient ALPHA" actually killed a previously unknown 0-day incomplete code signing vulnerability that was just waiting to be used in the next jailbreak.
In this chaper we will learn how to change the BackColor property of an object
Understand Visual Basic 2010 code statement formatsand see how IntelliSense can be used to enter code statements.We will discuss the Visual Basic programming languge syntax and write coding statements. We will also see how to correct coding errors in Visual Basic 2010.
Correct errors in Visual Basic 2010 code. We will learn how to print code and how to prepare an Event Planning Document.
Today, coding is a hot topic as everyone wants to get involved with programming for the future. In this two part series, day one will uncover tools you can use to learn about programming and get started without having any coding experience. Learn the theories of code and basic frameworks. Day two will focus on outlining bigger frameworks from web to application; and which languages can accomplish which goals.
Going further, it is important to have a basic understanding of computer programming. Although you may not become a computer programmer, knowing the basics can help you work more efficiently with software and be able to troubleshoot issues when they arise.
Dealing with Legacy Perl Code - Peter ScottO'Reilly Media
Peter Scott, author of the O'Reilly School of Technology's Perl Programming Certificate series, talks about how to deal with "legacy" Perl code - written by someone else, or maybe even yourself when you were younger and less wise.
This session of The Ajax Experience 2008 takes a look at the latest features in both Prototype and script.aculo.us, including custom events and how to leverage them, method wrapping for AOP-style programming, sprockets, the refactorings and improvements on Ajax, scheduling and the DOM, the new effects engine, and more.
We wrap up with an overview of the community landscape for these libraries, looking at major helpful resources, prominent peripheral frameworks, and seeing what the future looks like for both Prototype and script.aculo.us.
The $path to knowledge: What little it take to unit-test Perl.Workhorse Computing
Metadata-driven lazyness, Perl, and Jenkins provide a nice mix for automated testing. With Perl the only thing required to start testing is a files path, from there the possibilities are endless. Using Symbol's qualify_to_ref makes it easy to validate @EXPORT & @EXPORT_OK, knowing the path makes it easy to use "perl -wc" to get diagnostics.
The beautiful thing is all of it can be lazy... er, "automated". And repeatable. And simple.
Crafting Custom Interfaces with Sub::ExporterRicardo Signes
Everybody knows about Exporter.pm: you use it, and if someone uses your module, they don't have to type quite as much. We'll look at how the Exporter works, and how it fails to take advantage of the powerful concepts on which it's built. We'll see how you can provide flexible import routines that allow your module's user to type even less and get code that behaves much more like part of his own program. You can avoid repeating unnecessary parameters to every overly-generic routine and can avoid collision-prone global configuration. All of this is made possible -- and easy -- by Sub::Exporter.
Generators -- routines that build routines -- can produce customized code, built to each importer's specifications. Sub::Exporter lets you build and provide customized routines easily. You'll learn how to write generators, and how to use them with Sub::Exporter . In its simplest form, it's as easy to use as Exporter.pm. With just a bit more configuration, it can build, group, rename, and julienne routines easily. With this tool, you'll be able to provide interfaces that are both simpler and more powerful than those provided by the stock Exporter.
(originally presented at YAPC::Europe::2007)
No-one is as critical about something as those that love it dearly. Mark Fowler has been collecting complaints from professional Perl developers for years about what warts still remain with the language when strict and warnings are turned on.
Are these problems unsolvable? A veteran Perl programmer himself Mark attempted to try and solve these issues - and then turned to the experts, the people who write books on Perl, the people who maintain the perl interpreter itself, for help.
This is what he learned...
Postman is a tool for designing, sharing and testing APIs between a group of collaborators that range from the API developers down to the final clients, be them mobile apps or web apps.
This presentation focuses on using Postman's advanced free features, with a special focus on testing.
I have linked an example collection which I refer to several times during the presentation.
Section 1 - Fundamentals
Environments, variables, collections, and workspaces
Roles, VCS
Section 2 - Scripts & Testing
Pre request scripts and tests
Scopes
Pass data between requests
Section 3 - Integrated testing
Collection runners: read data from files, workflows
Monitors
CD/CI integration with Newman
Section 4 - More!
Documentation
Mock server
Integrations
Perl 5.10 for People Who Aren't Totally InsaneRicardo Signes
All the hype about perl 5.10 can sound a little intimidating. User-level pragmata! Overloadable smartmatching operator! Thread-safe refkey hashes! For Pete's sake, have you heard about lexically scoped pluggable regexp engines?
It's enough to make you think that 5.10's changes are just for the hard-core perl hackers, but it couldn't be further from the truth! The new version of Perl is full of changes that are easy to use and pack lots of useful benefits for doing plain old every day Perl programming.
We'll look at the new features, small and large, and see why you, too, will love 5.10.
How I Learned to Stop Worrying and Love Email::: The 2007 PEP Talk!!Ricardo Signes
Ready? 250 OK! Everybody loves email, right? Right! What better language than Perl for handling all your email needs? None, right? Right! After all, with about nine hundred email modules on the CPAN, the only question is: which tool is right for the job?
This year, the Perl Email Project is going to tell you what's what. We'll see what modules solve what problems, how they differ, and how they (may or my not) work together.
We'll also show what problems aren't well-solved, what is in the works to make it happen, and how you can help.
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!
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™UiPathCommunity
In questo evento online gratuito, organizzato dalla Community Italiana di UiPath, potrai esplorare le nuove funzionalità di Autopilot, il tool che integra l'Intelligenza Artificiale nei processi di sviluppo e utilizzo delle Automazioni.
📕 Vedremo insieme alcuni esempi dell'utilizzo di Autopilot in diversi tool della Suite UiPath:
Autopilot per Studio Web
Autopilot per Studio
Autopilot per Apps
Clipboard AI
GenAI applicata alla Document Understanding
👨🏫👨💻 Speakers:
Stefano Negro, UiPath MVPx3, RPA Tech Lead @ BSP Consultant
Flavio Martinelli, UiPath MVP 2023, Technical Account Manager @UiPath
Andrei Tasca, RPA Solutions Team Lead @NTT Data
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
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.
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
41. Example Script
$ sink --list
who | time | event
------+-------+----------------------------
rjbs | 30min | server mx-pa-1 crashed!
42. Example Script
GetOptions(%opt, ...);
if ($opt{list}) {
die if @ARGV;
@events = Events->get_all;
} else {
my ($duration, $desc) = @ARGV;
Event->new($duration, $desc);
}
43. Example Script
$ sink --list --user jcap
who | time | event
------+-------+----------------------------
jcap | 2hr | redeploy exigency subsystem
44. Example Script
GetOptions(%opt, ...);
if ($opt{list}) {
die if @ARGV;
@events = $opt{user}
? Events->get(user => $opt{user})
: Events->get_all;
} else {
my ($duration, $desc) = @ARGV;
Event->new($duration, $desc);
}
45. Example Script
GetOptions(%opt, ...);
if ($opt{list}) {
die if @ARGV;
@events = $opt{user}
? Events->get(user => $opt{user})
: Events->get_all;
} else {
my ($duration, $desc) = @ARGV;
die if $opt{user};
Event->new($duration, $desc);
}
46. Example Script
$ sink --start ‘putting out oil fire‘
Event begun! use --finish to finish event
$ sink --list --open
18. putting out oil fire
$ sink --finish 18
Event finished! Total time taken: 23 min
49. Insult to Injury
• ...well, that’s going to take a lot of
testing.
• How can we test it?
50. Insult to Injury
• ...well, that’s going to take a lot of
testing.
• How can we test it?
• my $output = `sink @args`;
51. Insult to Injury
• ...well, that’s going to take a lot of
testing.
• How can we test it?
• my $output = `sink @args`;
• IPC::Run3 (or one of those)
63. “do” command
sub run {
my ($self, $opt, $args) = @_;
my $start = parse_ago($opt->{ago});
64. “do” command
sub run {
my ($self, $opt, $args) = @_;
my $start = parse_ago($opt->{ago});
my $length = parse_duration($opt->{for});
65. “do” command
sub run {
my ($self, $opt, $args) = @_;
my $start = parse_ago($opt->{ago});
my $length = parse_duration($opt->{for});
my $desc = $args->[0];
66. “do” command
sub run {
my ($self, $opt, $args) = @_;
my $start = parse_ago($opt->{ago});
my $length = parse_duration($opt->{for});
my $desc = $args->[0];
67. “do” command
sub run {
my ($self, $opt, $args) = @_;
my $start = parse_ago($opt->{ago});
my $length = parse_duration($opt->{for});
my $desc = $args->[0];
Sink::Event->create(
68. “do” command
sub run {
my ($self, $opt, $args) = @_;
my $start = parse_ago($opt->{ago});
my $length = parse_duration($opt->{for});
my $desc = $args->[0];
Sink::Event->create(
start => $start,
69. “do” command
sub run {
my ($self, $opt, $args) = @_;
my $start = parse_ago($opt->{ago});
my $length = parse_duration($opt->{for});
my $desc = $args->[0];
Sink::Event->create(
start => $start,
finish => $start + $length,
70. “do” command
sub run {
my ($self, $opt, $args) = @_;
my $start = parse_ago($opt->{ago});
my $length = parse_duration($opt->{for});
my $desc = $args->[0];
Sink::Event->create(
start => $start,
finish => $start + $length,
desc => $desc;
71. “do” command
sub run {
my ($self, $opt, $args) = @_;
my $start = parse_ago($opt->{ago});
my $length = parse_duration($opt->{for});
my $desc = $args->[0];
Sink::Event->create(
start => $start,
finish => $start + $length,
desc => $desc;
);
72. “do” command
sub run {
my ($self, $opt, $args) = @_;
my $start = parse_ago($opt->{ago});
my $length = parse_duration($opt->{for});
my $desc = $args->[0];
Sink::Event->create(
start => $start,
finish => $start + $length,
desc => $desc;
);
73. “do” command
sub run {
my ($self, $opt, $args) = @_;
my $start = parse_ago($opt->{ago});
my $length = parse_duration($opt->{for});
my $desc = $args->[0];
Sink::Event->create(
start => $start,
finish => $start + $length,
desc => $desc;
);
print “event created!”;
74. “do” command
sub run {
my ($self, $opt, $args) = @_;
my $start = parse_ago($opt->{ago});
my $length = parse_duration($opt->{for});
my $desc = $args->[0];
Sink::Event->create(
start => $start,
finish => $start + $length,
desc => $desc;
);
print “event created!”;
}
86. “do” command
sub validate_args {
my ($self, $opt, $args) = @_;
if (@$args != 1) {
$self->usage_error(“provide one argument”);
87. “do” command
sub validate_args {
my ($self, $opt, $args) = @_;
if (@$args != 1) {
$self->usage_error(“provide one argument”);
}
88. “do” command
sub validate_args {
my ($self, $opt, $args) = @_;
if (@$args != 1) {
$self->usage_error(“provide one argument”);
}
}
89. package Sink::Command::Do;
use base ‘App::Cmd::Command’;
sub opt_desc {
[ “start=s”, “when you started doing this” ],
[ “for=s”, “how long you did this for”,
{ required => 1} ],
}
sub validate_args {
my ($self, $opt, $args) = @_;
if (@$args != 1) {
$self->usage_error(“provide one argument”);
}
}
sub run {
my ($self, $opt, $args) = @_;
my $start = parse_ago($opt->{ago});
my $length = parse_duration($opt->{for});
my $desc = $args->[0];
Sink::Event->create(
start => $start,
finish => $start + $length,
desc => $desc;
);
print “event created!”;
}
1;
90. package Sink::Command::Do;
use base ‘App::Cmd::Command’;
sub opt_desc {
[ “start=s”, “when you started doing this” ],
[ “for=s”, “how long you did this for”,
{ required => 1} ],
}
sub validate_args {
my ($self, $opt, $args) = @_;
if (@$args != 1) {
$self->usage_error(“provide one argument”);
}
}
sub run {
my ($self, $opt, $args) = @_;
my $start = parse_ago($opt->{ago});
my $length = parse_duration($opt->{for});
my $desc = $args->[0];
Sink::Event->create(
start => $start,
finish => $start + $length,
desc => $desc;
);
print “event created!”;
}
1;
103. Testing App::Cmd
use Test::More tests => 3;
use Test::Output;
my $error;
my $stdout = do {
local @ARGV = qw(do --for 8hr ‘sleeping’);
104. Testing App::Cmd
use Test::More tests => 3;
use Test::Output;
my $error;
my $stdout = do {
local @ARGV = qw(do --for 8hr ‘sleeping’);
stdout_from(sub {
105. Testing App::Cmd
use Test::More tests => 3;
use Test::Output;
my $error;
my $stdout = do {
local @ARGV = qw(do --for 8hr ‘sleeping’);
stdout_from(sub {
eval { Sink->run; 1 } or $error = $@;
106. Testing App::Cmd
use Test::More tests => 3;
use Test::Output;
my $error;
my $stdout = do {
local @ARGV = qw(do --for 8hr ‘sleeping’);
stdout_from(sub {
eval { Sink->run; 1 } or $error = $@;
});
107. Testing App::Cmd
use Test::More tests => 3;
use Test::Output;
my $error;
my $stdout = do {
local @ARGV = qw(do --for 8hr ‘sleeping’);
stdout_from(sub {
eval { Sink->run; 1 } or $error = $@;
});
}
108. Testing App::Cmd
use Test::More tests => 3;
use Test::Output;
my $error;
my $stdout = do {
local @ARGV = qw(do --for 8hr ‘sleeping’);
stdout_from(sub {
eval { Sink->run; 1 } or $error = $@;
});
}
109. Testing App::Cmd
use Test::More tests => 3;
use Test::Output;
my $error;
my $stdout = do {
local @ARGV = qw(do --for 8hr ‘sleeping’);
stdout_from(sub {
eval { Sink->run; 1 } or $error = $@;
});
}
like $stdout, qr/^event created!$/;
110. Testing App::Cmd
use Test::More tests => 3;
use Test::Output;
my $error;
my $stdout = do {
local @ARGV = qw(do --for 8hr ‘sleeping’);
stdout_from(sub {
eval { Sink->run; 1 } or $error = $@;
});
}
like $stdout, qr/^event created!$/;
is Sink::Event->get_count, 1;
111. Testing App::Cmd
use Test::More tests => 3;
use Test::Output;
my $error;
my $stdout = do {
local @ARGV = qw(do --for 8hr ‘sleeping’);
stdout_from(sub {
eval { Sink->run; 1 } or $error = $@;
});
}
like $stdout, qr/^event created!$/;
is Sink::Event->get_count, 1;
ok ! $error;
112. Testing App::Cmd
use Test::More tests => 3;
use Test::App::Cmd;
use Sink;
my ($stdout, $error) = test_app(
Sink => qw(do --for 8hr ‘sleeping’)
);
like $stdout, qr/^event created!$/;
is Sink::Event->get_count, 1;
ok ! $error;
113. Testing App::Cmd
use Test::More tests => π;
use Sink::Command::Do;
eval {
Sink::Command::Do->validate_args(
{ for => ‘1hr’ },
[ 1, 2, 3 ],
);
};
like $@, qr/one arg/;
118. package Sink::Command::List;
use base ‘App::Cmd::Command’;
sub opt_desc {
[ “open”, “only unfinished events” ],
[ “user|u=s”, “only events for this user” ],
}
sub validate_args {
shift->usage_error(’no args allowed’)
if @{ $_[1] }
}
sub run { ... }
1;
120. package Sink::Command::Start;
use base ‘App::Cmd::Command’;
sub opt_desc { return }
sub validate_args {
shift->usage_error(’one args required’)
if @{ $_[1] } != 1
}
sub run { ... }
1;
121. More Commands!
$ sink do --for 1hr --ago 1d ‘rebuild raid’
$ sink list --open
$ sink start ‘porting PHP to ASP.NET’
122. More Commands!
$ sink
sink help <command>
Available commands:
commands: list the application’s commands
help: display a command’s help screen
do: (unknown)
list: (unknown)
start: (unknown)
125. Command Listing
$ sink commands
Available commands:
commands: list the application’s commands
help: display a command’s help screen
do: record that you did something
list: list existing events
start: start a new task