#!/usr/bin/perl -- $Devel::Trace::TRACE = 0; # Disable use strict; use warnings; use XML::Twig; Main( @ARGV ); warn "main who\n"; exit( 0 ); sub Main { my $self = {}; $self->{xml} = XML::Twig::Elt->new('urlset', { 'xmlns' => 'http://www.google.com/schemas/sitemap/0.84', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => join(' ', 'http://www.google.com/schemas/sitemap/0.84', 'http://www.google.com/schemas/sitemap/0.84/sitemap.xsd', ), }); #~ #~ http://www.example.com/some/really/interesting/file.html #~ 0.5 #~ #~ for( 0 .. 149500 ){ #~ for( 0 .. 49500 ){ #~ for( 0 .. (49500-39500) ){ #~ for( 0 .. (10000 - 5000) ){ #~ for( 0 .. ( 5000 - 200 ) ){ #~ for( 0 .. ( 5000 - 140 ) ){ #~ for( 0 .. ( 5000 - 170 ) ){ #~ for( 0 .. ( 5000 - 180 ) ){ #~ for( 0 .. ( 5000 - 190 ) ){ #~ for( 0 .. ( 5000 - 183 ) ){ #~ for( 0 .. ( 5000 - 185 ) ){ #~ for( 0 .. ( 5000 - 183 ) ){ for( 0 .. 4817 ){ my @elements; push(@elements, XML::Twig::Elt->new('loc', {}, 'http://www.example.com/some/really/interesting/file.html' ) ); push(@elements, XML::Twig::Elt->new('priority', {}, '0.5' ) ); my $elt = XML::Twig::Elt->new('url', {}, @elements); $elt->paste(last_child => $self->{xml}); warn "main who $_\n" if $_ > ( 49497 - 3); } binmode STDOUT; #~ print $self->{xml}->sprint();# FAIL,incomplete $self->{xml}->set_pretty_print('indented'); my $header = ''."\n"; $self->{xml}->print_to_file('2'); # NO cutoff XML s, but still exits on undef; #~ $self->{xml}->purge; #~ Can't call method "purge_up_to" on an undefined value at C:/perl/site/5.14.1/lib/XML/Twig.pm line 8087. #~ print $header; #~ $self->{xml}->print(); # XML is cut off #~ print $self->{xml}->sprint(); # XML is cut off, no closing #~ print $self->{xml}->flush; # fail #~ Can't call method "flush_up_to" on an undefined value at C:/perl/site/5.14.1/lib/XML/Twig.pm line 8082. warn "about to undef "; $Devel::Trace::TRACE = 1; # Enable undef $self->{xml}; warn "after undef "; return; } __END__ #### undef $self->{xml}; >> C:/perl/site/5.14.1/lib/XML/Twig.pm:7534: { my $elt= shift; >> C:/perl/site/5.14.1/lib/XML/Twig.pm:7535: return if( $XML::Twig::weakrefs); >> C:/perl/site/5.14.1/lib/XML/Twig.pm:7534: { my $elt= shift; >> C:/perl/site/5.14.1/lib/XML/Twig.pm:7535: return if( $XML::Twig::weakrefs); ... #### $ perl -d:Modlist -e " use strict; use warnings; use XML::Twig; " Carp 1.23 Config DynaLoader 1.13 Encode 2.44 Encode::Alias 2.15 Encode::Config 2.05 Encode::Encoding 2.05 Exporter 5.65 Exporter::Heavy 5.65 File::Basename 2.82 File::Glob 1.12 File::Spec 3.33 File::Spec::Unix 3.33 File::Spec::Win32 3.33 List::Util 1.23 Scalar::Util 1.23 UNIVERSAL 1.08 XML::Parser 2.41 XML::Parser::Expat 2.41 XML::Twig 3.39 XSLoader 0.15 base 2.16 bytes 1.04 constant 1.21 feature 1.20 overload 1.13 utf8 1.09 vars 1.02 warnings 1.12 warnings::register 1.02