r/perl

Help with Tickit::Console: suppress ribbon display
▲ 7 r/perl

Help with Tickit::Console: suppress ribbon display

Hi Readers

A rather specialized question, but here goes:

I'm working on a terminal app, recently migrating from readline to Paul Evan's Tickit framework. I like the multiple tabs feature from Tickit::Console, however would like to hide the ribbon. I'm looking through the sources, and although the answer must be in plain sight, I could some help, at least a hint. Also, if there is a better forum or irc channel for the question, please let me know.

u/bonkly68 — 1 day ago
▲ 16 r/perl

Announcing DateTime::Lite v0.7.0 - 日本語ドキュメント追加・新機能リリース / Japanese documentation & new features (English follows)

Announcing DateTime::Lite v0.7.0 - 日本語ドキュメント追加・新機能リリース / Japanese documentation & new features (English follows)


日本語

Perlコミュニティの皆さん、こんにちは。

DateTime::Lite v0.7.0をCPANにリリースしましたので、お知らせします。

日本語PODドキュメント

今回のリリースの目玉は、すべてのモジュールに日本語のPODドキュメントを追加したことです。

日本語でのPerlコミュニティに少しでも貢献できれば幸いです。日本に25年在住していても間違いの可能性がありますので、ドキュメントの誤りや改善点があれば、是非遠慮なくフィードバックをお寄せください。

新メソッド:extended_aliases

DateTime::Lite::TimeZoneextended_aliases()メソッドを追加しました。これはJST、CET、ESTのようなタイムゾーン略称から、対応するIANA正規タイムゾーン名へのマッピングを返します。

my $aliases = DateTime::Lite::TimeZone->extended_aliases;
# {
#     'JST' => 'Asia/Tokyo',
#     'CET' => 'Europe/Paris',
#     'EST' => 'America/New_York',
#     ...
# }

aliases()と同様に、スカラーコンテキストではハッシュリファレンスを、リストコンテキストではハッシュを返します。

このメソッドにより、単純なオフセット文字列しか返さないDateTime::TimeZone::Catalog::Extendへの依存が不要になります。extended_aliases()はIANA正規ゾーン名を返すため、過去のDST履歴も含めた完全なタイムゾーン情報が利用できます。

コンストラクタの引数バリデーション強化(v0.6.7より)

前回のリリースv0.6.7で、コンストラクタに不明な引数が渡された場合にエラーを返すようになりました。例えば、yearsの代わりにyearを渡すようなタイポが、エラーなしに無視されることがなくなりました。

# 以前は無視されていた(結果が変わらず気づきにくいバグ)
my $dur = DateTime::Lite::Duration->new( year => 1 );  # 'years'の誤り

# 現在はエラーを返す
if( !defined( $dur ) )
{
    warn DateTime::Lite::Duration->error;
    # "Unknown argument passed to DateTime::Lite::Duration->new: 'year'"
}

対象コンストラクタ:DateTime::Lite->new()from_epoch()from_object()from_day_of_year()last_day_of_month()DateTime::Lite::Duration->new()DateTime::Lite::TimeZone->new()

リンク

フィードバック、バグ報告、プルリクエストなどを大歓迎。


English

Hello all,

I am happy to announce the release of DateTime::Lite v0.7.0 on CPAN.

Japanese POD documentation

The main highlight of this release is the addition of Japanese POD documentation for all modules:

I hope this makes DateTime::Lite more accessible to Japanese Perl developers. Feedback on the documentation, corrections, and improvements are very much welcome.

New method: extended_aliases

DateTime::Lite::TimeZone now provides an extended_aliases() method, returning a mapping from timezone abbreviations such as JST, CET, or EST to their corresponding canonical IANA timezone names:

my $aliases = DateTime::Lite::TimeZone->extended_aliases;
# {
#     'JST' => 'Asia/Tokyo',
#     'CET' => 'Europe/Paris',
#     'EST' => 'America/New_York',
#     ...
# }

Like aliases(), it returns a hash reference in scalar context and a hash in list context.

This method supersedes DateTime::TimeZone::Catalog::Extend, which only returned plain UTC offset strings. extended_aliases() returns canonical IANA zone names, giving you access to full timezone information including historical DST data.

Constructor argument validation (since v0.6.7)

Since v0.6.7, all constructors return an error when an unrecognised argument is supplied, rather than silently ignoring it. This catches typos such as year instead of years that previously produced incorrect results with no indication of error:

# Previously silently ignored
my $dur = DateTime::Lite::Duration->new( year => 1 );  # typo for 'years'

# Now returns an error
if( !defined( $dur ) )
{
    warn DateTime::Lite::Duration->error;
    # "Unknown argument passed to DateTime::Lite::Duration->new: 'year'"
}

