[24287] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 6478 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 27 18:11:14 2004

Date: Tue, 27 Apr 2004 15:10:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 27 Apr 2004     Volume: 10 Number: 6478

Today's topics:
        multi-field array sort using Sort::Fields method <domenico_discepola@quadrachemicals.com>
    Re: multi-field array sort using Sort::Fields method <ittyspam@yahoo.com>
    Re: multi-field array sort using Sort::Fields method <domenico_discepola@quadrachemicals.com>
    Re: multi-field array sort using Sort::Fields method <ittyspam@yahoo.com>
    Re: multi-field array sort using Sort::Fields method <ittyspam@yahoo.com>
    Re: multi-field array sort using Sort::Fields method (Anno Siegel)
    Re: Newbie: Looking for comments on this (working) scri <robin @ infusedlight.net>
    Re: Newbie: Looking for comments on this (working) scri <ittyspam@yahoo.com>
    Re: Newbie: Looking for comments on this (working) scri <robin @ infusedlight.net>
    Re: Newbie: Looking for comments on this (working) scri <ittyspam@yahoo.com>
    Re: Newbie: Looking for comments on this (working) scri <krahnj@acm.org>
    Re: Odd behavior of mod_perl's PerlSetEnv with PERL5LIB <pkent77tea@yahoo.com.tea>
    Re: perl & Mac G4 <dwilga-MUNGE@mtholyoke.edu>
    Re: perl & Mac G4 (Walter Roberson)
    Re: perl & Mac G4 <spamtrap@dot-app.org>
    Re: perl & Mac G4 <King@ask.for.email.invalid>
    Re: perl & Mac G4 <spamtrap@dot-app.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 27 Apr 2004 12:50:43 -0400
From: "Domenico Discepola" <domenico_discepola@quadrachemicals.com>
Subject: multi-field array sort using Sort::Fields method
Message-Id: <gawjc.33531$kc2.478902@nnrp1.uunet.ca>

Hello all.  My goal is to be able to perform a "multi-field sort on a
multidimensional array".  Having read many posts in the newsgroups, I was
unable to find a "straight" answer to this problem.  I therefore came up
with this method.  My question is, is there a more efficient solution to
this problem or is my method acceptable?  Is there another CPAN module that
can be used?  I welcome all opinions.

#!perl
use strict;
use warnings;
use Sort::Fields;

my ( @arr01, @arr02, $r, $c, $string, $aref, $delim, @arr_temp,
@arr_final );

@arr01 = (  [1, 'a', 'dom'],
  [5, 'g', 'brad'],
  [3, 'd', 'jamie'],
  [7, 'd', 'abigail']);

$delim = "\t";
$string = "";

#Step 1 - combine fields into 1 string so that Sort::Fields will work
for $r ( 0 .. $#arr01 ) {
 $aref = $arr01[$r];
        for $c ( 0 .. $#{$aref} ) {
         if ( $c == $#$aref ) {
          $string = $string . $arr01[$r][$c];
         } else {
          $string = $string . $arr01[$r][$c]. $delim ;
         }
        }
        push @arr02, $string;
        $string = "";
}

#Step 2 - sort by field 2, then 3
my @sorted = fieldsort '\t', [2,3], @arr02;

#Step 3 - split sorted strings into mutidim array
foreach my $el ( @sorted ) {
 @arr_temp = split $delim, $el;
 push @arr_final, [@arr_temp];
}

#Step 4 - final output
print join('|', @$_), "\n" for @arr_final;





------------------------------

Date: Tue, 27 Apr 2004 13:20:33 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: multi-field array sort using Sort::Fields method
Message-Id: <20040427131304.B1107@dishwasher.cs.rpi.edu>

On Tue, 27 Apr 2004, Domenico Discepola wrote:

> Hello all.  My goal is to be able to perform a "multi-field sort on a
> multidimensional array".  Having read many posts in the newsgroups, I was
> unable to find a "straight" answer to this problem.  I therefore came up
> with this method.  My question is, is there a more efficient solution to
> this problem or is my method acceptable?  Is there another CPAN module that
> can be used?  I welcome all opinions.

