perl 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #------------------------------------------------------------------------------
  2. # $File: perl,v 1.21 2013/12/08 23:33:18 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>
  8. 0 search/1 eval\ "exec\ /bin/perl Perl script text
  9. !:mime text/x-perl
  10. 0 search/1 eval\ "exec\ /usr/bin/perl Perl script text
  11. !:mime text/x-perl
  12. 0 search/1 eval\ "exec\ /usr/local/bin/perl Perl script text
  13. !:mime text/x-perl
  14. 0 search/1 eval\ '(exit\ $?0)'\ &&\ eval\ 'exec Perl script text
  15. !:mime text/x-perl
  16. 0 search/1 #!/usr/bin/env\ perl Perl script text executable
  17. !:mime text/x-perl
  18. 0 search/1 #!\ /usr/bin/env\ perl Perl script text executable
  19. !:mime text/x-perl
  20. 0 search/1 #!
  21. >0 regex \^#!.*/bin/perl$ Perl script text executable
  22. !:mime text/x-perl
  23. # by Dmitry V. Levin and Alexey Tourbin
  24. # check the first line
  25. 0 search/1 package
  26. >0 regex \^package[\ \t]+[0-9A-Za-z_:]+\ *; Perl5 module source text
  27. !:strength + 10
  28. # not 'p', check other lines
  29. 0 search/1 !p
  30. >0 regex \^package[\ \t]+[0-9A-Za-z_:]+\ *;
  31. >>0 regex \^1\ *;|\^(use|sub|my)\ .*[(;{=] Perl5 module source text
  32. !:strength + 10
  33. # Perl POD documents
  34. # From: Tom Hukins <tom@eborcom.com>
  35. 0 search/1/W \=pod\n Perl POD document text
  36. 0 search/1/W \n\=pod\n Perl POD document text
  37. 0 search/1/W \=head1\ Perl POD document text
  38. 0 search/1/W \n\=head1\ Perl POD document text
  39. 0 search/1/W \=head2\ Perl POD document text
  40. 0 search/1/W \n\=head2\ Perl POD document text
  41. 0 search/1/W \=encoding\ Perl POD document text
  42. 0 search/1/W \n\=encoding\ Perl POD document text
  43. # Perl Storable data files.
  44. 0 string perl-store perl Storable (v0.6) data
  45. >4 byte >0 (net-order %d)
  46. >>4 byte &01 (network-ordered)
  47. >>4 byte =3 (major 1)
  48. >>4 byte =2 (major 1)
  49. 0 string pst0 perl Storable (v0.7) data
  50. >4 byte >0
  51. >>4 byte &01 (network-ordered)
  52. >>4 byte =5 (major 2)
  53. >>4 byte =4 (major 2)
  54. >>5 byte >0 (minor %d)