#!/usr/local/bin/perl package Sub::Pipe; use warnings; use strict; our $VERSION = '0.01'; use base 'Exporter'; our @EXPORT = qw/joint/; use overload '|' => sub { $_[0]->( $_[1] ) }; sub joint(&) { bless $_[0], __PACKAGE__ }; if ( $0 eq __FILE__ ) { local $\ = "\n"; my $uri = joint { use URI::Escape; uri_escape_utf8(shift) }; my $html = joint { my $str = shift; $str =~ s{([&<>"])}{ '&' . { qw/& amp < lt > gt " quot/ }->{$1} . ';' ; }msgex; $str; }; my $html_line_break = joint { local $_ = $_[0]; s{\r*\n}{
}g; $_; }; my $replace = sub { my ( $regexp, $replace ) = @_; joint { my $str = shift; $str =~ s{$regexp}{$replace}g; $str; } }; print "dankogai" | joint { uc shift }; print "
" | $html;
    print "Perl & Me" | $uri;
    print "PHP" | $replace->( 'HP', 'erl' );
    print "Rock\nRoll" | $html_line_break | $uri;
}

1; # End of Sub::Pipe