Suchergebnisse mit Tag „perl“

TOP

More Perl variable & block secrets

I wrote about Perl variable declaration secrets recently, but there's much more. Perl has a very simple way for passing variables to subs which should be called later.

Weiterlesen
TOP

Perl variable declaration secrets

Perl has a very flexible variable concept. One might use different namespaces, called "packages" or use all variables global without defining them. Another way to use variables is more Cish where every single variable must be declared before it's used.

Weiterlesen
TOP

Parallel DNS lookups using AnyEvent

Perl has a great asynchronous library: AnyEvent. (There may be even more great asynchronous libraries, but it decided to use AnyEvent.) I recently had to lookup a lot of different hostnames and didn't want to do it sequentially (because every single DNS server might be down or wait until the reply is received).

Weiterlesen
TOP

Perl -M-A-C tests

Perl supports various tests for file and directory states. Most are identical to their bash test siblings, but some additional are supported, like -M, -A and -C.

Weiterlesen
TOP

Setting up DKIM email signatures with Perl

DKIM may be called as PGP successor: PGP has been used by many people for signing their emails at a time when mostly technical related people had been using the internet. Today, few people still use PGP to sign their emails, but email servers took over this part using a technology called DKIM.

Weiterlesen
TOP

The five faces of a Perl hash item

PHP calls it associative array, JavaScript calls it object and - in the eyes of other (older) languages like C, BASIC, Pascal or Perl - all of them are wrong. An array has some items which may be addressed using their position in the list, but only a Perl hash has named keys. A hash is basically an (unordered) list of items where each item has a key and a value - but that value may have one of many different states.

Weiterlesen
TOP

Digest::SHA1 Workaround

MovableType is still using the old, deprecated Digest::SHA1 module in some versions. Using the newer Digest::SHA is recommended and MT will switch in future versions, but Digest::SHA1 is currently still required for commentor logins in some versions.

Weiterlesen
TOP

Cookie __atrfs and CGI::PSGI problems

Some websites stopped working today or at least some cookie-based functions ran out-of-order. Deleting all cookies helps - but is no solution. A cookie called __atrfs set by the famous AddThis! service is responsible for this.

Weiterlesen
TOP

Remote debugging Perl scripts without SSH access

I'm used to use dedicated or at least virtual servers for projects, but currently, I'm working on two projects which are using simple webspace instead without SSH access. A cgi-bin directory is all you need for Perl, but what happens, if a script dies without an error message?
Weiterlesen
TOP

Retry failed Gearman jobs

Gearman is a great tool for farmed or distributed work. It's some kind of basic cloud handling: Many Worker processes (usually running on many different servers) are waiting for jobs to process and there's (hopefully) always another worker taking over if one worker (server) should ever die. But what happens, if a single job dies and should be repeated?
Weiterlesen
TOP

Setting up MovableType on a basic webspace

A MovableType installation isn't that easy like a WordPress upload, but it has many advantages. This is a little tutorial for setting up MovableType on a basic webspace without SSH access.
Weiterlesen
TOP

Quick JSON pretty reformatter / JSON-tidy

JSON is a commonly used format for data transmission, especially with Ajax calls. It's more structured and easier to process then XML, but could be just a wall of text depending on the creator. This oneliner reformats JSON to look pretty and human-readable.
Weiterlesen
TOP

End tag mismatch - MovableType WordPress Import

I tried MovableType just before setting up WordPress for this blog. It didn't offer the features I wanted (okay, WordPress still doesn't have them, but it promised to have them and so it won). After trying out MT again, I want to have it. But what about my existing articles, comments, settings? That's (the only reason) why I'm still using WordPress.
Weiterlesen
TOP

Connecting to Sybase ASE with Perl's DBI

CPAN has everything. Nearly everything and one of the modules is DBD::Sybase which connects to Microsoft SQL servers as well as Sybase ASE and iAnywhere servers, but there's a trick.
Weiterlesen
TOP

Session-Trouble

Why should I write about sessioning at all? A session is something which exists and should be as easy usable as possible. Is this the end of my blog post about sessioning?
Weiterlesen
TOP

defining undef

MS-DOS basic variants had fixed default values for variables, "empty" for string variables and "0" for numbers. DATABUS (now DB/C) variables used to have unpredictable content unless initialized with an empty value and Pascal - as far as I remember - also had default values. Perl doesn't distinguish between text and numbers but it has a default value for all scalars: undef.
Weiterlesen
TOP

Expensive join

How to concat an array into a string? Perl is TIMTOWTDI and I could imagine two common ways - but which one is the best?
Weiterlesen
TOP

Age check with Perl

Kids are discriminated for being kids. They're not allowed to smoke, drink alcohol and use various internet offers. but writing "not for kids" on a homepage barely fulfills legal and real life requirements, software has to calculate the age based on a known date of birth.
Weiterlesen
TOP

Which ORM for Dancer and MongoDB?

I recently started my first Dancer & MongoDB project. MongoDB is my preferred database (at the moment) and Dancer is a great framework, but something is missing: I really prefer using an ORM and didn't find anything for MongoDB which fits my needs.
Weiterlesen
TOP

Cronjobs on the Dancer floor

Did you find a typo in the title? No? You're right. I recently started to love the Perl Dancer Framework - and tried to write my first cronjob for a Dancer based project today.
Weiterlesen