In any case, I'm not sure how truly helpful this tip was, UMMF has a few portability related bugs, it won't work out of the box on win32

With this patch the examples will work (generate code files)

To apply patch

cd UMMF-1.02
patch -p1 < path/to/patchfile 
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 -07 +00 @@ -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/Impo +rt/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.96875 +0000 -0700 @@ -573,7 +573,23 @@ # Handle <XMI.field>DATA</XMI.field> 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/XFo +rm/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.0156 +25000 -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 modu +le AUTHOR => 'Kurt Stephens <kstephens@users.sourceforge. +net>') : ()), ); + + package MY; + use File::ShareDir::Install qw(postamble); # it works + +

In reply to Re^5: UML to Perl by Anonymous Monk
in thread UML to Perl by biswanath_c

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.