#! /bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
tmpfiles="$tmpfiles xg-pl-4.pl"
cat <<\EOPERL > xg-pl-4.pl
use strict;
print "'Your command, please?', asked the waiter.\n";
my $polite = 'please';
print "'Your recommendation, $polite?', answered the guest.\n";
my $ref1 = \$polite;
my $ref2 = \$ref1;
my $ref3 = \$ref2;
print "Yes, $$$$ref3!\n";
print (qq {\uU\lp \LaNd\E \ldo\lWn, \Uoh\E, yeah\Q!!!\E\\!\n});
print q<E-Mail: <no@spam.org>. >;
{ $polite =~ qr?le? }
print "Your Perl include path starts with '$INC[0]' and it " .
"ends with '$INC[-1]'. $#INC directories are searched.\n";
print <<EOF, <<'EOF';
Line 1\nLine 2
EOF
Line 1\nStill line 1
EOF
sub hello_func { return 'Hello' };
print "@{[hello_func]} world!\n";
print `ls $0`;
print qx;ls $0;;
require 5.006;
print "\U\x70\LO\154\x{69}\x{004E}a \Q\lRu\LLeS\E\041\n";
EOPERL
tmpfiles="$tmpfiles xg-pl-4.pot"
: ${XGETTEXT=xgettext}
LC_MESSAGES=C LC_ALL= \
${XGETTEXT} -a --omit-header --no-location -o xg-pl-4.pot xg-pl-4.pl
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
tmpfiles="$tmpfiles xg-pl-4.ok"
cat <<\EOF > xg-pl-4.ok
msgid "'Your command, please?', asked the waiter.\n"
msgstr ""
msgid "please"
msgstr ""
msgid "'Your recommendation, $polite?', answered the guest.\n"
msgstr ""
msgid "Yes, $$$$ref3!\n"
msgstr ""
msgid "Up and down, OH, yeah\\!\\!\\!\\!\n"
msgstr ""
msgid "E-Mail: <no@spam.org>. "
msgstr ""
msgid ""
"Your Perl include path starts with '$INC[0]' and it ends with '$INC[-1]'. "
"$#INC directories are searched.\n"
msgstr ""
msgid ""
"Line 1\n"
"Line 2\n"
msgstr ""
msgid "Line 1\\nStill line 1\n"
msgstr ""
msgid "Hello"
msgstr ""
msgid "@{[hello_func]} world!\n"
msgstr ""
msgid "ls $0"
msgstr ""
msgid "Polina rules!\n"
msgstr ""
EOF
: ${DIFF=diff}
${DIFF} xg-pl-4.ok xg-pl-4.pot
result=$?
rm -fr $tmpfiles
exit $result