diff -ru UMMF-1.02/bin/files2dirs UMMF-1.02-new5/bin/files2dirs --- UMMF-1.02/bin/files2dirs 2006-05-13 18:40:03.000000000 -0700 +++ UMMF-1.02-new5/bin/files2dirs 2011-07-29 04:45:09.609375000 -0700 @@ -117,6 +117,7 @@ while ( @ARGV ) { local $_ = shift @ARGV; + next unless length $_; if ( $_ eq '-' ) { push(@input_files, $_); } diff -ru UMMF-1.02/bin/files2dirs.pl UMMF-1.02-new5/bin/files2dirs.pl --- UMMF-1.02/bin/files2dirs.pl 2006-05-13 18:40:03.000000000 -0700 +++ UMMF-1.02-new5/bin/files2dirs.pl 2011-07-29 04:45:20.875000000 -0700 @@ -117,6 +117,7 @@ while ( @ARGV ) { local $_ = shift @ARGV; + next unless length $_; if ( $_ eq '-' ) { push(@input_files, $_); } diff -ru UMMF-1.02/bin/ummf UMMF-1.02-new5/bin/ummf --- UMMF-1.02/bin/ummf 2006-05-13 18:40:03.000000000 -0700 +++ UMMF-1.02-new5/bin/ummf 2011-07-29 04:41:24.281250000 -0700 @@ -155,7 +155,7 @@ ####################################################################### -use File::Path; +use File::Path qw[ make_path ]; use IO::Handle; use IO::Pipe; @@ -337,11 +337,16 @@ if ( $output eq '-' ) { $output_h = \*STDOUT; } else { - mkpath($output); + my $err; + make_path( $output, { verbose => 1, error => \$err }); + if( @$err ){ print STDERR " make_path failed : @{[%$_]} \n" for @$err } + $output_h = new IO::Pipe; - my $cmd = "$_0dir/files2dirs $file2dirs_opts -d '$output' -"; - $output_h->writer($cmd) || die("Cannot pipe to 'cmd': $!"); - # print STDERR "Output to '$cmd'\n"; +#~ my $cmd = "$^X $_0dir/files2dirs $file2dirs_opts -d '$output' -"; + my @cmd = ( $^X , "$_0dir/files2dirs", $file2dirs_opts, '-d', $output, '-' ); +#~ local $" = ' '; + $output_h->writer(@cmd) || die("Cannot pipe to 'cmd': $!"); + print STDERR "$output_h Output to >> @cmd <<\n"; } } } @@ -350,7 +355,18 @@ sub close_output { if ( $output_h ) { - $output_h->close() unless $output_h eq \*STDOUT; + if( $output_h != \*STDOUT ){ + print STDERR "Trying to close $output_h \n"; + if( $^O ne 'MSWin32' ){ + $output_h -> close(); # hangs?? + } else { + $output_h -> IO::Pipe::End::SUPER::close() for 1 .. 5; + print STDERR " done ->SUPER::close() killing\n"; + kill 9, ${*$output_h}{'io_pipe_pid'} for 1 .. 3; + print STDERR " done killing \n"; + } + } + $output_h = undef; } } @@ -406,9 +422,10 @@ elsif ( $input =~ /\.(zargo|zuml)$/i ) { # $DB::single = 1; my $fh = IO::Pipe->new(); - my @cmd = ( "$basedir/bin/uml2xmi", $input ); + my @cmd = ( $^X, "$basedir/bin/uml2xmi", $input ); { - local $" = ' '; +#~ local $" = ' '; + print STDERR "IO::Pipe ummi >> @cmd << \n"; $fh->reader(@cmd) || die("Cannot run '@cmd': $!"); } diff -ru UMMF-1.02/bin/ummf.pl UMMF-1.02-new5/bin/ummf.pl --- UMMF-1.02/bin/ummf.pl 2006-05-13 18:40:03.000000000 -0700 +++ UMMF-1.02-new5/bin/ummf.pl 2011-07-29 04:41:25.984375000 -0700 @@ -155,7 +155,7 @@ ####################################################################### -use File::Path; +use File::Path qw[ make_path ]; use IO::Handle; use IO::Pipe; @@ -337,11 +337,16 @@ if ( $output eq '-' ) { $output_h = \*STDOUT; } else { - mkpath($output); + my $err; + make_path( $output, { verbose => 1, error => \$err }); + if( @$err ){ print STDERR " make_path failed : @{[%$_]} \n" for @$err } + $output_h = new IO::Pipe; - my $cmd = "$_0dir/files2dirs $file2dirs_opts -d '$output' -"; - $output_h->writer($cmd) || die("Cannot pipe to 'cmd': $!"); - # print STDERR "Output to '$cmd'\n"; +#~ my $cmd = "$^X $_0dir/files2dirs $file2dirs_opts -d '$output' -"; + my @cmd = ( $^X , "$_0dir/files2dirs", $file2dirs_opts, '-d', $output, '-' ); +#~ local $" = ' '; + $output_h->writer(@cmd) || die("Cannot pipe to 'cmd': $!"); + print STDERR "$output_h Output to >> @cmd <<\n"; } } } @@ -350,7 +355,18 @@ sub close_output { if ( $output_h ) { - $output_h->close() unless $output_h eq \*STDOUT; + if( $output_h != \*STDOUT ){ + print STDERR "Trying to close $output_h \n"; + if( $^O ne 'MSWin32' ){ + $output_h -> close(); # hangs?? + } else { + $output_h -> IO::Pipe::End::SUPER::close() for 1 .. 5; + print STDERR " done ->SUPER::close() killing\n"; + kill 9, ${*$output_h}{'io_pipe_pid'} for 1 .. 3; + print STDERR " done killing \n"; + } + } + $output_h = undef; } } @@ -406,9 +422,10 @@ elsif ( $input =~ /\.(zargo|zuml)$/i ) { # $DB::single = 1; my $fh = IO::Pipe->new(); - my @cmd = ( "$basedir/bin/uml2xmi", $input ); + my @cmd = ( $^X, "$basedir/bin/uml2xmi", $input ); { - local $" = ' '; +#~ local $" = ' '; + print STDERR "IO::Pipe ummi >> @cmd << \n"; $fh->reader(@cmd) || die("Cannot run '@cmd': $!"); } diff -ru UMMF-1.02/lib/UMMF/Import/XMI.pm UMMF-1.02-new5/lib/UMMF/Import/XMI.pm --- UMMF-1.02/lib/UMMF/Import/XMI.pm 2006-05-13 18:40:03.000000000 -0700 +++ UMMF-1.02-new5/lib/UMMF/Import/XMI.pm 2011-07-29 04:47:29.968750000 -0700 @@ -573,7 +573,23 @@ # Handle DATA if ( $name eq 'XMI.field' ) { - return $node->getData; +#~ http://www.perlmonks.org/?node_id=62809# XML::DOM::Parser + sub XML::DOM::Element::getData { + package XML::DOM::Element; + my( $node ) = @_; + my $data = ""; + for my $child($node->getChildNodes) { + if($child->getNodeType == TEXT_NODE) { + $data .= $child->getData; + } + } + return $data; + } + my $ret = eval { $node->getData }; +#~ warn $@ ? $@ : "$ret "; + $ret = $node->getNodeValue unless length $ret; +#~ warn " $node ", $node->getNodeType , " " unless length $ret; + return $ret; } if ( $name eq 'XMI.any' ) { return $node->getData; diff -ru UMMF-1.02/lib/UMMF/XForm/Merge.pm UMMF-1.02-new5/lib/UMMF/XForm/Merge.pm --- UMMF-1.02/lib/UMMF/XForm/Merge.pm 2005-04-11 22:40:43.000000000 -0700 +++ UMMF-1.02-new5/lib/UMMF/XForm/Merge.pm 2011-07-29 04:40:38.015625000 -0700 @@ -121,7 +121,7 @@ sub merge_ModelElements_1 { my ($self, $model, $modelx, $ns, $nsx) = @_; - +warn join "\n", map { "[ $_ ] " } @_; for my $objx ( $nsx->ownedElement ) { my $name = $objx->name; my $obj = Namespace_ownedElement_name($ns, $name); diff -ru UMMF-1.02/lib/UMMF.pm UMMF-1.02-new5/lib/UMMF.pm --- UMMF-1.02/lib/UMMF.pm 2006-05-13 18:40:03.000000000 -0700 +++ UMMF-1.02-new5/lib/UMMF.pm 2011-07-29 04:40:38.015625000 -0700 @@ -373,6 +373,8 @@ Returns a list of directories to search for files of type C<$type>. =cut + +use File::ShareDir qw' dist_dir '; sub resource_path { my ($self, $type) = @_; @@ -400,6 +402,7 @@ # Default installation path. &module_dir . "/data", + dist_dir('UMMF', 'ummf'), # it works ), ); } diff -ru UMMF-1.02/Makefile.PL UMMF-1.02-new5/Makefile.PL --- UMMF-1.02/Makefile.PL 2004-08-01 14:19:09.000000000 -0700 +++ UMMF-1.02-new5/Makefile.PL 2011-07-29 04:40:38.015625000 -0700 @@ -2,6 +2,9 @@ use 5.006001; use ExtUtils::MakeMaker; +use File::ShareDir::Install; +install_share 'dist', 'data'; # install data into + # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( @@ -47,3 +50,8 @@ (ABSTRACT_FROM => 'lib/UMMF.pm', # retrieve abstract from module AUTHOR => 'Kurt Stephens ') : ()), ); + + package MY; + use File::ShareDir::Install qw(postamble); # it works + +