+sub read_perl5lib {
+ my ( $instance ) = @_;
+
+ # This simulates what the debian shell scripts do:
+ # Read /etc/default/koha-common
+ # Check dev_install in koha-conf.xml
+
+ my $result = `grep "^PERL5LIB=" /etc/default/koha-common`;
+ chomp $result;
+ $result =~ s/^PERL5LIB=\s*//;
+ my $dev_install = `xmlstarlet sel -t -v 'yazgfs/config/dev_install' /etc/koha/sites/$instance/koha-conf.xml`;
+ chomp $dev_install;
+ if ( $dev_install ) {
+ # pick PERL5LIB from the intranetdir entry
+ $result = `xmlstarlet sel -t -v "yazgfs/config/intranetdir" /etc/koha/sites/$instance/koha-conf.xml`;
+ }
+ return $result;
+}
+