[PLUG] Need help finding package with 'rename'

Brian Horan bhoran at hexdev.com
Fri May 3 20:50:11 UTC 2002


actually you may want to increment $#ARGV by 1, hence the ++$#ARGV
because of some perl-weirdness.  To make it clean, i would recommend adding 
the following line to the script  before the if() block:

$ARGC = ++$#ARGV;

you could also use:

$ARGC = ($#ARGV +1);

or:
$ARGC = length scalar @ARGV;

Arrays in perl are nifty things.... 

On Friday 03 May 2002 04:16 pm, you wrote:
> Yeah, you're right, I fudged the script, doh, but you can change $ARGC
> to $#ARGV and it should work.
>
> --Shahms
>
> On Fri, 2002-05-03 at 13:31, Brian Horan wrote:
> > I don't recall $ARGC being automatically defined and filled in with
> > perl... because $ARGV[0] in perl is equivalent to argv[1] in C (if you
> > call it that which you should, I guess)
> >
> > is $ARGC defined as ++$#ARGV (or some other less sloppy construct)?
> >
> > the if() conditional appears to be failing because of $ARGC, but I
> > haven't seen the whole script so I can't be sure..
> >
> > On Friday 03 May 2002 03:36 pm, you wrote:
> > >   I don't see the source of the error, perl gurus.
> > >
> > >   This is the line calling the 'rename' script:
> > >
> > > /usr/lib/rpm/rename.pl so.%{solibbase} so.%{version}
> > > $RPM_BUILD_ROOT/lib/*.so.%{solibbase}
> > >
> > > and here is the first few lines of the script that generates the error:
> > >
> > > #!/usr/bin/perl -w
> > >
> > > if ( $ARGC < 3 ) {
> > >         usage();
> > >         exit(1);
> > > }
> > >
> > >   The error message cits the usage text:
> > >
> > > sub usage
> > > {
> > >         print "$0 <from> <to> <files...>\n";
> > > }
> > >
> > >   Looks to me like three arguments. Could it be the globbing that
> > > causes the problem?
> > >
> > > Thanks,
> > >
> > > Rich
> > >
> > >
> > > _______________________________________________
> > > PLUG mailing list
> > > PLUG at lists.pdxlinux.org
> > > http://lists.pdxlinux.org/mailman/listinfo/plug
> >
> > --
> > Brian Horan
> > bhoran at hexdev.com
> >
> > _______________________________________________
> > PLUG mailing list
> > PLUG at lists.pdxlinux.org
> > http://lists.pdxlinux.org/mailman/listinfo/plug
>
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug

-- 
Brian Horan
bhoran at hexdev.com




More information about the PLUG mailing list