CARVIEW |
Select Language
HTTP/1.1 200 OK
Date: Sat, 11 Oct 2025 00:54:04 GMT
Server: Apache/2.4.62 (Debian)
Vary: Accept-Encoding
Content-Encoding: gzip
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Security-Policy: default-src: https: 'unsafe-inline'
Strict-Transport-Security: max-age=7776000; includeSubDomains
Content-Length: 2817
Content-Type: text/html; charset=UTF-8
blog | Perlgeek.de :: Small Perl Helpers
Permanent link
Perl Programming | blog
Tue, 09 Jun 2009
Small Perl Helpers
Permanent link
CoreList
You want to use a module, but you're only allowed to use core modules? Or you want to recommend a module to somebody, and you know it's more likely that he'll use a module if it's in core (and thus he won't hand-roll his crappy CGI parser, and open a wide door to spammers)?
Module::CoreList is
the answer, and it comes with a very handy script called
corelist
:
$ corelist Unicode::Normalize Unicode::Normalize was first released with perl 5.007003 $ corelist DBI DBI was not in CORE (or so I think) # search with regexes $ corelist /Tie/ Pod::Simple::TiedOutFH was first released with perl 5.009003 Tie::Array was first released with perl 5.005 Tie::File was first released with perl 5.007003 Tie::Handle was first released with perl 5.00405 Tie::Hash was first released with perl 5.002 Tie::Hash::NamedCapture was first released with perl 5.009005 Tie::Memoize was first released with perl 5.007003 Tie::RefHash was first released with perl 5.004 Tie::Scalar was first released with perl 5.002 Tie::StdHandle was first released with perl 5.01 Tie::SubstrHash was first released with perl 5.002 TieHash was first released with perl 5
(empty lines sanitized; corelist emits an empty line after each module which is a bit annoying)
Timestamps
Not from CPAN, but a tiny script I wrote:
#!/usr/bin/perl use strict; use warnings; use Time::Local qw(timelocal); if (@ARGV) { my $date = shift @ARGV; if ($date =~ m/^(\d{4})-(\d\d)-(\d\d)$/){ my ($year, $month, $mday) = ($1, $2, $3); my ($hr, $min, $sec) = (0, 0, 0); my $time; if ($time = shift(@ARGV) and $time =~ m/^(\d{1,2}):(\d\d)(?::(\d\d))?$/) { ($hr, $min, $sec) = ($1, $2, $3||0); } print timelocal($sec, $min, $hr, $mday, $month - 1, $year - 1900), $/; } } else { print time, $/; }
If called with no argument it will print the current time as a Unix
timestamp. If called with one or two arguments, it will interpret these as a
date in the YYYY-MM-DD
and a time in HH:MM:SS
format
and print the corresponding timestamp.
Copyright 2008 - 2016: Moritz Lenz
This page may be used under the terms of the Creative Commons Attribution 3.0 Germany License. Please place a link to the pages you use for your derivative work.
Layout based on YAML, powered by mowyw and blosxom
This page may be used under the terms of the Creative Commons Attribution 3.0 Germany License. Please place a link to the pages you use for your derivative work.
Layout based on YAML, powered by mowyw and blosxom