perl 2.1 KB

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