This covers DateTime::Lite->new(), from_epoch(), from_object(), from_day_of_year(), last_day_of_month(), DateTime::Lite::Duration->new(), and DateTime::Lite::TimeZone->new().

Links

Feedback, bug reports, and pull requests are very welcome.

u/jacktokyo — 2 days ago
▲ 14 r/perl

wrote a perl script that indexes youtube video transcripts into sqlite and a mojolicious app to search them. one script, one app, no nonsense

i work at an engineering firm and we have about 150 youtube videos. recorded lunch and learns, vendor product demos, safety training sessions, project retrospectives people recorded for the next team. everything is unlisted and shared through a confluence page with links sorted by date. finding anything means scrolling through a list of links with titles like "Recording - March 14" and hoping you click the right one.

i wrote a perl script to make them searchable last friday afternoon.

the ingestion script takes a text file of youtube urls. for each url it pulls the full transcript, then inserts it into a sqlite database along with the video title, date, presenter, tags, and the youtube link. the database has a regular table for metadata and an FTS5 virtual table for the transcript text.

for pulling transcripts i use transcript api:

npx skills add ZeroPointRepo/youtube-skills --skill youtube-full

the script uses LWP::UserAgent to call the api and JSON::PP to parse the response. DBI with DBD::SQLite for the database. the insert does both tables in a single transaction. the whole ingestion script is about 60 lines and most of that is the argument parsing with Getopt::Long.

the search app is mojolicious::lite. one route for the search page, one route for the query. the query runs a MATCH against the FTS5 table and uses snippet() to pull the transcript excerpt around the match. results come back with the video title, date, presenter, and the snippet with the match highlighted. the template is inlined in the script with DATA so the entire app is one file.

morbo search.pl

and it's running. deployed it on a linux box we use for internal tools by switching morbo for hypnotoad. the whole app including the template is maybe 80 lines.

the thing i appreciate about this project is that it's exactly the kind of problem perl was made for. take some data from an api, shove it in a database, put a small web interface on it. no framework decisions, no dependency management headaches, no build step. LWP, DBI, Mojo, JSON. stuff that's been stable for years and will keep working without me touching it.

about 150 videos indexed. the engineers use it before project kickoffs to find out if a previous team recorded a retrospective on a similar project. the safety team uses it to verify specific topics were covered in training recordings. one of the senior engineers told me it saved him from rewatching a 2 hour vendor demo because he searched for the specific integration he needed and found the 3 minute section where the vendor covered it.

reddit.com
u/scheemunai_ — 2 days ago
▲ 13 r/perl

How do I use Perl on web servers like PHP?

In PHP, you can just create /var/www/index.php and, given a properly configured server with FPM, it will just work. No separate process to manage, no reverse proxying. And since this is such a common setup, the server configuration is damn-near trivial (for debian you basically have to uncomment a few lines from the default nginx config files).

What is the Perl equivalent of this type of web development? I.e. what lets me just write a file that outputs html, drop it somewhere in the filesystem, and it "just work" without having to worry about anything else? Is there any alternative to CGI.pm?

Yes, I know this is hardly the way-you're-supposed-to-do-it in the 21st century, please skip the lecture.

reddit.com
u/gruntastics — 4 days ago
▲ 14 r/perl

Trying to install perl on a friend's PC

I'm trying to install Strawberry Perl (5.42.2.1) on a friend's PC and it keeps throwing up these scary malware warnings and keeps asking if we're sure, and the publisher is "Unknown".

We got it from what at least looks like the official website* so idk why this is happening.

She also asked if we can install it in Program files because that's where Java seems to be installed as well, but it said it can't install it there because of special characters?

*https://strawberryperl.com/releases.html

reddit.com
u/Terrible_Effective84 — 12 days ago
▲ 15 r/perl

Concerns about how developing a Perl version of the existing project might affect my career

I cannot disclose exactly what the project is, but I previously built both Windows and Linux versions of a project based on the same concept.

The Windows version of this project was written in JavaScript, while the Linux version was written in Perl.

The Windows version was developed in JavaScript. Since it targeted a specific industrial runtime environment, the language level was closer to ES3, so I used polyfills to bring it closer to ES5-level functionality.

It turned out to be quite successful, receiving around 450 stars on GitHub and even winning an award from the local community.

As I started thinking about taking things a step further, Perl began to catch my attention.

Because I want my career to continue growing, I often wonder whether a Linux version written in Perl could have enough potential, just like the earlier JS (ES3)-based version did.

The concern is whether choosing Perl over currently popular languages like JavaScript or Python might negatively affect my career.

If I move forward with it, I expect the Perl-based project to have somewhat different goals from the original project. However, it would still share many of the same characteristics as the previous one.

It could succeed, but it could also fail to attract attention and end up going nowhere.

Even so, I would like to hear opinions on whether Perl could still be a worthwhile option to explore.

reddit.com
u/gnh1201 — 12 days ago