Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the apostrophe sign a valid path separator in Perl

Tags:

syntax

perl

In Perl, you call modules using :: as path separator. So, if you have a module on site/lib/GD/Image.pm, you call use GD::Image.

However, long time ago I found out that you can also call use GD'Image and things like my $img = new GD'Image;, and there are also modules on CPAN using that syntax on ther names/documentation.

What is the purpose or logic behind that? Is it maybe, as many things in Perl, just a feature intended to humanize sentences and allow you to create and use modules like Acme::Don't?

Does it have any other intention different to ::?

like image 556
Francisco Zarabozo Avatar asked Apr 05 '13 14:04

Francisco Zarabozo


2 Answers

See perlmod for explanation:

The old package delimiter was a single quote, but double colon is now the preferred delimiter

So, the reason is history.

like image 181
choroba Avatar answered Oct 24 '22 18:10

choroba


The single quote is an old ADA separator. However, it didn't play well with Emacs, so the double colon became used.

Good God! ADA? Emacs? I am old.

like image 29
David W. Avatar answered Oct 24 '22 18:10

David W.