While the existing perl code isn't the best either, yours is extremely
inefficient, you should rework it using native functions.

> +             system("find $cache -follow -name $filename 2>/dev/null 1>> 
> temp.dls");
perldoc -f open

> +             my $lines = `cat temp.dls | wc -l`;
perldoc -f length, perldoc perlvar

> +             if ($lines != 1 ) {
($lines > 1) ?

> +                     system("echo Error : Number of instances of $filename 
> in $cache is $lines");
> +                     system("echo Only one instance allowed.");
perldoc -f print, perldoc -f warn

> +                     system("rm -f temp.dls");
perldoc -f unlink

> +                     return;
> +             }
> +             else {
> +                     system("cat temp.dls | xargs -i cp -vf {} 
> $target/$filename.dl");
perldoc -f open, perldoc -f readline
Also google "useless use of cat".

> +                     system("rm -f temp.dls");
perldoc -f unlink

> +             }
>               system("$md5cmd $target/$filename.dl > 
> \"$target/$filename.md5sum\" ") == 0 or return;
>       } else {
>               open WGET, "wget -t5 --timeout=20 --no-check-certificate 
> $options -O- \"$mirror/$filename\" |" or die "Cannot launch wget.\n";


~ Jow
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to