You're going backwards.  Sort::Fields is what you use when you don't have
multi-dimensional arrays, but rather arrays of delimited strings. If you
have multi-dimensional arrays, you just use 'sort':


#!perl.exe
use strict;
use warnings;

my @arr01 = (
		[1, 'a', 'dom'],
		[5, 'g', 'brad'],
		[3, 'd', 'jamie'],
		[7, 'd', 'abigail']
	    );

my @sorted = sort {
	$a->[1] cmp $b->[1] #sort ASCIIBetically by 2nd field
	or
	$a->[2] cmp $b->[2] #if same, sort ASICBettically by 3rd field
	} @arr01;

foreach (@sorted){
	print "@$_\n";
}

__END__


For more information, please see
perldoc -f sort

Hope this helps,
Paul Lalli

>
> #!perl
> use strict;
> use warnings;
> use Sort::Fields;
>
> my ( @arr01, @arr02, $r, $c, $string, $aref, $delim, @arr_temp,
> @arr_final );
>
> @arr01 = (  [1, 'a', 'dom'],
>   [5, 'g', 'brad'],
>   [3, 'd', 'jamie'],
>   [7, 'd', 'abigail']);
>
> $delim = "\t";
> $string = "";
>
> #Step 1 - combine fields into 1 string so that Sort::Fields will work
> for $r ( 0 .. $#arr01 ) {
>  $aref = $arr01[$r];
>         for $c ( 0 .. $#{$aref} ) {
>          if ( $c == $#$aref ) {
>           $string = $string . $arr01[$r][$c];
>          } else {
>           $string = $string . $arr01[$r][$c]. $delim ;
>          }
>         }
>         push @arr02, $string;
>         $string = "";
> }
>
> #Step 2 - sort by field 2, then 3
> my @sorted = fieldsort '\t', [2,3], @arr02;
>
> #Step 3 - split sorted strings into mutidim array
> foreach my $el ( @sorted ) {
>  @arr_temp = split $delim, $el;
>  push @arr_final, [@arr_temp];
> }
>
> #Step 4 - final output
> print join('|', @$_), "\n" for @arr_final;
>
>
>
>



------------------------------

Date: Tue, 27 Apr 2004 16:13:28 -0400
From: "Domenico Discepola" <domenico_discepola@quadrachemicals.com>
Subject: Re: multi-field array sort using Sort::Fields method
Message-Id: <l8zjc.33615$kc2.480275@nnrp1.uunet.ca>


"Paul Lalli" <ittyspam@yahoo.com> wrote in message
news:20040427131304.B1107@dishwasher.cs.rpi.edu...
> On Tue, 27 Apr 2004, Domenico Discepola wrote:
>
> > Hello all.  My goal is to be able to perform a "multi-field sort on a
> > multidimensional array".

  Is there another CPAN module that
> > can be used?  I welcome all opinions.
>

> For more information, please see
> perldoc -f sort
>
> Hope this helps,
> Paul Lalli
>
> >

Thanks for your concrete example - it helps while trying to understand the
existing documentation.  Although the example you provided works, I'm
wondering if there is a CPAN module which provides a more "elegant"
interface to a multi-field, multidimensional array sort.  What I have in
mind is an interface similar to Sort::Fields:

@arr_order = ( [2, 'a'], [-1,'n'] );

@sorted = sort_module( $arr_input, \@arr_order );

This would translate as sort what's in array $arr_order alphabetically by
position 2, then numerically reversed by position 1.

Input parameter 1 is the array to be sorted, parameter 2 is an array
(@arr_order) containing the index position of the array columns we want to
sort on, along with an alphabetic (a) or numeric (n) sort type.  A negative
sign indicates a reverse sort.  The benefit of this is to be able to call 1
function that can be passed parameters dynamically (as opposed to
dynamically modifying code with $a and $b, cmp, <=>, etc.).




------------------------------

Date: Tue, 27 Apr 2004 17:03:27 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: multi-field array sort using Sort::Fields method
Message-Id: <20040427163149.G1107@dishwasher.cs.rpi.edu>

On Tue, 27 Apr 2004, Domenico Discepola wrote:

