[19994] in Perl-Users-Digest
Perl-Users Digest, Issue: 2189 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 23 09:10:32 2001
Date: Fri, 23 Nov 2001 06:10:17 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1006524616-v10-i2189@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 23 Nov 2001 Volume: 10 Number: 2189
Today's topics:
I need help with a project... (J Capenos)
Re: I need help with a project... <5l259r001@sneakemail.com>
Re: passing hash reference to function: bug? <pne-news-20011123@newton.digitalspace.net>
print current time <andrey@flyg.kth.se>
Re: print current time <edgue@web.de>
Re: print current time (Rafael Garcia-Suarez)
Problems adding module to path <borgehaga@hotmail.com>
Re: Problems adding module to path (Anno Siegel)
Re: Problems adding module to path <bart.lateur@pandora.be>
Re: Problems adding module to path <borgehaga@hotmail.com>
Problems with Mirror - ftp.pl doesn't get the right oct (Dirk)
Re: Problems with Mirror - ftp.pl doesn't get the right (Rafael Garcia-Suarez)
Re: Problems with Mirror - ftp.pl doesn't get the right (Anno Siegel)
Re: Problems with Mirror - ftp.pl doesn't get the right <bart.lateur@pandora.be>
Re: Problems with Mirror - ftp.pl doesn't get the right <bart.lateur@pandora.be>
Re: Problems with Mirror - ftp.pl doesn't get the right (Anno Siegel)
Re: Problems with Mirror - ftp.pl doesn't get the right (Garry Williams)
Re: Script for stripping FONT (HTML) tags (Malcolm Dew-Jones)
Re: Script for stripping FONT (HTML) tags <bart.lateur@pandora.be>
Re: Script for stripping FONT (HTML) tags (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 Nov 2001 05:14:46 -0800
From: jcapenos@yahoo.com (J Capenos)
Subject: I need help with a project...
Message-Id: <f417bbc8.0111230514.18a3f999@posting.google.com>
Database scripts and admin area are already set up. I just need the
following work done in conjunction with the existing scripts.
Any Perl people out there in the $30 to $40 per hour range that would
be willing to work on this??
I need it done in short order also.
Creation of report generating scripts for an online auction house.
(Section VI Report Generation) and user interface to launch the
reports.
Reports will be tested using Internet Explorer and our local printer.
IE will be required to support correct page breaks.
Description of data entry/report generation process.
I. Register Buyers
Each person placing bids at the auction will be registered.
II. Register Consignors
Each person consigning goods for sale at this auction will be
registered.
Note: Consignors are assigned a matching buyer number for
purchases
made at an auction. (ie - if consigner #45 is also registering
to buy
he will be assigned buyer #45)
III. Create Auctions
Each Auction is entered into the database
IV. Clerk Items
Each item sold at auction will be clerked into the database.
item# (auto-increment), bidder#, lot#, quantity, description,
consignor, state, reserve, price each, auction #, deposit,
buyers premium, cost, sales tax
V. Clerk Payments
Each payment received at the auction will be clerked into the
database.
payment# (auto-increment), auction#, lot#, invoice#,
description,
payment1, payment1 type
VI. Report Generation
A. Generate Invoices :
A summary of all entries in the clerkitems table for each buyer id
for each auction. Invoices will be generated after all items
have been clerked into the system (step IV) and will be used
to
reference all payments clerked in step V.
Format:
HEADER
Buyer Number invoice #
Buyer Name time
Buyer Address phone date
--------------------------------------------------------
lot#, qty, description, amount, buyer premium, sales tax
lot#, qty, description, amount, buyer premium, sales tax
lot#, qty, description, amount, buyer premium, sales tax
lot#, qty, description, amount, buyer premium, sales tax
lot total purchases total1, total2, total3
sub total : total1 +
total2 + total3
3% Buyer Charge : xxxxx (DEBIT:
buyerreg/buyercharge * sub total)
cash discount : xxxxx-
(CREDIT: buyerreg/buyercharge * sub total)
----------
Invoice Total : xxxxx
FOOTER
Database annotations :
Buyer number : buyerreg/buyer
Buyer Name : buyerreg/firstname buyerreg/middleinitial
buyerreg/lastname
Buyer Address : buyerreg/address buyerreg/city
buyerreg/state buyerreg/zip
Buyer Phone : buyerreg/dayphone1
Invoice #: : generated by script
lot : clerkitems/lot
qty : clerkitems/quantity
amount : clerkitems/cost
buy prem : clerkitems/buyer_premium
Invoice information will be saved in invoice table:
unique id, invoice#, auction#, buyer#, salestotal (total1),
invoicetotal, totalbuyerpremium (total2),
totalbuyercharge, salestax (total3)
Report 2: RECAP OF BUYER INVOICES
A summary of all invoices and payments per buyer per auction
Format:
HEADER
buyer#, invoice#, invoice total, sales, sales tax, buyer
premium,
*buyer chg, check payments, cash payments, credit card
payments, other,
balance due
total, total, total, ...
Non-tax sales : xxxx non-taxed premium: xxxx Visa
Payments: xxxx
taxable sales : xxxx taxable premium : xxxx MC Payments
: xxxx
total taxable : xxxx Sales Tax collected : xxxxx
Database annotations:
buyer# : invoice/buyer
invoice# : invoice/invoice#
invoice total : invoice/totalinvoice
sales : invoice/salestotal
sales tax : invoice/salestax
buyer premium : invoice/totalbuyerpremium
buyer chg : invoice/totalbuyercharge
check payments : clerkpayments/payment1 (2,3,4..) where
paymentmethod1 (2,3,4..) = check
cash payments :clerkpayments/payment1 (2,3,4..) where
paymentmethod1 (2,3,4..) = cash
credit card payments : clerkpayments/payment1 (2,3,4..) where
paymentmethod1 (2,3,4..) = mc or visa
other : clerkpayments/payment1 (2,3,4..) where
paymentmethod1 (2,3,4..) = other
balance due : invoice total - total payments
Report 3: BUYER INVOICES WITH BALANCE DUE
Summary report of any open invoices (with balance due)
When generating the recap of buyer invoices, any invoices
showing a
balance due will generate an additional line in this report.
Format:
HEADER
Buyer name, address, phone
buyer#, invoice#, inv total, sales, tax, buyer premium, buyer
chg,
cash payment, visa payment, mc payment, other payment, balance
due
total balance due:
xxxx
Database annotations:
buyer# : invoice/buyer
Buyer Name : buyerreg/firstname buyerreg/middleinitial
buyerreg/lastname
Buyer Address : buyerreg/address buyerreg/city
buyerreg/state buyerreg/zip
Buyer Phone : buyerreg/dayphone1
invoice# : invoice/invoice#
invoice total : invoice/totalinvoice
sales : invoice/salestotal
sales tax : invoice/salestax
buyer premium : invoice/totalbuyerpremium
buyer chg : invoice/totalbuyercharge
check payments : clerkpayments/payment1 (2,3,4..) where
paymentmethod1 (2,3,4..) = check
cash payments :clerkpayments/payment1 (2,3,4..) where
paymentmethod1 (2,3,4..) = cash
credit card payments : clerkpayments/payment1 (2,3,4..) where
paymentmethod1 (2,3,4..) = mc or visa
other : clerkpayments/payment1 (2,3,4..) where
paymentmethod1 (2,3,4..) = other
balance due : invoice total - total payments
Report 4: CONSIGNOR SETTLEMENT
Summary of balances due to consignors (ie reverse of buyer
invoices)
Format:
HEADER
buyer, item#, lot #, qnty, description, sales price,
commission
...
total lots total sales, total
commission
Expenses : expensea_desc expensea
expenseb_desc expenseb
expensec_desc expensec
expensed_desc expensed
expensee_desc expensee
expensetotal
Commission - total lots
Commission xxxx (total of clerkitems
commpercentage column)
Commission A xxxx (total of clerkitems
commtypea column)
Commission B xxxx (total of clerkitems
commtypeb column)
Commission C xxxx (total of clerkitems
commtypec column)
Commission D xxxx (total of clerkitems
commtyped column)
total
Note: Commission 1 is a straight percentage of the sale
Commission A-D is a flat fee
Database Annotation:
Buyer : clerkitems/bidder
item# : clerkitems/RecordID
lot : clerkitems/lot
qty : clerkitems/quantity
description : clerkitems/description
amount : clerkitems/cost
commission : clerkitems/commpercentage * amount or
clerkitems/commtypea or clerkitems/commtypeb
or clerkitems/commtype
or clerkitems/commtyped
Consignor Recap information will be saved in consrecap table:
unique id, recap #, auction#, consignor#, totallots,
totalsales, totaltax, totalcomm, expensea,
expenseb, expensec, expensed, expensee
Report 5: CONSIGNOR SETTLEMENT RECAP
A summary of all consignments from consrecap
Format:
HEADER
buyer#, consignor name, consignor#, total # of lots, sales,
sales tax, balance due to consignor, purchases, commission, expense,
payment recd*
total, total, total, ...
Total paid to consignors: xxxxx (total
of sales)
Total due to consignors : xxxxx (total
of balance due to consignor)
xxxxx exp 1 ** (total of clerkitems expense column)
xxxxx exp 2 ** (total of clerkitems expenseb column)
xxxxx exp 3 ** (total of clerkitems expensec column)
xxxxx exp 4 ** (total of clerkitems expensed column)
xxxxx exp 5 ** (total of clerkitems expensee column)
NOTE:
* - payment received will be shown for any consignors who's
end balance is
0 after any purchases and commissions are applyed to the
balance due to
consignor
Database Annotation:
Buyer : clerkitems/bidder
consignor name : consreg/firstname, middleinital, lastname
consignor # : clerkitems/consignor
total lots : consrecap/totallots
sales : consrecap/totalsales
totaltax : consrecap/totaltax
balance due :
purchases : total of clerkitems/cost where
clerkitems/bidder = this consignor #
commission : consrecap/totalcomm
expense : total of
consrecap/expensea+consrecap/expenseb+consrecap/expensec+
consrecap/expensed+consrecap/expensee
Report 6: NEGATIVE AMOUNTS DUE OR PAID BY CONSIGNORS
A summary of all consinor recaps where there is a negative amount due
or paid by the consignor. When generating the consignor recap,
any consignor owed money
(where balance due - purchases > 0) will generate an
additional line in this report
HEADER
consignor#, consignor name, amount due
...
Total due
consignor# : consrecap/consignor#
Buyer Name : consreg/firstname consreg/middleinitial
consreg/lastname
Buyer Address : consreg/address consreg/city consreg/state
consreg/zip
Buyer Phone : consreg/dayphone1
invoice total : consrecap/totalsales - total of
clerkitems/cost where clerkitems/bidder = this consignor #
User Interface :
Simple menu screen will list 4 options to generate 4 report groups.
1. BUYER INVOICES
2. RECAP OF BUYER INVOICES and BUYER INVOICES WITH BALANCE DUE
3. CONSIGNOR SETTLEMENT
4. CONSIGNOR SETTLEMENT RECAP and NEGATIVE AMOUNTS DUE OR PAID BY
CONSIGNORS
Each option will take the input of the auction# and will generate the
reports for each category. Reports per buyer number or consignor
number
are not possible.
DATABASE DEFINITION:
The data
will be exported from the current host and then imported into
a local mysql database. The invoice table and consrecap table will be
created by the report generating script.
------------------------------
Date: Fri, 23 Nov 2001 15:00:25 +0100
From: "Steffen Müller" <5l259r001@sneakemail.com>
Subject: Re: I need help with a project...
Message-Id: <9tlknr$cqh$04$1@news.t-online.com>
jobs.perl.org. Job offers aren't on-topic here.
Steffen
--
$_=q;0cb212c210b0bb010c0113bb0c410c0b516c0bb3d212c2b0b0b016b6cb2b2c21010c0
b41110b3bba0e0c0d2c4b2b6bc013d2c0d0b01012b0b0;;s/\n//g;s/(\d)/$1<2?$1:'0'x
$1/ge;s/([a-f])/'1'x(ord($1)-97)/ge;$o=$_;push@o,substr($o,$_*8,8) for(0..
24);for(@o){print"\0"x(26-$i).chr(oct('0b'.($_)))."\r";$i++};print"\n"#stm
------------------------------
Date: Fri, 23 Nov 2001 08:36:08 +0100
From: Philip Newton <pne-news-20011123@newton.digitalspace.net>
Subject: Re: passing hash reference to function: bug?
Message-Id: <petrvt4sdirl2uphqvgj4irtepvk3hr9b2@4ax.com>
On Thu, 22 Nov 2001 15:17:06 +0100, Jean-Luc Fontaine
<jfontain@winealley.com> wrote:
> The following code:
>
> sub f(\%) {my ($p) = @_;}
> my %h;
> f(\%h);
Why are you using a prototype of (\%)? That automatically takes a
reference to a hash you pass, so you should just call it as f(%h).
If you're going to create the reference by hand anyway, you might as
well leave off the prototype:
sub f { my($p) = @_; }
my %h;
f(\%h);
Prototypes are not required on subs.
> whereas the same (!!!) code but with the function in a separate file works:
That's because prototypes are not checked in that case.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Fri, 23 Nov 2001 09:51:09 +0100
From: Andrey Shipsha <andrey@flyg.kth.se>
Subject: print current time
Message-Id: <3BFE0DFD.67E9DABF@flyg.kth.se>
Hello,
I am looking for a command which prints current time when some event in
my code has occurred.
Are there any simple means for that in Perl?
Cheers,
Andrey.
------------------------------
Date: Fri, 23 Nov 2001 10:06:10 +0100
From: Edwin =?iso-8859-1?Q?G=FCnthner?= <edgue@web.de>
Subject: Re: print current time
Message-Id: <3BFE1182.64054E5E@web.de>
Andrey Shipsha wrote:
> Are there any simple means for that in Perl?
No. you need to write a programm in PL8, compile it and
call it via xs.
Uups. I lied. See
perldoc -f time
;-)
regards,
eg
------------------------------
Date: 23 Nov 2001 09:07:33 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: print current time
Message-Id: <slrn9vs4g7.2kf.rgarciasuarez@rafael.kazibao.net>
Andrey Shipsha wrote in comp.lang.perl.misc:
>
> I am looking for a command which prints current time when some event in
> my code has occurred.
>
> Are there any simple means for that in Perl?
my $t = localtime;
print "$t\n";
see the entry for localtime() in perlfunc for more info.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Fri, 23 Nov 2001 13:32:50 +0100
From: "Boerge Haga" <borgehaga@hotmail.com>
Subject: Problems adding module to path
Message-Id: <XlrL7.290$v05.3540@news1.oke.nextra.no>
I have no root privileges. Since I need a module not installed
in the perl installation on my server I have installed it local to
my own user.
I then wrote the following in the Perl-script:
use MD5 "/home/users/myuser/Modules/MD5-1.7";
mymachine(myuser) bin 511$ myscript
Can't locate MD5.pm in @INC at ./myscript line 19.
BEGIN failed--compilation aborted at ./myscript line 19.
mymachine(myuser) bin 512$
Line 19 is the "use MD5"-line.
I installed using:
perl Makefile.PL
make
make test
Did I miss anything?
Boerge
------------------------------
Date: 23 Nov 2001 13:00:41 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Problems adding module to path
Message-Id: <9tlh9p$6jf$3@mamenchi.zrz.TU-Berlin.DE>
According to Boerge Haga <borgehaga@hotmail.com>:
> I have no root privileges. Since I need a module not installed
> in the perl installation on my server I have installed it local to
> my own user.
> I then wrote the following in the Perl-script:
>
> use MD5 "/home/users/myuser/Modules/MD5-1.7";
What makes you think a second parameter to "use" tells it where to
look for the module? It doesn't. See perldoc use.
> mymachine(myuser) bin 511$ myscript
> Can't locate MD5.pm in @INC at ./myscript line 19.
> BEGIN failed--compilation aborted at ./myscript line 19.
> mymachine(myuser) bin 512$
You need to add the directory the module resides in to @INC. This
can be done via "use lib ..." (perldoc lib) or using an environment
variable (perldoc perlrun), among other possibilities.
Anno
------------------------------
Date: Fri, 23 Nov 2001 13:28:34 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Problems adding module to path
Message-Id: <1jjsvt0aiaci225svnu9rl26t4e5os3mlv@4ax.com>
Anno Siegel wrote:
>According to Boerge Haga <borgehaga@hotmail.com>:
>> I have no root privileges. Since I need a module not installed
>> in the perl installation on my server I have installed it local to
>> my own user.
>> I then wrote the following in the Perl-script:
>>
>> use MD5 "/home/users/myuser/Modules/MD5-1.7";
>
>What makes you think a second parameter to "use" tells it where to
>look for the module? It doesn't. See perldoc use.
And, that entry in perlfaq8:
How do I add a directory to my include path at runtime?
--
Bart.
------------------------------
Date: Fri, 23 Nov 2001 14:43:46 +0100
From: "Boerge Haga" <borgehaga@hotmail.com>
Subject: Re: Problems adding module to path
Message-Id: <sosL7.381$v05.4097@news1.oke.nextra.no>
Ok. Definitely a big misunderstanding on my part.
However, it still doesn't work.
I have now written:
use lib qw(/home/nfs/users/myhome/Modules/MD5-1.7);
use MD5;
But still get:
$ myscript
Can't find loadable object for module MD5 in @INC
(/home/nfs/users/myhome/Modules/MD5-1.7 /local/lib/perl5/sun4-solaris/5.003
/local/lib/perl5 /local/lib/perl5/site_perl/sun4-solaris
/local/lib/perl5/site_perl .) at
/home/nfs/users/myhome/Modules/MD5-1.7/MD5.pm line 20
BEGIN failed--compilation aborted at ./webpluck line 20.
$
My MD5-1.7 directory contains:
-r--r--r-- 1 borgeh borgeh 3177 Aug 12 1996 Changes
-r--r--r-- 1 borgeh borgeh 463 Aug 12 1996 MANIFEST
-rw-r--r-- 1 borgeh borgeh 0 Nov 23 12:57 MD5.bs
-rw-rw-r-- 1 borgeh borgeh 3562 Nov 23 12:57 MD5.c
-rw-rw-r-- 1 borgeh borgeh 6100 Nov 23 12:57 MD5.o
-r--r--r-- 1 borgeh borgeh 6828 Aug 12 1996 MD5.pm
-r--r--r-- 1 borgeh borgeh 1801 Aug 12 1996 MD5.xs
-rw-r--r-- 1 borgeh borgeh 20610 Nov 23 12:54 Makefile
-r--r--r-- 1 borgeh borgeh 515 Aug 12 1996 Makefile.PL
-r--r--r-- 1 borgeh borgeh 1743 Aug 14 1996 README
drwxrwxr-x 5 borgeh borgeh 4096 Nov 23 12:57 blib/
drwxr-xr-x 2 borgeh borgeh 4096 Aug 12 1996 examples/
-r--r--r-- 1 borgeh borgeh 1461 Aug 12 1996 global.h
-r--r--r-- 1 borgeh borgeh 1351 Aug 12 1996 md5.h
-r--r--r-- 1 borgeh borgeh 10961 Aug 12 1996 md5c.c
-rw-rw-r-- 1 borgeh borgeh 4848 Nov 23 12:57 md5c.o
-rw-rw-r-- 1 borgeh borgeh 0 Nov 23 12:57 pm_to_blib
-r--r--r-- 1 borgeh borgeh 3428 Aug 12 1996 test.pl
-r--r--r-- 1 borgeh borgeh 57 Aug 12 1996 typemap
I've tried to read FAQs and perldoc but seem to be stuck even
if I'm sure it's a minor mistale.
Any ideas?
Boerge
------------------------------
Date: 23 Nov 2001 02:47:50 -0800
From: dirk.drexler@web.de (Dirk)
Subject: Problems with Mirror - ftp.pl doesn't get the right octal for chmod
Message-Id: <6f50dc53.0111230247.7a581b57@posting.google.com>
Hi together,
I am using the perl-script mirror.pl (Lee McLoughlin) to mirror
files/dirs to a remote ftp server.
The file transfer works fine, but then it isn't able to change the
file mode value on the remote server (with chmod).
The following error occurs:
---> SITE CHMOD 100644 Testfile.txt
501 CHMOD: Mode value must be between 0 and 0777
octal 100644 and not octal 0644.
i examined the used script ftp.pl and found the following part:
if( $mapunixout ){
$path = eval "&$mapunixout( \$path, 'f' )";
}
&send( sprintf( "SITE CHMOD %o $path", $mode ) );
......
When I change the line to:
&send( sprintf( "SITE CHMOD 0644 $path", $mode ) );
everything works fine, but It's sick to code such silly things :-)
Does anyone know, how to implement the function, that I got the right
mode (octal 0644) ?
Thx
Regards
Dirk Drexler
------------------------------
Date: 23 Nov 2001 10:59:35 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Problems with Mirror - ftp.pl doesn't get the right octal for chmod
Message-Id: <slrn9vsb27.2si.rgarciasuarez@rafael.kazibao.net>
Dirk wrote in comp.lang.perl.misc:
>
> I am using the perl-script mirror.pl (Lee McLoughlin) to mirror
> files/dirs to a remote ftp server.
> The file transfer works fine, but then it isn't able to change the
> file mode value on the remote server (with chmod).
You should report the error to the author.
> The following error occurs:
> ---> SITE CHMOD 100644 Testfile.txt
> 501 CHMOD: Mode value must be between 0 and 0777
>
> octal 100644 and not octal 0644.
>
> i examined the used script ftp.pl and found the following part:
>
> if( $mapunixout ){
> $path = eval "&$mapunixout( \$path, 'f' )";
> }
Looks like bad code; a subroutine reference would be better than an
eval.
> &send( sprintf( "SITE CHMOD %o $path", $mode ) );
This should work. $mode has probably a wrong value.
> When I change the line to:
>
> &send( sprintf( "SITE CHMOD 0644 $path", $mode ) );
>
> everything works fine, but It's sick to code such silly things :-)
Esp. if you're doing chmod on a directory.
> Does anyone know, how to implement the function, that I got the right
> mode (octal 0644) ?
The author should know.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
Could Marconi have invented the radio if he hadn't by pure chance
spent years working at the problem? -- Monty Python, Penguins
------------------------------
Date: 23 Nov 2001 11:13:05 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Problems with Mirror - ftp.pl doesn't get the right octal for chmod
Message-Id: <9tlb01$763$1@mamenchi.zrz.TU-Berlin.DE>
According to Dirk <dirk.drexler@web.de>:
> Hi together,
>
> I am using the perl-script mirror.pl (Lee McLoughlin) to mirror
> files/dirs to a remote ftp server.
> The file transfer works fine, but then it isn't able to change the
> file mode value on the remote server (with chmod).
>
> The following error occurs:
> ---> SITE CHMOD 100644 Testfile.txt
> 501 CHMOD: Mode value must be between 0 and 0777
>
> octal 100644 and not octal 0644.
>
> i examined the used script ftp.pl and found the following part:
>
> if( $mapunixout ){
> $path = eval "&$mapunixout( \$path, 'f' )";
> }
>
> &send( sprintf( "SITE CHMOD %o $path", $mode ) );
This is bad code. The author doesn't know how to use sprintf. In
particular, variable strings ($path) do *not* belong in the sprintf
format. The line should read
&send( sprintf( "SITE CHMOD %o %s", $mode, $path ) );
I left the ampersand in front of "&send" though that looks suspect
too.
No, I don't know how to fix it, but I'd distrust a script that contains
elementary errors like this one.
Anno
------------------------------
Date: Fri, 23 Nov 2001 12:31:32 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Problems with Mirror - ftp.pl doesn't get the right octal for chmod
Message-Id: <o8gsvtk54eqnlv9tb562r752suhe04h1qk@4ax.com>
Dirk wrote:
>The following error occurs:
>---> SITE CHMOD 100644 Testfile.txt
>501 CHMOD: Mode value must be between 0 and 0777
>
>octal 100644 and not octal 0644.
>
> &send( sprintf( "SITE CHMOD %o $path", $mode ) );
>
>When I change the line to:
>
> &send( sprintf( "SITE CHMOD 0644 $path", $mode ) );
>
>everything works fine, but It's sick to code such silly things :-)
OK... You need to remove the upper bits. Bitwise and is very nice for
that.
&send( sprintf( "SITE CHMOD %o $path", 0777 & $mode ) );
--
Bart.
------------------------------
Date: Fri, 23 Nov 2001 12:37:16 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Problems with Mirror - ftp.pl doesn't get the right octal for chmod
Message-Id: <kmgsvt0ros1fvv51uugr52jqdgu6clls4r@4ax.com>
Anno Siegel wrote:
> &send( sprintf( "SITE CHMOD %o %s", $mode, $path ) );
>
>I left the ampersand in front of "&send" though that looks suspect
>too.
"send" is a keyword in perl. If you have a sub called "send", then you
need to disambiguate the calls.
--
Bart.
------------------------------
Date: 23 Nov 2001 12:47:45 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Problems with Mirror - ftp.pl doesn't get the right octal for chmod
Message-Id: <9tlghh$6jf$2@mamenchi.zrz.TU-Berlin.DE>
According to Bart Lateur <bart.lateur@pandora.be>:
> Anno Siegel wrote:
>
> > &send( sprintf( "SITE CHMOD %o %s", $mode, $path ) );
> >
> >I left the ampersand in front of "&send" though that looks suspect
> >too.
>
> "send" is a keyword in perl. If you have a sub called "send", then you
> need to disambiguate the calls.
Oh, right.
Anno
------------------------------
Date: Fri, 23 Nov 2001 13:28:58 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Problems with Mirror - ftp.pl doesn't get the right octal for chmod
Message-Id: <slrn9vsjp1.8dn.garry@zfw.zvolve.net>
On 23 Nov 2001 11:13:05 GMT, Anno Siegel
<anno4000@lublin.zrz.tu-berlin.de> wrote:
> According to Dirk <dirk.drexler@web.de>:
[ snip ]
>> &send( sprintf( "SITE CHMOD %o $path", $mode ) );
>
> This is bad code. The author doesn't know how to use sprintf. In
> particular, variable strings ($path) do *not* belong in the sprintf
> format. The line should read
>
> &send( sprintf( "SITE CHMOD %o %s", $mode, $path ) );
I suppose this is a matter of style. The Perl manual page for
sprintf() and sprintf(3) certainly don't agree with you. Assuming
that the interpolation results in no "conversion specification"
characters, the stuff in $path will be treated as "ordinary
characters", according to the manual pages.
printf "%s\n", "just another Perl hacker";
--
Garry Williams
------------------------------
Date: 22 Nov 2001 12:34:41 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Script for stripping FONT (HTML) tags
Message-Id: <3bfd6161@news.victoria.tc.ca>
Tad McClellan (tadmc@augustmail.com) wrote:
: Tad McClellan <tadmc@augustmail.com> wrote:
: >Steve Holland <holland@origo.ifa.au.dk> wrote:
: >
: >> s/\<FONT\>//;
: > ^ ^
: > ^ ^
: >> s/\<\/FONT>//;
: > ^
: > ^
: >> s/\<FONT SIZE=\"\+1\"\>//;
: > ^ ^ ^ ^ ^
: > ^ ^ ^ ^ ^
: >
: >Please don't waste precious natural resources like that.
: >
: >None of those 8 backslashes can now be used in places where
: >a backslash is actually required.
: Errr, 2 serve a purpose. Only 7 do nothing. Sorry.
Which 2 serve a purpose?
Either you made a mistake before or in your correction, but either way it
only proves that escaping everything was not such a bad idea after all.
Certainly, *not* escaping things that need escaping can lead to subtle
bugs.
------------------------------
Date: Fri, 23 Nov 2001 10:59:30 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Script for stripping FONT (HTML) tags
Message-Id: <itasvtc05euqdeeo31jpj2dr34tuoc9g6r@4ax.com>
Malcolm Dew-Jones wrote:
>: Errr, 2 serve a purpose. Only 7 do nothing. Sorry.
>
>Which 2 serve a purpose?
(nb. I count 8)
You don't need a blackslash in front of any of ">", "<", '"'. You do, in
front of "+" and "/", the former because it's special to regexes, the
latter because that's the regex delimiter.
--
Bart.
------------------------------
Date: Fri, 23 Nov 2001 12:42:57 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Script for stripping FONT (HTML) tags
Message-Id: <slrn9vseat.ac.tadmc@tadmc26.august.net>
Malcolm Dew-Jones <yf110@vtn1.victoria.tc.ca> wrote:
>Tad McClellan (tadmc@augustmail.com) wrote:
>: Tad McClellan <tadmc@augustmail.com> wrote:
>: >Steve Holland <holland@origo.ifa.au.dk> wrote:
>: >
>: >> s/\<FONT\>//;
>: > ^ ^
>: > ^ ^
>: >> s/\<\/FONT>//;
>: > ^
>: > ^
>: >> s/\<FONT SIZE=\"\+1\"\>//;
>: > ^ ^ ^ ^ ^
>: > ^ ^ ^ ^ ^
>: >
>: >Please don't waste precious natural resources like that.
>: >
>: >None of those 8 backslashes can now be used in places where
>: >a backslash is actually required.
>
>
>: Errr, 2 serve a purpose. Only 7 do nothing. Sorry.
>
>Which 2 serve a purpose?
The 2 that escape special characters. Plus sign is meta in regexes,
and slash is special when used as the delimiter.
>Either you made a mistake before or in your correction, but either way it
>only proves that escaping everything was not such a bad idea after all.
That's strange. It proves the exact opposite to me :-)
Which am I going to understand when I read the code weeks after
writing it?
Here are 9 backslashes, but only 2 of them do anything.
Here are 2 backslashes.
Do-nothing features only slow down comprehension of what the
code does.
>Certainly, *not* escaping things that need escaping can lead to subtle
>bugs.
I see escaping things that don't need escaping as cargo-culting.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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.
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 2189
***************************************