perl 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #------------------------------------------------------------------------------
  2. # perl: file(1) magic for Larry Wall's perl language.
  3. #
  4. # The `eval' lines recognizes an outrageously clever hack.
  5. # Keith Waclena <keith@cerberus.uchicago.edu>
  6. # Send additions to <perl5-porters@perl.org>
  7. 0 search/1/b #!\ /bin/perl Perl script text executable
  8. !:mime text/x-perl
  9. 0 search/1 eval\ "exec\ /bin/perl Perl script text
  10. !:mime text/x-perl
  11. 0 search/1/b #!\ /usr/bin/perl Perl script text executable
  12. !:mime text/x-perl
  13. 0 search/1 eval\ "exec\ /usr/bin/perl Perl script text
  14. !:mime text/x-perl
  15. 0 search/1/b #!\ /usr/local/bin/perl Perl script text executable
  16. !:mime text/x-perl
  17. 0 search/1 eval\ "exec\ /usr/local/bin/perl Perl script text
  18. !:mime text/x-perl
  19. 0 search/1 eval\ '(exit\ $?0)'\ &&\ eval\ 'exec Perl script text
  20. !:mime text/x-perl
  21. # by Dmitry V. Levin and Alexey Tourbin
  22. # check the first line
  23. 0 search/1 package
  24. 0 regex \^package[\ \t]+[A-Za-z_]
  25. >0 regex \^package[\ \t]+[0-9A-Za-z_:]+\ *; Perl5 module source text
  26. # not 'p', check other lines
  27. 0 search/1 !p
  28. >0 regex \^package[\ \t]+[0-9A-Za-z_:]+\ *;
  29. >>0 regex \^1\ *;|\^(use|sub|my)\ .*[(;{=] Perl5 module source text
  30. # Perl POD documents
  31. # From: Tom Hukins <tom@eborcom.com>
  32. 0 search/1/B \=pod\n Perl POD document text
  33. 0 search/1/B \n\=pod\n Perl POD document text
  34. 0 search/1/B \=head1\ Perl POD document text
  35. 0 search/1/B \n\=head1\ Perl POD document text
  36. 0 search/1/B \=head2\ Perl POD document text
  37. 0 search/1/B \n\=head2\ Perl POD document text
  38. # Perl Storable data files.
  39. 0 string perl-store perl Storable (v0.6) data
  40. >4 byte >0 (net-order %d)
  41. >>4 byte &01 (network-ordered)
  42. >>4 byte =3 (major 1)
  43. >>4 byte =2 (major 1)
  44. 0 string pst0 perl Storable (v0.7) data
  45. >4 byte >0
  46. >>4 byte &01 (network-ordered)
  47. >>4 byte =5 (major 2)
  48. >>4 byte =4 (major 2)
  49. >>5 byte >0 (minor %d)