> Thanks for your concrete example - it helps while trying to understand the
> existing documentation.  Although the example you provided works, I'm
> wondering if there is a CPAN module which provides a more "elegant"
> interface to a multi-field, multidimensional array sort.  What I have in
> mind is an interface similar to Sort::Fields:
>
> @arr_order = ( [2, 'a'], [-1,'n'] );
>
> @sorted = sort_module( $arr_input, \@arr_order );
>
> This would translate as sort what's in array $arr_order alphabetically by
> position 2, then numerically reversed by position 1.
>
> Input parameter 1 is the array to be sorted, parameter 2 is an array
> (@arr_order) containing the index position of the array columns we want to
> sort on, along with an alphabetic (a) or numeric (n) sort type.  A negative
> sign indicates a reverse sort.  The benefit of this is to be able to call 1
> function that can be passed parameters dynamically (as opposed to
> dynamically modifying code with $a and $b, cmp, <=>, etc.).

I'm not especially sure I agree that your method would be more 'elegant'.
Really what you've suggested is to write a wrapper around sort() that
would restrict its functionality.  I'm not convinced that's a good idea.
(I'm also not sure I understand what you mean by your last sentence - $a
and $b are two predefined variables common to every single sort
subroutine, and cmp vs <=> simply means asciibettical vs numerical)

Disregarding all that, however, it probably wouldn't be too hard to write
such a wrapper:

use strict;
use warnings;

my ($array, $config); #'global', because will be used in two functions

sub sort_module(\@\@){
	($array, $config) = @_;
	#error checking here to make sure arrays are what you want
	sort with_elegance (@$array);
}

sub with_elegance{
	my $return;
	foreach my $dimension (@$config){
		my $pos = (abs $$dimension[0]) - 1;
		my $compare;
		if ($$dimension[1] eq 'a'){
			$compare = 'cmp';
		} elsif($$dimension[1] eq 'n') {
			$compare = '<=>';
		} else {
			die "Invalid comparison marker: $$dimension[1] ".
			     "(only 'a' and 'n' allowed\n";
		}
		if ($$dimension[0] >= 0){
			eval '$return = $$a[$pos] '.$compare.' $$b[$pos]';
		} else {
			eval '$return = $$b[$pos] '.$compare.' $$a[$pos]';
		}
		last unless $return == 0;
	}
	return $return;
}

my @arr_input = (  [1, 'a', 'dom'],
				[5, 'g', 'brad'],
				[3, 'd', 'jamie'],
				[7, 'd', 'abigail']
			  );

my @arr_order = ( [2, 'a'], [-1,'n'] );
my @sorted = sort_module( @arr_input, @arr_order );

foreach (@sorted) {
	print "@$_\n";
}

__END__


Give that a shot and see if it does what you want.  Note that I whipped
this up in just a few moments, and it shows.  Among the things that should
probably be fixed are the use of global variables, die() should become
carp or croak if this were put into an actual module, and the use of the
eval function.  Not to mention there's probably more than a few ways to
optimize it....

Paul Lalli


------------------------------

Date: Tue, 27 Apr 2004 17:06:39 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: multi-field array sort using Sort::Fields method
Message-Id: <20040427170523.N1107@dishwasher.cs.rpi.edu>

On Tue, 27 Apr 2004, Paul Lalli wrote:

> On Tue, 27 Apr 2004, Domenico Discepola wrote:
>
> > Thanks for your concrete example - it helps while trying to understand the
> > existing documentation.  Although the example you provided works, I'm
> > wondering if there is a CPAN module which provides a more "elegant"
> > interface to a multi-field, multidimensional array sort.  What I have in
> > mind is an interface similar to Sort::Fields:
> >
> > @arr_order = ( [2, 'a'], [-1,'n'] );
> >
> > @sorted = sort_module( $arr_input, \@arr_order );
> >
> > This would translate as sort what's in array $arr_order alphabetically by
> > position 2, then numerically reversed by position 1.
> >
> > Input parameter 1 is the array to be sorted, parameter 2 is an array
> > (@arr_order) containing the index position of the array columns we want to
> > sort on, along with an alphabetic (a) or numeric (n) sort type.  A negative
> > sign indicates a reverse sort.  The benefit of this is to be able to call 1
> > function that can be passed parameters dynamically (as opposed to
> > dynamically modifying code with $a and $b, cmp, <=>, etc.).
>
> I'm not especially sure I agree that your method would be more 'elegant'.
> Really what you've suggested is to write a wrapper around sort() that
> would restrict its functionality.  I'm not convinced that's a good idea.
> (I'm also not sure I understand what you mean by your last sentence - $a
> and $b are two predefined variables common to every single sort
> subroutine, and cmp vs <=> simply means asciibettical vs numerical)
>
> Disregarding all that, however, it probably wouldn't be too hard to write
> such a wrapper:

