Skip to content

Instantly share code, notes, and snippets.

@djerius
Created February 11, 2015 14:42
Show Gist options
  • Save djerius/bfb6af97640851fe10de to your computer and use it in GitHub Desktop.
Save djerius/bfb6af97640851fe10de to your computer and use it in GitHub Desktop.
problem using roles in import
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.11.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `#!/bin/sh' line above, then type `sh FILE'.
#
lock_dir=_sh22402
# Made on 2015-02-11 09:40 EST by <dj@macabre>.
# Source directory was `/data/macabretmp/dj'.
#
# Existing files will *not* be overwritten, unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 197 -rw-r--r-- badimp/Class2.pm
# 156 -rw-r--r-- badimp/Role.pm
# 89 -rw-r--r-- badimp/badimp.pl
# 218 -rw-r--r-- badimp/Import.pm
# 192 -rw-r--r-- badimp/Class.pm
#
MD5SUM=${MD5SUM-md5sum}
f=`${MD5SUM} --version | egrep '^md5sum .*(core|text)utils'`
test -n "${f}" && md5check=true || md5check=false
${md5check} || \
echo 'Note: not verifying md5sums. Consider installing GNU coreutils.'
if test "X$1" = "X-c"
then keep_file=''
else keep_file=true
fi
echo=echo
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=
locale_dir=
set_echo=false
for dir in $PATH
do
if test -f $dir/gettext \
&& ($dir/gettext --version >/dev/null 2>&1)
then
case `$dir/gettext --version 2>&1 | sed 1q` in
*GNU*) gettext_dir=$dir
set_echo=true
break ;;
esac
fi
done
if ${set_echo}
then
set_echo=false
for dir in $PATH
do
if test -f $dir/shar \
&& ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
then
locale_dir=`$dir/shar --print-text-domain-dir`
set_echo=true
break
fi
done
if ${set_echo}
then
TEXTDOMAINDIR=$locale_dir
export TEXTDOMAINDIR
TEXTDOMAIN=sharutils
export TEXTDOMAIN
echo="$gettext_dir/gettext -s"
fi
fi
IFS="$save_IFS"
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null
then if (echo -n test; echo 1,2,3) | grep n >/dev/null
then shar_n= shar_c='
'
else shar_n=-n shar_c= ; fi
else shar_n= shar_c='\c' ; fi
f=shar-touch.$$
st1=200112312359.59
st2=123123592001.59
st2tr=123123592001.5 # old SysV 14-char limit
st3=1231235901
if touch -am -t ${st1} ${f} >/dev/null 2>&1 && \
test ! -f ${st1} && test -f ${f}; then
shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
elif touch -am ${st2} ${f} >/dev/null 2>&1 && \
test ! -f ${st2} && test ! -f ${st2tr} && test -f ${f}; then
shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
elif touch -am ${st3} ${f} >/dev/null 2>&1 && \
test ! -f ${st3} && test -f ${f}; then
shar_touch='touch -am $3$4$5$6$2 "$8"'
else
shar_touch=:
echo
${echo} 'WARNING: not restoring timestamps. Consider getting and
installing GNU `touch'\'', distributed in GNU coreutils...'
echo
fi
rm -f ${st1} ${st2} ${st2tr} ${st3} ${f}
#
if test ! -d ${lock_dir} ; then :
else ${echo} "lock directory ${lock_dir} exists"
exit 1
fi
if mkdir ${lock_dir}
then ${echo} "x - created lock directory ${lock_dir}."
else ${echo} "x - failed to create lock directory ${lock_dir}."
exit 1
fi
# ============= badimp/Class2.pm ==============
if test ! -d 'badimp'; then
mkdir 'badimp'
if test $? -eq 0
then ${echo} "x - created directory badimp."
else ${echo} "x - failed to create directory badimp."
exit 1
fi
fi
if test -n "${keep_file}" && test -f 'badimp/Class2.pm'
then
${echo} "x - SKIPPING badimp/Class2.pm (file already exists)"
else
${echo} "x - extracting badimp/Class2.pm (text)"
sed 's/^X//' << 'SHAR_EOF' > 'badimp/Class2.pm' &&
use 5.10.0;
use strict;
use warnings;
X
package Class2 {
X
X use Moo;
X
X use Import 'Role';
X
X has a => ( is => 'ro' );
X
X sub BUILDARGS { say __PACKAGE__; shift->next::method( @_ ) }
X
}
X
1;
SHAR_EOF
(set 20 15 02 11 09 38 28 'badimp/Class2.pm'
eval "${shar_touch}") && \
chmod 0644 'badimp/Class2.pm'
if test $? -ne 0
then ${echo} "restore of badimp/Class2.pm failed"
fi
if ${md5check}
then (
${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'badimp/Class2.pm': 'MD5 check failed'
) << \SHAR_EOF
fe7f1c48cca9e85759eca8b0940b7783 badimp/Class2.pm
SHAR_EOF
else
test `LC_ALL=C wc -c < 'badimp/Class2.pm'` -ne 197 && \
${echo} "restoration warning: size of 'badimp/Class2.pm' is not 197"
fi
fi
# ============= badimp/Role.pm ==============
if test ! -d 'badimp'; then
mkdir 'badimp'
if test $? -eq 0
then ${echo} "x - created directory badimp."
else ${echo} "x - failed to create directory badimp."
exit 1
fi
fi
if test -n "${keep_file}" && test -f 'badimp/Role.pm'
then
${echo} "x - SKIPPING badimp/Role.pm (file already exists)"
else
${echo} "x - extracting badimp/Role.pm (text)"
sed 's/^X//' << 'SHAR_EOF' > 'badimp/Role.pm' &&
use 5.10.0;
use strict;
use warnings;
X
package Role {
X
X use Moo::Role;
X
X around BUILDARGS => sub { my $orig = shift; say __PACKAGE__; &$orig }
X
}
X
1;
SHAR_EOF
(set 20 15 02 11 09 38 37 'badimp/Role.pm'
eval "${shar_touch}") && \
chmod 0644 'badimp/Role.pm'
if test $? -ne 0
then ${echo} "restore of badimp/Role.pm failed"
fi
if ${md5check}
then (
${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'badimp/Role.pm': 'MD5 check failed'
) << \SHAR_EOF
2c3cb2b8d5b12039766747cdd632e5e7 badimp/Role.pm
SHAR_EOF
else
test `LC_ALL=C wc -c < 'badimp/Role.pm'` -ne 156 && \
${echo} "restoration warning: size of 'badimp/Role.pm' is not 156"
fi
fi
# ============= badimp/badimp.pl ==============
if test -n "${keep_file}" && test -f 'badimp/badimp.pl'
then
${echo} "x - SKIPPING badimp/badimp.pl (file already exists)"
else
${echo} "x - extracting badimp/badimp.pl (text)"
sed 's/^X//' << 'SHAR_EOF' > 'badimp/badimp.pl' &&
use 5.10.0;
use strict;
use warnings;
X
use Class;
use Class2;
X
X
Class->new;
Class2->new;
SHAR_EOF
(set 20 15 02 11 09 36 50 'badimp/badimp.pl'
eval "${shar_touch}") && \
chmod 0644 'badimp/badimp.pl'
if test $? -ne 0
then ${echo} "restore of badimp/badimp.pl failed"
fi
if ${md5check}
then (
${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'badimp/badimp.pl': 'MD5 check failed'
) << \SHAR_EOF
c5f9b123cb145e8198e6c21ea3a860d8 badimp/badimp.pl
SHAR_EOF
else
test `LC_ALL=C wc -c < 'badimp/badimp.pl'` -ne 89 && \
${echo} "restoration warning: size of 'badimp/badimp.pl' is not 89"
fi
fi
# ============= badimp/Import.pm ==============
if test -n "${keep_file}" && test -f 'badimp/Import.pm'
then
${echo} "x - SKIPPING badimp/Import.pm (file already exists)"
else
${echo} "x - extracting badimp/Import.pm (text)"
sed 's/^X//' << 'SHAR_EOF' > 'badimp/Import.pm' &&
use 5.10.0;
use strict;
use warnings;
X
package Import {
X
X use Moo::Role ();
X sub import {
X shift;
X my $target = scalar caller;
X Moo::Role->apply_roles_to_package( $target, @_ );
X }
X
}
X
1;
SHAR_EOF
(set 20 15 02 11 09 37 22 'badimp/Import.pm'
eval "${shar_touch}") && \
chmod 0644 'badimp/Import.pm'
if test $? -ne 0
then ${echo} "restore of badimp/Import.pm failed"
fi
if ${md5check}
then (
${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'badimp/Import.pm': 'MD5 check failed'
) << \SHAR_EOF
df518c6e8438d0a593529cb79298c678 badimp/Import.pm
SHAR_EOF
else
test `LC_ALL=C wc -c < 'badimp/Import.pm'` -ne 218 && \
${echo} "restoration warning: size of 'badimp/Import.pm' is not 218"
fi
fi
# ============= badimp/Class.pm ==============
if test -n "${keep_file}" && test -f 'badimp/Class.pm'
then
${echo} "x - SKIPPING badimp/Class.pm (file already exists)"
else
${echo} "x - extracting badimp/Class.pm (text)"
sed 's/^X//' << 'SHAR_EOF' > 'badimp/Class.pm' &&
use 5.10.0;
use strict;
use warnings;
X
package Class {
X
X use Moo;
X with 'Role';
X
X sub BUILDARGS { say __PACKAGE__; shift->next::method( @_ ) }
X
X has a => ( is => 'ro' );
}
X
1;
SHAR_EOF
(set 20 15 02 11 09 38 10 'badimp/Class.pm'
eval "${shar_touch}") && \
chmod 0644 'badimp/Class.pm'
if test $? -ne 0
then ${echo} "restore of badimp/Class.pm failed"
fi
if ${md5check}
then (
${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'badimp/Class.pm': 'MD5 check failed'
) << \SHAR_EOF
b4d839f7447915f15b01abe10124595d badimp/Class.pm
SHAR_EOF
else
test `LC_ALL=C wc -c < 'badimp/Class.pm'` -ne 192 && \
${echo} "restoration warning: size of 'badimp/Class.pm' is not 192"
fi
fi
if rm -fr ${lock_dir}
then ${echo} "x - removed lock directory ${lock_dir}."
else ${echo} "x - failed to remove lock directory ${lock_dir}."
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment