[25844] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8079 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 14 11:05:42 2005

Date: Sat, 14 May 2005 08:05:08 -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           Sat, 14 May 2005     Volume: 10 Number: 8079

Today's topics:
    Re: FAQ 5.3 How do I count the number of lines in a fil (Vorxion)
    Re: FAQ 5.3 How do I count the number of lines in a fil <no@email.com>
    Re: FAQ 5.3 How do I count the number of lines in a fil (Anno Siegel)
    Re: Perl generated navigation menu <spam@noreply.org>
    Re: Perl generated navigation menu <tadmc@augustmail.com>
    Re: Perl generated navigation menu <Juha.Laiho@iki.fi>
    Re: Perl generated navigation menu <spam@noreply.org>
    Re: Perl generated navigation menu (Anno Siegel)
    Re: Perl generated navigation menu <wyzelli@yahoo.com>
    Re: Perl generated navigation menu <barty@fuelfix.com>
    Re: Perl generated navigation menu <tadmc@augustmail.com>
        query = new CGI;  <cprevra@satx.rr.com>
    Re: query = new CGI; <ignoramus4744@NOSPAM.4744.invalid>
    Re: query = new CGI; <1usa@llenroc.ude.invalid>
    Re: query = new CGI; <cprevra@satx.rr.com>
    Re: query = new CGI; <ignoramus4744@NOSPAM.4744.invalid>
    Re: query = new CGI; <cprevra@satx.rr.com>
    Re: query = new CGI; <1usa@llenroc.ude.invalid>
        Registry Read Write <banz@glion.ch>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 13 May 2005 23:44:15 -0400
From: vorxion@knockingshopofthemind.com (Vorxion)
Subject: Re: FAQ 5.3 How do I count the number of lines in a file?
Message-Id: <4285740f$1_1@news.iglou.com>

