xref: /freebsd/contrib/file/magic/Magdir/perl (revision e5b786625f7f82a1fa91e41823332459ea5550f9)
1#------------------------------------------------------------------------------
2# $File: perl,v 1.27 2023/07/17 16:01:36 christos Exp $
3# perl:  file(1) magic for Larry Wall's perl language.
4#
5# The `eval' lines recognizes an outrageously clever hack.
6# Keith Waclena <keith@cerberus.uchicago.edu>
7# Send additions to <perl5-porters@perl.org>
80	search/1024	eval\ "exec\ perl		Perl script text
9!:mime	text/x-perl
100	search/1024	eval\ "exec\ /bin/perl		Perl script text
11!:mime	text/x-perl
120	search/1024	eval\ "exec\ /usr/bin/perl	Perl script text
13!:mime	text/x-perl
140	search/1024	eval\ "exec\ /usr/local/bin/perl	Perl script text
15!:mime	text/x-perl
160	search/1024	eval\ 'exec\ perl		Perl script text
17!:mime	text/x-perl
180	search/1024	eval\ 'exec\ /bin/perl		Perl script text
19!:mime	text/x-perl
200	search/1024	eval\ 'exec\ /usr/bin/perl	Perl script text
21!:mime	text/x-perl
220	search/1024	eval\ 'exec\ /usr/local/bin/perl	Perl script text
23!:mime	text/x-perl
240	search/1024	eval\ '(exit\ $?0)'\ &&\ eval\ 'exec	Perl script text
25!:mime	text/x-perl
260	string	#!/usr/bin/env\ perl	Perl script text executable
27!:mime	text/x-perl
280	string	#!\ /usr/bin/env\ perl	Perl script text executable
29!:mime	text/x-perl
300	string	#!
31>0	regex	\^#!.*/bin/perl([[:space:]].*)*$	Perl script text executable
32!:mime	text/x-perl
33
34# by Dmitry V. Levin and Alexey Tourbin
35# check the first line
360	search/8192	package
37>0	regex		\^package[[:space:]]+[0-9A-Za-z_:]+[[:space:]]*([[:space:]]v?[0-9][0-9.]*)?[[:space:]]*;	Perl5 module source text
38!:strength + 40
39# not 'p', check other lines
400	search/8192	!p
41>0	regex		\^package[[:space:]]+[0-9A-Za-z_:]+[[:space:]]*([[:space:]]v?[0-9][0-9.]*)?[[:space:]]*;
42>>0	regex		\^1[[:space:]]*;|\^(use|sub|my)[[:space:]].*[(;{=]	Perl5 module source text
43!:strength + 75
44
45# Perl POD documents
46# From: Tom Hukins <tom@eborcom.com>
470	search/1024/W	\=pod\n		Perl POD document text
480	search/1024/W	\n\=pod\n	Perl POD document text
490	search/1024/W	\=head1\ 	Perl POD document text
500	search/1024/W	\n\=head1\ 	Perl POD document text
510	search/1024/W	\=head2\ 	Perl POD document text
520	search/1024/W	\n\=head2\ 	Perl POD document text
530	search/1024/W	\=encoding\ 	Perl POD document text
540	search/1024/W	\n\=encoding\ 	Perl POD document text
55
56
57# Perl Storable data files.
580	string	perl-store	perl Storable (v0.6) data
59>4	byte	>0	(net-order %d)
60>>4	byte	&01	(network-ordered)
61>>4	byte	=3	(major 1)
62>>4	byte	=2	(major 1)
63
640	string	pst0	perl Storable (v0.7) data
65>4	byte	>0
66>>4	byte	&01	(network-ordered)
67>>4	byte	=5	(major 2)
68>>4	byte	=4	(major 2)
69>>5	byte	>0	(minor %d)
70
71# This is Debian #742949 by Zefram <zefram@fysh.org>:
72# -----------------------------------------------------------
73# The Perl module Hash::SharedMem
74# <https://metacpan.org/release/Hash-SharedMem> defines a file format
75# for a key/value store.  Details of the file format are in the "DESIGN"
76# file in the module distribution.  Magic:
770	bequad	=0xa58afd185cbf5af7	Hash::SharedMem master file, big-endian
78>8	bequad	<0x1000000
79>>15	byte	>2	\b, line size 2^%d byte
80>>14	byte	>2	\b, page size 2^%d byte
81>>13	byte	&1
82>>>13	byte	>1	\b, max fanout %d
830	lequad	=0xa58afd185cbf5af7	Hash::SharedMem master file, little-endian
84>8	lequad	<0x1000000
85>>8	byte	>2	\b, line size 2^%d byte
86>>9	byte	>2	\b, page size 2^%d byte
87>>10	byte	&1
88>>>10	byte	>1	\b, max fanout %d
890	bequad	=0xc693dac5ed5e47c2	Hash::SharedMem data file, big-endian
90>8	bequad	<0x1000000
91>>15	byte	>2	\b, line size 2^%d byte
92>>14	byte	>2	\b, page size 2^%d byte
93>>13	byte	&1
94>>>13	byte	>1	\b, max fanout %d
950	lequad	=0xc693dac5ed5e47c2	Hash::SharedMem data file, little-endian
96>8	lequad	<0x1000000
97>>8	byte	>2	\b, line size 2^%d byte
98>>9	byte	>2	\b, page size 2^%d byte
99>>10	byte	&1
100>>>10	byte	>1	\b, max fanout %d
101