perl 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #------------------------------------------------------------------------------
  2. # $File: perl,v 1.17 2011/12/16 16:24:40 rrt 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. # not 'p', check other lines
  31. 0 search/1 !p
  32. >0 regex \^package[\ \t]+[0-9A-Za-z_:]+\ *;
  33. >>0 regex \^1\ *;|\^(use|sub|my)\ .*[(;{=] Perl5 module source text
  34. # Perl POD documents
  35. # From: Tom Hukins <tom@eborcom.com>
  36. 0 search/1/W \=pod\n Perl POD document text
  37. 0 search/1/W \n\=pod\n Perl POD document text
  38. 0 search/1/W \=head1\ Perl POD document text
  39. 0 search/1/W \n\=head1\ Perl POD document text
  40. 0 search/1/W \=head2\ Perl POD document text
  41. 0 search/1/W \n\=head2\ Perl POD document text
  42. # Perl Storable data files.
  43. 0 string perl-store perl Storable (v0.6) data
  44. >4 byte >0 (net-order %d)
  45. >>4 byte &01 (network-ordered)
  46. >>4 byte =3 (major 1)
  47. >>4 byte =2 (major 1)
  48. 0 string pst0 perl Storable (v0.7) data
  49. >4 byte >0
  50. >>4 byte &01 (network-ordered)
  51. >>4 byte =5 (major 2)
  52. >>4 byte =4 (major 2)
  53. >>5 byte >0 (minor %d)