In article <d6386k$j9o$1@reader1.panix.com>, PerlFAQ Server wrote:
>
>5.3: How do I count the number of lines in a file?
>
>    One fairly efficient way is to count newlines in the file. The following
>    program uses a feature of tr///, as documented in perlop. If your text
>    file doesn't end with a newline, then it's not really a proper text
>    file, so this may report one fewer line than you expect.
>
>        $lines = 0;
>        open(FILE, $filename) or die "Can't open `$filename': $!";
>        while (sysread FILE, $buffer, 4096) {
>            $lines += ($buffer =~ tr/\n//);
>        }
>        close FILE;
>
>    This assumes no funny games with newline translations.

If that's your assumption, you're using too much CPU.

open(FILE,$filename) or die("Can't open '$filename': $!";
@line_test = <FILE>;
$lines = scalar(@line_test);

Far fewer opcodes have to be run without all the tr's and updates of the
counter in the original.  I can't believe the FAQ calls the original one
efficient.  *shudder*

-- 
Vorxion - Founder of the knocking-shop of the mind.

"You have it, you sell it, you've still got it--what's the difference?"
--Diana Trent, "Waiting for God", on why a modelling agency is really a
knocking-shop.  Applied by me to the field of consulting.  :)

The Sci-Fi fan's solution to debt:  Reverse the polarity on your charge card.


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

Date: Sat, 14 May 2005 10:40:28 +0100
From: Brian Wakem <no@email.com>
Subject: Re: FAQ 5.3 How do I count the number of lines in a file?
Message-Id: <3elvccF3rae1U1@individual.net>

Vorxion wrote:

> In article <d6386k$j9o$1@reader1.panix.com>, PerlFAQ Server wrote:
>>
>>5.3: How do I count the number of lines in a file?
>>
>>    One fairly efficient way is to count newlines in the file. The
>>    following program uses a feature of tr///, as documented in perlop. If
>>    your text file doesn't end with a newline, then it's not really a
>>    proper text file, so this may report one fewer line than you expect.
>>
>>        $lines = 0;
>>        open(FILE, $filename) or die "Can't open `$filename': $!";
>>        while (sysread FILE, $buffer, 4096) {
>>            $lines += ($buffer =~ tr/\n//);
>>        }
>>        close FILE;
>>
>>    This assumes no funny games with newline translations.
> 
> If that's your assumption, you're using too much CPU.
> 
> open(FILE,$filename) or die("Can't open '$filename': $!";
> @line_test = <FILE>;
> $lines = scalar(@line_test);



Do that with a multi-gigabyte file and you could be in real trouble.


-- 
Brian Wakem




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

Date: 14 May 2005 11:10:49 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: FAQ 5.3 How do I count the number of lines in a file?
Message-Id: <d64mbp$eg4$1@mamenchi.zrz.TU-Berlin.DE>

Vorxion <vorxion@knockingshopofthemind.com> wrote in comp.lang.perl.misc:
> In article <d6386k$j9o$1@reader1.panix.com>, PerlFAQ Server wrote:
> >
> >5.3: How do I count the number of lines in a file?
> >
> >    One fairly efficient way is to count newlines in the file. The following
> >    program uses a feature of tr///, as documented in perlop. If your text
> >    file doesn't end with a newline, then it's not really a proper text
> >    file, so this may report one fewer line than you expect.
> >
> >        $lines = 0;
> >        open(FILE, $filename) or die "Can't open `$filename': $!";
> >        while (sysread FILE, $buffer, 4096) {
> >            $lines += ($buffer =~ tr/\n//);
> >        }
> >        close FILE;
> >
> >    This assumes no funny games with newline translations.
> 
> If that's your assumption, you're using too much CPU.
> 
> open(FILE,$filename) or die("Can't open '$filename': $!";
> @line_test = <FILE>;
> $lines = scalar(@line_test);
> 
> Far fewer opcodes have to be run without all the tr's and updates of the
> counter in the original.  I can't believe the FAQ calls the original one
> efficient.  *shudder*

I can't believe you make this claim without a shred of evidence.

On my machine, Benchmark shows the faq solution about 30 times faster
than yours.  That's for a 2.5 MB file with 178834 lines.

Please don't make unsubstantiated claims as statements of fact.

Anno


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

Date: Sat, 14 May 2005 08:20:23 +0000
From: michael <spam@noreply.org>
Subject: Re: Perl generated navigation menu
Message-Id: <d645b1$arj$04$1@news.t-online.com>

> REQUEST_NAME, SERVER_NAME, SCRIPT_NAME and SCRIPT_FILENAME will tell you

Yes Thanks. It is Apache.

> It really is as simple as a loop & print statement. You can go down the
> route of using templates if you want.

I guess templates and modules except perhaps CGI would be excessive as the
resulting html code would be fairly short in any case.

Could someone here contruct an example loop & print of the arrays that would
generate the code below it, bearing the nested list syntax in mind?

@flora_and_funa_URLs = ("z0.html","z1.html","z2.html");
@flora_and_funa_Names = ("Flora & Funa", "Pretty Flowers", "Deadly Vines");

@aquatic_creatures_URLs = ("z3.html","z4.html","z5.html");
@aquatic_creatures_Names = ("Aquatic Creatures","Pretty Fish","Don't Eat");

<ul>
     <li><a href="z0.html">Flora & Funa</a>

        <ul>
           <li><a href="z1.html">Pretty Flowers</a></li>
           <li><a href="z2.html">Deadly Vines</a></li>
        </ul>

     </li>

     <li><a href="z3.html">Aquatic Creatures</a>

        <ul>
          <li><a href="z4.html">Pretty Fish</a></li>
          <li><a href="z5.html">Don't Eat</a></li>
        </ul>

     </li>
</ul>

Many thanks,
Michael

-- 
Tomorrow, this will be part of the unchangeable past but fortunately,
it can still be changed today.



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

Date: Sat, 14 May 2005 01:51:22 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl generated navigation menu
Message-Id: <slrnd8b7va.r3u.tadmc@magna.augustmail.com>

michael <spam@noreply.org> wrote:
> I'm doing a site which will have a navigation menu in the form of an
> unordered list, containing groups of URLs and corresponding link names,
> which may be defined in simple arrays, eg.:
> 
> @flora_and_funa_URLs = ("z0.html","z1.html","z2.html");
> @flora_and_funa_Names = ("Flora & Funa", "Pretty Flowers", "Deadly Vines");


Related things should be kept together, else it is easy for
them to get out of sync.

So I suggest a "better" data structure would be a LoH:

   @flora_and_funa = (
      { url => "z0.html", name => "Flora & Funa" },
      { url => "z1.html", name => "Pretty Flowers" },
      { url => "z2.html", name => "Deadly Vines" },
   );


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 14 May 2005 08:34:42 +0000 (UTC)
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: Perl generated navigation menu
Message-Id: <d64d72$hri$2@ichaos.ichaos-int>

Gregory Toomey <nospam@bigpond.com> said:
>michael wrote:
>> Are there any modules that may be useful in this example, or would it
>> perhaps be easier to write a script for the purpose?
>
>There are modules like HTML::Template or CGI.pm
>http://search.cpan.org/dist/CGI.pm/CGI.pm
>
>However, the more modules you load the slower your cgi runs.
>On the web, speed isn't everything, its the ONLY thing.

Hmm.. that much explain the multitude of sites not working properly
(and failing extremely fast...).

Modules tend to create more consistent code, as well as more consistent
HTML. Consistent code may offer possibilities of higher-level
optimisations, whereas consistent HTML renders more predictably in the
various browsers.

So, optimise for speed when speed is the problem. Which does not mean
that one is allowed to write excessively slow code by default.

As for optimising for speed, the largest slowdown with modules tends to
be the module load/initialisation time. This can largely be avoided with
switching from plain CGI to either mod_perl or FastCGI execution
environments -- so, there are other (better) ways to gain speed than
discard use of modules.
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)


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

Date: Sat, 14 May 2005 11:54:48 +0000
From: michael <spam@noreply.org>
Subject: Re: Perl generated navigation menu
Message-Id: <d64ht2$qd9$05$1@news.t-online.com>

> So I suggest a "better" data structure would be a LoH:
> 
>    @flora_and_funa = (
>       { url => "z0.html", name => "Flora & Funa" },
>       { url => "z1.html", name => "Pretty Flowers" },
>       { url => "z2.html", name => "Deadly Vines" },
>    );

Thanks for the tip, first time I've heard of LoH's... Anyway, does anyone
know a good way how to magically transform the above, including an
@aquatic_creaturs LoH's, into the below UL/LI structure by using a loop?

<ul>
     <li><a href="z0.html">Flora & Funa</a>

        <ul>
           <li><a href="z1.html">Pretty Flowers</a></li>
           <li><a href="z2.html">Deadly Vines</a></li>
        </ul>

     </li>

     <li><a href="z3.html">Aquatic Creatures</a>

        <ul>
          <li><a href="z4.html">Pretty Fish</a></li>
          <li><a href="z5.html">Don't Eat</a></li>
        </ul>

     </li>
</ul>

If so, please kindly post your code.

Many thanks,
Michael

-- 
Q:      Why is Christmas just like a day at the office?
A:      You do all of the work and the fat guy in the suit
        gets all the credit.





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

Date: 14 May 2005 10:41:51 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl generated navigation menu
Message-Id: <d64klf$deb$1@mamenchi.zrz.TU-Berlin.DE>

michael  <spam@noreply.org> wrote in comp.lang.perl.misc:
> 
> @flora_and_funa_URLs = ("z0.html","z1.html","z2.html");
> @flora_and_funa_Names = ("Flora & Funa", "Pretty Flowers", "Deadly Vines");

"Fauna", not "funa".

Anno


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

Date: Sat, 14 May 2005 11:04:25 GMT
From: "Peter Wyzl" <wyzelli@yahoo.com>
Subject: Re: Perl generated navigation menu
Message-Id: <ZWkhe.2489$E7.488@news-server.bigpond.net.au>

"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message 
news:d64klf$deb$1@mamenchi.zrz.TU-Berlin.DE...
: michael  <spam@noreply.org> wrote in comp.lang.perl.misc:
: >
: > @flora_and_funa_URLs = ("z0.html","z1.html","z2.html");
: > @flora_and_funa_Names = ("Flora & Funa", "Pretty Flowers", "Deadly 
Vines");
:
: "Fauna", not "funa".

Thank you...

P 




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

Date: Sat, 14 May 2005 13:19:24 +0200
From: Barty Slartfast <barty@fuelfix.com>
Subject: Re: Perl generated navigation menu
Message-Id: <d64n90$58l$05$1@news.t-online.com>

> "Fauna", not "funa".

Actually its mant to be "Puna".

Michael

-- 
Before Xerox, five carbons were the maximum extension of anybody's
ego.



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

Date: Sat, 14 May 2005 09:45:35 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl generated navigation menu
Message-Id: <slrnd8c3of.sat.tadmc@magna.augustmail.com>

michael <spam@noreply.org> wrote:
>> So I suggest a "better" data structure would be a LoH:
>> 
>>    @flora_and_funa = (
>>       { url => "z0.html", name => "Flora & Funa" },
>>       { url => "z1.html", name => "Pretty Flowers" },
>>       { url => "z2.html", name => "Deadly Vines" },
>>    );
> 
> Thanks for the tip, first time I've heard of LoH's... 


   perldoc perlreftut
   perldoc perlref
   perldoc perllol
   perldoc perldsc


> the above, including an
> @aquatic_creaturs LoH's, 


Oh.

I would now suggest a different "better" structure, a HoLoH:

   %links = (
      flora_and_funa => [
         { url => "z0.html", name => "Flora & Funa" },
         { url => "z1.html", name => "Pretty Flowers" },
         { url => "z2.html", name => "Deadly Vines" },
                        ],
      aquatic_creaturs => [
         { url => "z4.html", name => "Pretty Fish" },
         { url => "z5.html", name => "Don't Eat" },
                          ],
   );


(those are some odd spellings by the way, that could easily lead
 to typos if you happen to actually spell them correctly at some point.
)


> If so, please kindly post your code.


Show us the code you've already tried, and we will help you fix it.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 14 May 2005 14:04:52 GMT
From: "CS" <cprevra@satx.rr.com>
Subject: query = new CGI; 
Message-Id: <8Anhe.64452$AE6.61814@tornado.texas.rr.com>

#!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);

$query = new CGI;

print $query->header;

print "<html><head><title>A test</title></head\n";
print "<body>The test was successful</body></html>";

Line 5 errors with Can't locate object method "new" via package "CGI" at
test.cgi line 5.

The server is running perl 5.8.4




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

Date: 14 May 2005 14:07:24 GMT
From: Ignoramus4744 <ignoramus4744@NOSPAM.4744.invalid>
Subject: Re: query = new CGI;
Message-Id: <d650ms$v83$0@pita.alt.net>

On Sat, 14 May 2005 14:04:52 GMT, CS <cprevra@satx.rr.com> wrote:
> #!/usr/bin/perl
>
> use CGI::Carp qw(fatalsToBrowser);

add 

use CGI;

>
> $query = new CGI;
>
> print $query->header;
>
> print "<html><head><title>A test</title></head\n";
> print "<body>The test was successful</body></html>";
>
> Line 5 errors with Can't locate object method "new" via package "CGI" at
> test.cgi line 5.
>
> The server is running perl 5.8.4
>
>


-- 


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

Date: Sat, 14 May 2005 14:14:04 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: query = new CGI;
Message-Id: <Xns965667F7C657Aasu1cornelledu@127.0.0.1>

"CS" <cprevra@satx.rr.com> wrote in
news:8Anhe.64452$AE6.61814@tornado.texas.rr.com: 

> #!/usr/bin/perl

use strict;
use warnings;

missing.
 
> use CGI::Carp qw(fatalsToBrowser);
> 

use CGI;

missing.

> $query = new CGI;

my $cgi = CGI->new

'my' because of strict, $cgi, rather than $query, because I have been 
convinced by others' arguments that it is a better name, CGI->new 
because I have a simple mind.
 
> print $query->header;
> 
> print "<html><head><title>A test</title></head\n";
> print "<body>The test was successful</body></html>";

AFAIK, that is not valid HTML.

print <<HTML;
<html>
<head>
<title>A Test</title>
</head>
<body>
<p>The test was successful</p>
</body>
</html>
HTML

Sinan


-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html


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

Date: Sat, 14 May 2005 14:14:45 GMT
From: "CS" <cprevra@satx.rr.com>
Subject: Re: query = new CGI;
Message-Id: <pJnhe.64453$AE6.64021@tornado.texas.rr.com>

New error.

Can't locate GCI.pm in @INC (@INC contains: /usr/lib/perl5/5.8.4/i686-linux
/usr/lib/perl5/5.8.4 /usr/lib/perl5/site_perl/5.8.4/i686-linux
/usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl .) at test.cgi line 5.
BEGIN failed--compilation aborted at test.cgi line 5.


"Ignoramus4744" <ignoramus4744@NOSPAM.4744.invalid> wrote in message
news:d650ms$v83$0@pita.alt.net...
> On Sat, 14 May 2005 14:04:52 GMT, CS <cprevra@satx.rr.com> wrote:
> > #!/usr/bin/perl
> >
> > use CGI::Carp qw(fatalsToBrowser);
>
> add
>
> use CGI;
>
> >
> > $query = new CGI;
> >
> > print $query->header;
> >
> > print "<html><head><title>A test</title></head\n";
> > print "<body>The test was successful</body></html>";
> >
> > Line 5 errors with Can't locate object method "new" via package "CGI" at
> > test.cgi line 5.
> >
> > The server is running perl 5.8.4
> >
> >
>
>
> --




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

Date: 14 May 2005 14:17:36 GMT
From: Ignoramus4744 <ignoramus4744@NOSPAM.4744.invalid>
Subject: Re: query = new CGI;
Message-Id: <d651a0$fg$0@pita.alt.net>

On Sat, 14 May 2005 14:14:45 GMT, CS <cprevra@satx.rr.com> wrote:
> New error.
>
> Can't locate GCI.pm in @INC (@INC contains: /usr/lib/perl5/5.8.4/i686-linux

you made a typo, it should be CGI, not GCI.

i

> /usr/lib/perl5/5.8.4 /usr/lib/perl5/site_perl/5.8.4/i686-linux
> /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl .) at test.cgi line 5.
> BEGIN failed--compilation aborted at test.cgi line 5.
>
>
> "Ignoramus4744" <ignoramus4744@NOSPAM.4744.invalid> wrote in message
> news:d650ms$v83$0@pita.alt.net...
>> On Sat, 14 May 2005 14:04:52 GMT, CS <cprevra@satx.rr.com> wrote:
>> > #!/usr/bin/perl
>> >
>> > use CGI::Carp qw(fatalsToBrowser);
>>
>> add
>>
>> use CGI;
>>
>> >
>> > $query = new CGI;
>> >
>> > print $query->header;
>> >
>> > print "<html><head><title>A test</title></head\n";
>> > print "<body>The test was successful</body></html>";
>> >
>> > Line 5 errors with Can't locate object method "new" via package "CGI" at
>> > test.cgi line 5.
>> >
>> > The server is running perl 5.8.4
>> >
>> >
>>
>>
>
>


-- 


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

Date: Sat, 14 May 2005 14:20:48 GMT
From: "CS" <cprevra@satx.rr.com>
Subject: Re: query = new CGI;
Message-Id: <4Pnhe.64454$AE6.16843@tornado.texas.rr.com>

Thanks. It works now.
*laughing at self*


"Ignoramus4744" <ignoramus4744@NOSPAM.4744.invalid> wrote in message
news:d651a0$fg$0@pita.alt.net...
> On Sat, 14 May 2005 14:14:45 GMT, CS <cprevra@satx.rr.com> wrote:
> > New error.
> >
> > Can't locate GCI.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.4/i686-linux
>
> you made a typo, it should be CGI, not GCI.
>
> i
>
> > /usr/lib/perl5/5.8.4 /usr/lib/perl5/site_perl/5.8.4/i686-linux
> > /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.0
> > /usr/lib/perl5/site_perl .) at test.cgi line 5.
> > BEGIN failed--compilation aborted at test.cgi line 5.
> >
> >
> > "Ignoramus4744" <ignoramus4744@NOSPAM.4744.invalid> wrote in message
> > news:d650ms$v83$0@pita.alt.net...
> >> On Sat, 14 May 2005 14:04:52 GMT, CS <cprevra@satx.rr.com> wrote:
> >> > #!/usr/bin/perl
> >> >
> >> > use CGI::Carp qw(fatalsToBrowser);
> >>
> >> add
> >>
> >> use CGI;
> >>
> >> >
> >> > $query = new CGI;
> >> >
> >> > print $query->header;
> >> >
> >> > print "<html><head><title>A test</title></head\n";
> >> > print "<body>The test was successful</body></html>";
> >> >
> >> > Line 5 errors with Can't locate object method "new" via package "CGI"
at
> >> > test.cgi line 5.
> >> >
> >> > The server is running perl 5.8.4
> >> >
> >> >
> >>
> >>
> >
> >
>
>
> --




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

Date: Sat, 14 May 2005 14:22:52 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: query = new CGI;
Message-Id: <Xns965669752FBDDasu1cornelledu@127.0.0.1>

"CS" <cprevra@satx.rr.com> wrote in
news:pJnhe.64453$AE6.64021@tornado.texas.rr.com: 

[ Please do not top-post.
  Please read the posting guidelines for this group before it is too 
  late.
]

> New error.
> 
> Can't locate GCI.pm in @INC (@INC contains:

Please read the error messages your computer gives you before askign 
thousands of people to read it for you.

CGI is not spelled GCI.

Please note that this is a UseNet group, and not IRC.

[ rest snipped ]

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html


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

Date: Sat, 14 May 2005 11:24:10 +0200
From: "news.tiscalinet.ch" <banz@glion.ch>
Subject: Registry Read Write
Message-Id: <4285c3b8_1@news.tiscalinet.ch>

Hello I have this code
______________________________________________________________________
my $HK_Key = "LMachine";
my $subkey = "/Software/MyPersSWStore/Dummy/";
my $keyname = "/Fonts";
my $parameter = ["Times","Courier","Lucinda", "Times New Roman"];
my $RegType = 7;
my( $RwriteParam) = RWToRegistry->DeleteParameter( $HK_Key, $subkey, 
$keyname, $parameter, $RegType );


use Win32::TieRegistry 0.20 qw(
     TiedRef $Registry
     Delimiter /  ArrayValues 1  SplitMultis 1  AllowLoad 1
     REG_SZ REG_EXPAND_SZ REG_DWORD REG_BINARY REG_MULTI_SZ
     KEY_READ KEY_WRITE KEY_ALL_ACCESS
);

sub DeleteParameter{
     my( undef, $HK_Key, $subkey, $keyname, $parameter, $RegType ) = @_;

#Set a Registry Keyvalue
     $Registry->{"$HK_Key$subkey"}= {
     $keyname => [ $parameter, REG_MULTI_SZ() ],
     }  or  die "Can't create Software/FooCorp/: $^E\n";

#Delete a Registry Keyvalue
     $Registry->{"$HK_Key$subkey"}= {
     $keyname => delete => $keyname,
     }  or  die "Can't create Software/FooCorp/: $^E\n";

}
_______________________________________________________________________

Problem to resolve

This solution it deletes only the data and not the Value
How do I modify this to delete also the Value itself?

Roman


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

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 8079
***************************************


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