Perl 6 Alerts
keeping up to date with important changes
← back
Table of Contents
API Implementations
Perl 6 implementations of this site's API exist in the form of
WWW::P6lert
module as well as a
p6lert
command
line utility that lets you view new alerts on your command line.
API Documentation
This site offers its data via JSON API endpoint. You can use any HTTPS client
and JSON decoder. The examples on this page will use
WWW
module.
Alert Object Structure
The JSON object of alerts returned by all endpoints is this:{
"id": 3,
"alert": "OMG!!!! STUFF IS ON FIRE!!!",
"severity": "critical",
"affects": "Rakudo 2017.12 and earlier",
"time": 1514320218,
"creator": "Zoffix Znet"
}
All properties are allways present.
id
- unique ID of the alert - type:UInt
alert
- full text of the alert - type:Str
severity
- severity of the alert - type:Str
with possible values ofinfo
,low
normal
,high
, andcritical
time
- a Unix epoch time of when the alert was issued - type:UInt
affects
- free-form, possibly-empty text describing what the alert affects (e.g. compiler version, parts of infrastructure, etc.) - type:Str
creator
- name of the creator of the alert, or stringAnonymous
if creator is not known to the site - type:Str
All Alerts
To fetch all alerts, use
https://alerts.perl6.org/api/v1/all. The alert
objects will be available as an array in alerts
property:
use WWW;
my @alerts := jget('https://alerts.perl6.org/api/v1/all')<alerts>;
for @alerts {
say join ' | ', "ID#{.<id>}", DateTime.new(.<time>),
"severity: {.<severity>}";
say join ' | ', ("affects: {.<affects>}" if .<affects>),
"posted by: {.<creator>}";
say .<alert>;
say();
}
# OUTPUT:
# ID#5 | 2017-12-26T21:52:34Z | severity: info
# affects: Rakudo 2017.12 and earlier | posted by: Zoffix Znet
# wooots
#
# ID#4 | 2017-12-26T20:30:28Z | severity: info
# affects: Rakudo 2017.12 and earlier | posted by: Zoffix Znet
# Released some stuff
#
# ID#3 | 2017-12-26T20:30:18Z | severity: critical
# affects: Rakudo 2017.12 and earlier | posted by: Zoffix Znet
# OMG!!!! STUFF IS ON FIRE!!!
Last N Alerts
To fetch most recent N alerts, use
https://alerts.perl6.org/api/v1/last/$N, where $N
is a UInt
below 1,000,000 indicating how many most recent alerts you want to fetch.
The alert objects will be available as an array in alerts
property:
use WWW;
my @alerts := jget('https://alerts.perl6.org/api/v1/last/2')<alerts>;
for @alerts {
say join ' | ', "ID#{.<id>}", DateTime.new(.<time>),
"severity: {.<severity>}";
say join ' | ', ("affects: {.<affects>}" if .<affects>),
"posted by: {.<creator>}";
say .<alert>;
say();
}
# OUTPUT:
# ID#5 | 2017-12-26T21:52:34Z | severity: info
# affects: Rakudo 2017.12 and earlier | posted by: Zoffix Znet
# wooots
#
# ID#4 | 2017-12-26T20:30:28Z | severity: info
# affects: Rakudo 2017.12 and earlier | posted by: Zoffix Znet
# Released some stuff
Alerts Since…
To fetch all alerts that were posted since a certain point of time, use
https://alerts.perl6.org/api/v1/since/$UNIX_EPOCH_TIME,
where $UNIX_EPOCH_TIME
is a UInt
with Unix epoch time
indicating non-inclusive time since which to fetch alerts from.
The alert objects will be available in a possibly-empty array in
alerts
property:
use WWW;
my $time = DateTime.now.earlier(:3days).Instant.to-posix.head.Int;
if jget("https://alerts.perl6.org/api/v1/since/$time").self<alerts> {
for @^alerts {
say join ' | ', "ID#{.<id>}", DateTime.new(.<time>),
"severity: {.<severity>}";
say join ' | ', ("affects: {.<affects>}" if .<affects>),
"posted by: {.<creator>}";
say .<alert>;
say();
}
}
else {
say "No new alerts since {DateTime.new: $time}";
}
# OUTPUT:
# No new alerts since 2017-12-24T09:14:18.684577Z
# ALERTNATIVE OUTPUT:
# ID#5 | 2017-12-26T21:52:34Z | severity: info
# affects: Rakudo 2017.12 and earlier | posted by: Zoffix Znet
# wooots
#
# ID#4 | 2017-12-26T20:30:28Z | severity: info
# affects: Rakudo 2017.12 and earlier | posted by: Zoffix Znet
# Released some stuff
A Specific Alert
To fetch a specific alert, use
https://alerts.perl6.org/api/v1/alert/$ALERT_ID,
where $ALERT_ID
is a UInt
containing the unique ID
of the alert you wish to retrieve.
The end-point will return 404
error if alert is not found or
a JSON object where the alert object is available in
alert
property:
use WWW;
my $id = prompt 'Enter alert ID to fetch: ';
with jget("https://alerts.perl6.org/api/v1/alert/$id")<alert> {
say join ' | ', "ID#{.<id>}", DateTime.new(.<time>),
"severity: {.<severity>}";
say join ' | ', ("affects: {.<affects>}" if .<affects>),
"posted by: {.<creator>}";
say .<alert>;
}
else {
$^e.exception.message.say;
}
# OUTPUT:
# Enter alert ID to fetch: 42
# Error 404: 404 Not Found
# ALERTNATIVE OUTPUT:
# Enter alert ID to fetch: 5
# ID#5 | 2017-12-26T21:52:34Z | severity: info
# affects: Rakudo 2017.12 and earlier | posted by: Zoffix Znet
# wooots
JavaScript Widget
You can embed this JavaScript widget on your website to show latest Perl 6 alerts:
<script src="https://alerts.perl6.org/widget.js"></script>
The widget will look like this:
You can apply custom styling using these CSS selectors (you may need to apply
!important
to some rules, to override the inline styles provided by the widget):
#p6lert - <div> surrounding the widget
#p6lert ul - the list of alerts
#p6lert li - individual alert
.p6lert-info-bar - alert's info bar (ID, severity, and 'affects' info)
.p6lert-info-bar - alert's info bar (ID, severity, and 'affects' info)
[class^="p6lert-severity"] - severity info
[class^="p6lert-severity"] span - severity info's "severity: " label (hidden by default)
.p6lert-affects-info -- "info" severity
.p6lert-affects-low -- "low" severity
.p6lert-affects-normal -- "normal" severity
.p6lert-affects-high -- "high" severity
.p6lert-affects-critical -- "critical" severity
.p6lert-affects - "affects" info
.p6lert-affects span - "affects" info's "affects: " label
#p6lert ul p - alert text itself
#p6lert > p - widget title text
#p6lert > p a - widget title text's link
The widget fetches 10 most recent alerts. This amount is not configurable, although you can use CSS to display fewer alerts:
#p6lert li:nth-child(n+4) { display: none; } /* show only 3 alerts */