mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
745 B

  1. #!/bin/bash
  2. pmfile=
  3. for x in \
  4. /usr/lib/perl*/*/${1//::/\/}.pm \
  5. /usr/lib/perl*/*/*/${1//::/\/}.pm \
  6. /usr/lib/perl*/*/*/*/${1//::/\/}.pm
  7. do
  8. if [ -z "$pmfile" -a -f $x ]; then
  9. pmfile="$x"
  10. fi
  11. done
  12. if [ -z "$pmfile" ]; then
  13. echo "No *.pm file for $1 found."
  14. exit
  15. fi
  16. get_pm_desc()
  17. {
  18. gawk '
  19. BEGIN { state = 0; }
  20. $1 == "=head1" && state != 0 { state = 0; }
  21. $1 == "=head1" && $2 == "'"$1"'" { state = 1; next; }
  22. $1 != "" && state == 1 { state = 2; }
  23. $1 == "" && state == 2 { state = 0; }
  24. state == 2 { print; }
  25. ' < $pmfile
  26. }
  27. {
  28. get_pm_desc NAME | perl -pe 's,^.*?- *,[I] ,' | head -n 1
  29. get_pm_desc DESCRIPTION | fmt | perl -pe 's,^,[T] ,'
  30. get_pm_desc AUTHORS | perl -pe 's,^,[A] ,'
  31. } | perl -pe 's/<lt>/</ig; s/<gt>/>/ig;'