--- tamtam/tamtam2socialtext.pl 2007/12/13 11:42:24 22 +++ tamtam/tamtam2socialtext.pl 2007/12/13 12:42:45 24 @@ -17,10 +17,12 @@ my $debug = 0; my $max = 999; +my $attachments = 0; GetOptions( 'debug+' => \$debug, 'max=i' => \$max, + 'attachments' => \$attachments, ); my $page; @@ -28,7 +30,7 @@ my @page_names; -print "Collecting pages...\n"; +print "Importing $max pages", $attachments ? " with attachments" : "", "...\n"; find({ wanted => sub { @@ -209,11 +211,14 @@ $Rester->put_pagetag( $name, $_ ); print "+ tag $_\n"; } - foreach my $a ( @{ $p->{attachments} } ) { - my $type = $m->get_mime( $a->{full_path} ); - my $content = read_file( $a->{full_path} ); - print "+ attachment ", $a->{name}," $type ", length($content), " bytes\n"; - $Rester->post_attachment($name, $a->{name}, $content, $type ); + + if ( $attachments ) { + foreach my $a ( @{ $p->{attachments} } ) { + my $type = $m->get_mime( $a->{full_path} ); + my $content = read_file( $a->{full_path} ); + print "+ attachment ", $a->{name}," $type ", length($content), " bytes\n"; + $Rester->post_attachment($name, $a->{name}, $content, $type ); + } } }