<?xml version="1.0" encoding="windows-1252"?>
<node id="104253" title="Re: Re (tilly) 1: New sections and move one" created="2001-08-12 15:48:04" updated="2005-07-21 01:27:58">
<type id="11">
note</type>
<author id="89231">
aquacade</author>
<data>
<field name="doctext">
I'm using ActiveState for (yuk!) Windows cause that's my client platform.  I have not been able to successfully install a CPAN module (as yet) unless ActiveState had it in it's PPM repository already.  (I heard Brian Ingerson is on a leave of absence from ActiveState, when I called to complain that installing from the respository is throwing  errors like never before, like missing dependent modules).&lt;br&gt;&lt;br&gt;
Please excuse me quickly throwing together some examples of what I mean. They were quickly tested, but I'm sure someone could make them better! What I'm suggesting is like the following examples.  Someone new to Perl could use these right away on faith and learn what they mean after they "Saved the Day!" with their boss or client.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Update: Revised rtrim to use sexeger as suggested below!&lt;/strong&gt;
&lt;code&gt;
sub rtrim {
	# Right trim spaces
	my @out=@_;
	for (@out) {
		$_ = reverse $_;
		s/^\s+//;
		$_ = reverse $_;
	}
	return wantarray ? @out : $out[0];
}

sub ltrim {
	# Left trim spaces
	my @out=@_;
	for (@out) {
		s/^\s+//;
	}
	return wantarray ? @out : $out[0];
}

sub trim {
	# Trim extra spaces from both left and right
	my @out=@_;
	for (@out) {
		s/^\s+//;
		s/\s+$//;
	}
	return wantarray ? @out : $out[0];
}

sub trimall {
	# Trim all extra spaces from both left and right and middle
	my @out=@_;
	for (@out) {
		$_= join ' ',split;
	}
	return wantarray ? @out : $out[0];
}
&lt;/code&gt;
Again, this could be the start of the "String related" category of the Perl Monks' "Subroutine Library."  I don't think these kind of onezie subroutines would find a welcome home in CPAN as one routine per submission.  If they were in a module, then I have the same 'discovery' and 'install' problems I have today.  As onezies they would fail CPANTS for sure not being modules!
&lt;p&gt;&lt;FONT face=Beanie color="#0080ff" size=4&gt;
..::::::&amp;nbsp;aquacade&amp;nbsp;::::::..&lt;/FONT&gt;&lt;/p&gt;</field>
<field name="root_node">
104207</field>
<field name="parent_node">
104212</field>
</data>
</node>