And of course, I did things bass-ackwards and coded before checking CPAN.
I wonder if this would suffice for what you're looking for:
http://search.cpan.org/~evo/Data-Sorting-0.9/Sorting.pm

It doesn't have quite the same interface you wanted, but it's similar.

Paul Lalli


------------------------------

Date: 27 Apr 2004 21:29:21 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: multi-field array sort using Sort::Fields method
Message-Id: <c6mjbh$tj$1@mamenchi.zrz.TU-Berlin.DE>

Domenico Discepola <domenico_discepola@quadrachemicals.com> wrote in comp.lang.perl.misc:
> Hello all.  My goal is to be able to perform a "multi-field sort on a
> multidimensional array".  Having read many posts in the newsgroups, I was
> unable to find a "straight" answer to this problem.  I therefore came up
> with this method.  My question is, is there a more efficient solution to
> this problem or is my method acceptable?  Is there another CPAN module that
> can be used?  I welcome all opinions.

Okay, the code is a bit pointless, because sorting an array of arrays via
Sort::Fields is backwards.  Still, a few remarks:

> #!perl
> use strict;
> use warnings;

Good.

> use Sort::Fields;
> 
> my ( @arr01, @arr02, $r, $c, $string, $aref, $delim, @arr_temp,
> @arr_final );

It is usually preferred to declare variables where they first appear.
Some languages don't support this and force you to lump all declarations
together.  That doesn't mean it's good style.

> @arr01 = (  [1, 'a', 'dom'],
>   [5, 'g', 'brad'],
>   [3, 'd', 'jamie'],
>   [7, 'd', 'abigail']);
> 
> $delim = "\t";
> $string = "";
> 
> #Step 1 - combine fields into 1 string so that Sort::Fields will work
> for $r ( 0 .. $#arr01 ) {
>  $aref = $arr01[$r];

You don't need the index ($r) in the loop, so you could have iterated
over @arr01 directly:

    for my $aref ( @arr01 ) {

>         for $c ( 0 .. $#{$aref} ) {
>          if ( $c == $#$aref ) {
>           $string = $string . $arr01[$r][$c];
>          } else {
>           $string = $string . $arr01[$r][$c]. $delim ;
>          }
>         }
>         push @arr02, $string;

Uh, oh!  Perl has a function for what that loop does, it's called join:

     push @arr2, join $delim, @$aref;

 ...does exactly the same thing.

>         $string = "";

If you had declared $string inside the loop body you wouldn't have to
worry about clearing it.  "my" does that at run time.

Your outer loop does nothing but collect the results of a calculation
into a list.  Again, Perl has a function for that, called "map":

    my @arr02 = map join( $delim, @$_) => @arr01;

is a more idiomatic replacement for your code to this point.

> }
> 
> #Step 2 - sort by field 2, then 3
> my @sorted = fieldsort '\t', [2,3], @arr02;
> 
> #Step 3 - split sorted strings into mutidim array
> foreach my $el ( @sorted ) {

Ah, good.  An index-free loop where no index is needed.

>  @arr_temp = split $delim, $el;
>  push @arr_final, [@arr_temp];
> }

Why the intermediate @arr_temp?  "[ split $delim, $el]" works as well.
The loop could again be replaced by map:

    @arr_final = map [ split $delim, $_], @sorted;

> #Step 4 - final output
> print join('|', @$_), "\n" for @arr_final;

Hey, you know about "join".  Why did you re-invent it up there?  In
general, the second half of your code looks smoother than the part
before "fieldsort ...".

Having reduced all of the loops to map, the whole thing can be written
as one statement (untested, as is the above):

    print join( '|', @$_), "\n" for
        map [ split $delim, $_] =>
        fieldsort '\t', [2,3] =>
        map join( $delim, @$_) => @arr01;

This is not everyone's idea of good style, but I think in this case it's
quite readable.

Anno


------------------------------

Date: Tue, 27 Apr 2004 12:24:23 -0800
From: "Robin" <robin @ infusedlight.net>
Subject: Re: Newbie: Looking for comments on this (working) script
Message-Id: <c6mabe$22ou$1@news.f.de.plusline.net>



> sub run_id3v2 (@)

what's this supposed to do? Which perldoc can I find out in?

Thanks,
-Robin





------------------------------

Date: Tue, 27 Apr 2004 15:02:25 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Newbie: Looking for comments on this (working) script
Message-Id: <20040427150004.Q1107@dishwasher.cs.rpi.edu>

On Tue, 27 Apr 2004, Robin wrote:

> > sub run_id3v2 (@)
>
> what's this supposed to do? Which perldoc can I find out in?
>

Do you even *try* before posting here?  Gee, it's having to do with a
subroutine, you think *maybe* it might be in the documentation for
subroutines?

perldoc perlsub
it's called a prototype, although this particular one is rather useless.
Can you read the documentation and tell us why, Robin?

Paul Lalli


------------------------------

Date: Tue, 27 Apr 2004 13:20:51 -0800
From: "Robin" <robin @ infusedlight.net>
Subject: Re: Newbie: Looking for comments on this (working) script
Message-Id: <c6mbu8$23pl$1@news.f.de.plusline.net>

> > > sub run_id3v2 (@)
> >
> > what's this supposed to do? Which perldoc can I find out in?
> >
>
> Do you even *try* before posting here?  Gee, it's having to do with a
> subroutine, you think *maybe* it might be in the documentation for
> subroutines?
>
> perldoc perlsub
> it's called a prototype, although this particular one is rather useless.
> Can you read the documentation and tell us why, Robin?

because he really isn't using any references? I scanned the perlsub docs,
and this is probably wrong, but I have to write a paper.
-Robin







------------------------------

Date: Tue, 27 Apr 2004 15:55:31 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Newbie: Looking for comments on this (working) script
Message-Id: <20040427154701.S1107@dishwasher.cs.rpi.edu>

On Tue, 27 Apr 2004, Robin wrote:

> > > > sub run_id3v2 (@)
> > >
> > > what's this supposed to do? Which perldoc can I find out in?
> > >
> >
> > Do you even *try* before posting here?  Gee, it's having to do with a
> > subroutine, you think *maybe* it might be in the documentation for
> > subroutines?
> >
> > perldoc perlsub
> > it's called a prototype, although this particular one is rather useless.
> > Can you read the documentation and tell us why, Robin?
>
> because he really isn't using any references? I scanned the perlsub docs,
> and this is probably wrong, but I have to write a paper.
> -Robin

Almost correct, actually.  A prototype of (@) tells perl "Only accept a
list of arguments" (as opposed to something like ($\@), which says "accept
a scalar value followed by an actual named array".  But accepting a list
of arguments is the default behavior for Perl subroutines.  Therefore,
using a prototype of (@) is no different than not using a prototype at
all.  (it is very different, however, from using an empty prototype, like
sub myfunc() )

To clarify, prototypes do not have to have anything to do with references.
They can be used to restrict the number and type of arguments passed to
subroutines.  For example:

sub myfunc($$) {

This function will only accept two scalar values.  They can be any scalar
values you want, be them strings literals, numeric literals, named scalar
variables, or yes, references.  But the following function calls are all
permitted:

myfunc("foo", 'bar');
myfunc(1, $string);
myfunc('', 0);

none of which do any conversions to references.  In this case, the
prototype could be in place to cause fatal errors for any of these
function calls:

myfunc ("foo", "bar", "baz");
myfunc (42);
myfunc ();
@ten = (1..10);
myfunc (@ten);


Paul Lalli


------------------------------

Date: Tue, 27 Apr 2004 21:17:03 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Newbie: Looking for comments on this (working) script
Message-Id: <408ECDCC.24D50C35@acm.org>

"Trebor A. Rude" wrote:
> 
> I've been trying to learn Perl in recent days, and was hoping the group
> could offer some pointers on my first attempt to do something useful (to
> me, anyway) with it. To that end, any constructive comments, suggestions,
> etc. on this script would be appreciated.
> 
> The script takes a list of .ogg files on the command line and reads the tag
> information from them (which come out in "key=value" form), then uses it to
> construct a command to put the same tag information into a
> corresponding .mp3 file (I prefer .oggs for listening on my computer, but
> my car's CD player only works with audio or MP3 CDs). Here it is:
> 
> #!/usr/bin/perl
> 
> use warnings;
> use strict;
> use vars '$file';

You don't really need a $file package variable.


> my %options = (title => '-t',
>                artist => '-a',
>                album => '-A',
>                tracknumber => '-T');
> 
> sub run_id3v2 (@)

You don't really need the (@) prototype as that is the default behavior
for subs.


> {
>   my @command = ("id3v2", @_, $file);

Without the $file package variable this would be:

  my @command = ( 'id3v2', @_ );


>   return system(@command) == 0;
> }
> 
> foreach (@ARGV)
> {
>   $file = $_;

foreach my $file ( @ARGV ) {


>   my @output = `vorbiscomment -l \Q$file\E 2>&1`;

You could use chomp() here instead of later in map.

  chomp( my @output = `vorbiscomment -l \Q$file\E 2>&1` );


>   if ($? != 0)
>   {
>     print "Problems reading tags from $file, skipping it:\n", @output;
>     next;
>   }
> 
>   my %comments = map { chomp; split /=/, $_, 2 } @output;

Without the chomp() this would become:

  my %comments = map split( /=/, $_, 2 ), @output;


However, it looks like you are not using anything after the '='.

  my @comments = map /^([^=]+)/, @output;


>   my @arguments = ();
> 
>   # Also considered using (if this is strange indentation, thank
>   # cperl-mode):
>   #
>   # push @arguments,
>   #   map {($options{$_}, $comments{$_})}
>   #     grep exists $options{$_}, keys %comments;
> 
>   push @arguments,

You are declaring @arguments and then pushing values into it.  Why not
just assign the values when you declare it?

>     map {exists $options{$_} ? ($options{$_}, $comments{$_}) : ()}
>       keys %comments;

    my @arguments =
        map {exists $options{$_} ? ($options{$_}, $_) : ()}
            @comments;


>   $file =~ s/\.ogg/.mp3/;

You probably only want to match /\.ogg/ if it is at the end of $file.

   $file =~ s/\.ogg$/.mp3/;


>   run_id3v2('-D') or die "Problem removing old tags from $file.";
>   run_id3v2(@arguments) or die "Problem adding new tags to $file.";
>   run_id3v2('-s') or die "Problem removing new id3v1 tags from $file.";
> }

With $file now local to the foreach loop you need to add it to the
argument list.

  run_id3v2( '-D', $file ) or die "Problem removing old tags from
$file.";
  run_id3v2( @arguments, $file ) or die "Problem adding new tags to
$file.";
  run_id3v2( '-s', $file ) or die "Problem removing new id3v1 tags from
$file.";
}


HTH

John
-- 
use Perl;
program
fulfillment


------------------------------

Date: Tue, 27 Apr 2004 21:40:01 +0100
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Odd behavior of mod_perl's PerlSetEnv with PERL5LIB
Message-Id: <pkent77tea-B4E89B.21400127042004@pth-usenet-01.plus.net>

In article <a78026a1.0404261346.4350a717@posting.google.com>,
 tony@skelding.co.uk (Tony Skelding) wrote:

> I am using a PerlSetEnv directive in order to have PERL5LIB set to a
> directory list at request time.  But the directories are being added
> to @INC in reverse order.

We've noticed this at work too. I believe it's a known issue and our 
workaround is to do:

Set Env PERL5LIB lookherefirst:lookheresecond:lookherefirst

to cover both the CGI and mod_perl possibilities. Personally I have no 
idea why it does it, and I certainly don't think it's desirable, but 
you're not the only one to notice it

P

-- 
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply


------------------------------

Date: Tue, 27 Apr 2004 11:28:00 -0400
From: Dan Wilga <dwilga-MUNGE@mtholyoke.edu>
Subject: Re: perl & Mac G4
Message-Id: <dwilga-MUNGE-B8B432.11280027042004@nap.mtholyoke.edu>

In article <QStjc.4976$Jy3.2087@fed1read03>,
 The King of Pots and Pans <King@ask.for.email.invalid> wrote:

> I am thinking about getting a Powerbook G4. Does perl work on it?

5.8.1 even comes pre-installed.

-- 
Dan Wilga          dwilga-MUNGE@mtholyoke.edu
** Remove the -MUNGE in my address to reply **


------------------------------

Date: 27 Apr 2004 15:40:52 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: perl & Mac G4
Message-Id: <c6luu4$cd2$1@canopus.cc.umanitoba.ca>

In article <dwilga-MUNGE-B8B432.11280027042004@nap.mtholyoke.edu>,
Dan Wilga  <dwilga-MUNGE@mtholyoke.edu> wrote:
:In article <QStjc.4976$Jy3.2087@fed1read03>,
: The King of Pots and Pans <King@ask.for.email.invalid> wrote:

:> I am thinking about getting a Powerbook G4. Does perl work on it?

:5.8.1 even comes pre-installed.

I have, though, found on a (non-powerbook) G4 running Jaguar before
and now Panther, that Apple's supplied perl and fink and CPAN
do not get along very well together. When you use CPAN to
install a module, then CPAN does not inform the debian package
database, and then fink ends up complaining that you do not have
the right prereqs for perl modules you try to install that way.
And if you fink around with other versions of perl (e.g.,
5.8.4 was released last week), then you can really get yourself
into a mess. You have to be very careful about how some of the
perl modules visible through fink are marked as placeholders and
some of them are the actual module...

Of course, if you try to manage everything through Apple's supplied
perl and CPAN, and skip over the perl stuff in fink, then you
run into the problem that fink wants perl as the prereq for some
of the other packages...
-- 
The Knights Of The Lambda Calculus aren't dead --this is their normal form!


------------------------------

Date: Tue, 27 Apr 2004 17:16:07 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: perl & Mac G4
Message-Id: <T_Gdnf9CQ44KUBPdRVn-vg@adelphia.com>

The King of Pots and Pans wrote:

> I am thinking about getting a Powerbook G4. Does perl work on it?

It works very well, although the latest OS includes a slightly dated version
- 5.8.1RC3.

For info about writing GUI apps, and a complete hassle-free installation of
5.8.4 with a plethora of database and XML modules included, see my .sig.

sherm--


-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


------------------------------

Date: Tue, 27 Apr 2004 21:43:23 GMT
From: The King of Pots and Pans <King@ask.for.email.invalid>
Subject: Re: perl & Mac G4
Message-Id: <%tAjc.6594$Jy3.4799@fed1read03>

On Tue, 27 Apr 2004 at 21:16 GMT, Sherm Pendley spoke:

> For info about writing GUI apps, and a complete hassle-free
> installation of 5.8.4 with a plethora of database and XML modules
> included, see my .sig.

Is this something like Perl/Tk? Is Perl/Tk used for GUI scripting on
Mac? Or is Perl/Cocoa the most common combination? 

-- 
The King of Pots and Pans


------------------------------

Date: Tue, 27 Apr 2004 18:00:35 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: perl & Mac G4
Message-Id: <6e6dnV8Xq5KYRRPdRVn-sA@adelphia.com>

The King of Pots and Pans wrote:

> Is this something like Perl/Tk?

Well, naturally the details of the particular tool set and API are entirely
different. But it's the same basic idea - an event-driven GUI toolkit.

> Is Perl/Tk used for GUI scripting on 
> Mac? Or is Perl/Cocoa the most common combination?

I'm fairly certain that Perl/Tk can be used, but it produces X11 apps. Apple
includes a built-in X11 server with Panther, so X11 apps are perfectly
functional. But they don't look and feel like native apps, and depending on
who your users are, that could potentially be a cause of complaint.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 6478
***************************************


home help back first fref pref prev next nref lref last post