[12654] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 63 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 7 16:17:44 1999

Date: Wed, 7 Jul 1999 13:06:18 -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           Wed, 7 Jul 1999     Volume: 9 Number: 63

Today's topics:
        regex to eat all html tags <shaffer2@ptd.net>
    Re: regex to eat all html tags <emschwar@rmi.net>
    Re: regex to eat all html tags (Tramm Hudson)
    Re: regex to eat all html tags (Abigail)
    Re: regex to eat all html tags <JFedor@datacom-css.com>
    Re: regex to eat all html tags <dgris@moiraine.dimensional.com>
    Re: Regexpr tool? garthwebb@my-deja.com
    Re: repeating variables of the same name?? <gellyfish@gellyfish.com>
    Re: repeating variables of the same name?? <walton@frontiernet.net>
    Re: repeating variables of the same name?? (Eric Bohlman)
    Re: repeating variables of the same name?? (Philip 'Yes, that's my address' Newton)
    Re: repeating variables of the same name?? (Abigail)
    Re: repeating variables of the same name?? (elephant)
    Re: repeating variables of the same name?? (Eric Bohlman)
    Re: repeating variables of the same name?? (Abigail)
    Re: repeating variables of the same name?? (elephant)
    Re: repeating variables of the same name?? (I.J. Garlick)
    Re: Retrieving NT Services <carvdawg@patriot.net>
    Re: Retrieving NT Services (elephant)
    Re: Retrieving NT Services <carvdawg@patriot.net>
        Right-clicking buttons in Perl/TK <qpkasha@epk.ericsson.se>
    Re: Right-clicking buttons in Perl/TK <lusol@Pandora.CC.Lehigh.EDU>
        s/// Bug/bad syntax?? (WAS:$scalars in s/// not working <dudeman@dude.com>
    Re: s/// Bug/bad syntax?? (WAS:$scalars in s/// not wor <uri@sysarch.com>
    Re: Scalars ---> Arrays (Larry Rosler)
    Re: Scalars ---> Arrays (Larry Rosler)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Tue, 06 Jul 1999 23:37:29 GMT
From: "dave shaffer" <shaffer2@ptd.net>
Subject: regex to eat all html tags
Message-Id: <Zqwg3.255$uA5.40194@nnrp1.ptd.net>

HELP!!!

I need a regular expression to match/remove html tags -actually anything in
greater/lessthan brackets "<all characters >" and on multiple lines.

I want to remove all html stuff and then search the remaining text for
certain words.

For
example, the following text would be matched:

Before:
        <yada yada> this is my doc <yada
        yada> it is pretty cool <yada

        yada

                     yada> reality,
       it is!!!


After:
       this is my doc
       it is pretty cool
       reality
       it is!!!

I could use something like this: $temp =~ s/<.*?>//gs; but how do you match
when spanning multiple lines.


I'm opening the text file, then stripping all tags before I search.  What is
the best way to do this?


   open (ST, "<t.txt") || die "could not open file!\n";
   $num = 1;
   while( <ST>) {
      $line = $_;
      if ($line =~ s/<.*?>//gs)

          print "$num  $line";
          $num = $num + 1;
       }
  }
  close (ST);


I match all occurrences, except the ones that open on one line and close on
another:

<a href="jadslkjflkajdsflkjadslfkj
jadslkjflkadsjflkajdsflkjadslkfj>


would it be best for me to process the file twice?

Thanks,
   Dave Shaffer






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

Date: 06 Jul 1999 18:02:20 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: regex to eat all html tags
Message-Id: <xkfu2rhgwdv.fsf@valdemar.col.hp.com>

"dave shaffer" <shaffer2@ptd.net> writes:
> I need a regular expression to match/remove html tags -actually anything in
> greater/lessthan brackets "<all characters >" and on multiple lines.
> 
> I want to remove all html stuff and then search the remaining text for
> certain words.

So what was unclear about the FAQ entry on your hard drive, entitled

      How do I remove HTML from a string?

If you tell us how to make it clearer, others who were similarly confused 
might be helped, and the FAQ will thereby be made better for everybody.

Um... you *did* read the FAQ, didn't you?  The one that's on your hard
drive?  The one that's included with every "modern" distribution of Perl?
The one that's also available on <URL:http://www.perl.com/>?  The one
that USENET etiquette says should be consulted before posting a question
to any newsgroup?

Right?

-=Eric, optimist par excellence


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

Date: 6 Jul 1999 18:29:41 -0600
From: hudson@swcp.com (Tramm Hudson)
Subject: Re: regex to eat all html tags
Message-Id: <7lu71l$j35@llama.swcp.com>

[posted for no reason and cc'd to cited author]

Unfortunately my regexes are on a strict diet and can not be allowed to
eat any HTMl tags.  You really should take better care of yours and not
feed them so many web pages.

Eric The Read  <emschwar@rmi.net> wrote:
 ...
> Um... you *did* read the FAQ, didn't you?  The one that's on your hard
> drive?  The one that's included with every "modern" distribution of Perl?
> The one that's also available on <URL:http://www.perl.com/>?  The one
> that USENET etiquette says should be consulted before posting a question
> to any newsgroup?
     ^^^

Wow!  I had no idea that the Perl FAQ was to be consulted before
posting to any newsgroup!  No wonder my comments in alt.religion.kibology
regarding the proper respect to pay to the Kabal were going unanswered.

It must be in perlfaqPhi, or maybe in perlfaqSqrt(2).  No, here it is
in perlfaq ln(3), "Proper Etiquette for posting unecessary comments,
why symbolic references are good, why localtime is broken, constant
time factoring, NSA's DES cracking machines and why Microsoft will
rule for all time.".

I'll be sure to consult these apocryphal texts more.


Tramm
-- 
  o   hudson@swcp.com                 tbhudso@cs.sandia.gov   O___|   
 /|\  http://www.swcp.com/~hudson/          H 505.323.38.81   /\  \_  
 <<   KC5RNF @ N5YYF.NM.AMPR.ORG            W 505.284.24.32   \ \/\_\  
  0                                                            U \_  | 


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

Date: 6 Jul 1999 20:03:29 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: regex to eat all html tags
Message-Id: <slrn7o59qa.tch.abigail@alexandra.delanet.com>

dave shaffer (shaffer2@ptd.net) wrote on MMCXXXV September MCMXCIII in
<URL:news:Zqwg3.255$uA5.40194@nnrp1.ptd.net>:
// HELP!!!
// 
// I need a regular expression to match/remove html tags -actually anything in
// greater/lessthan brackets "<all characters >" and on multiple lines.

Well, the first is impossible - see the FAQ. 
The latter is trivial, s/<.*>//s;  But you probably don't want that.

// I want to remove all html stuff and then search the remaining text for
// certain words.

RTFFAQ.

// I could use something like this: $temp =~ s/<.*?>//gs; but how do you match
// when spanning multiple lines.

No, that will fail. Even when spanning multiple lines. It's just way to
simplistic. You might as well leave out every third character; that will
sometimes produce a correct result too.

// I'm opening the text file, then stripping all tags before I search.  What is
// the best way to do this?

Use a parser. nsgmls for instance, or HTML::Parser if you are sure
the document doesn't contain CDATA elements, or marked sections.

//    open (ST, "<t.txt") || die "could not open file!\n";
//    $num = 1;
//    while( <ST>) {
//       $line = $_;
//       if ($line =~ s/<.*?>//gs)
// 
//           print "$num  $line";
//           $num = $num + 1;
//        }
//   }
//   close (ST);
// 
// I match all occurrences, except the ones that open on one line and close on
// another:

Here are a few things where your simplistic approach fails utterly:

<IMG SRC = "a_greater_b.gif" ALT = "a > b">
<!-- <IMG SRC = "foo.gif"> -->
We break a line using <[CDATA [ <br> ]]>
<# This is text, not a tag #>
<SCRIPT>document.write ("<BR>")</SCRIPT>

// would it be best for me to process the file twice?

No need for that! Just *TOKENIZE* and *PARSE*.


Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
                       -> define ("foldoc", "perl")) [0] -> print'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Wed, 7 Jul 1999 02:21:35 -0400
From: "Jody Fedor" <JFedor@datacom-css.com>
Subject: Re: regex to eat all html tags
Message-Id: <7luppn$8o2$1@plonk.apk.net>


Abigail wrote in message ...
>dave shaffer (shaffer2@ptd.net) wrote on MMCXXXV September MCMXCIII in
><URL:news:Zqwg3.255$uA5.40194@nnrp1.ptd.net>:
>// HELP!!!
>//
>// I need a regular expression to match/remove html tags -actually anything
in
>// greater/lessthan brackets "<all characters >" and on multiple lines.
>
>Well, the first is impossible - see the FAQ.
>The latter is trivial, s/<.*>//s;  But you probably don't want that.
>


Gee... this thread looks familiar.?!

Jody





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

Date: 07 Jul 1999 09:20:17 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: regex to eat all html tags
Message-Id: <m3ogho8p1q.fsf@moiraine.dimensional.com>

abigail@delanet.com (Abigail) writes:

<snip `I need an html parsing regex'>

> Well, the first is impossible - see the FAQ. 

I don't think that this is true anymore.  Looking over the
regex changes Ilya has made leads me to believe that all of
the necessary machinery is in place and that creation of the
appropriate regex is now A Simple Matter of Programming.  :-)

But...
<snip>
> No need for that! Just *TOKENIZE* and *PARSE*.

Yes, that's still the best way.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Tue, 06 Jul 1999 23:44:07 GMT
From: garthwebb@my-deja.com
Subject: Re: Regexpr tool?
Message-Id: <7lu4c4$sn3$1@nnrp1.deja.com>

In article <377D4D12.E7F2DB14@hawaii.edu>,
  David Pautler <pautler@hawaii.edu> wrote:
> One feature that I think would be quite difficult to implement, but
also
> very useful, is a GUI that could be given a regexpr and a source
string,
> and it would highlight in red the section of the regexpr that led to
the
> most successful PARTIAL match, assuming there was no perfect match.
The
> matched part of the source string would also be highlighted.
>
> I would expect that something like this would already exist in the
Perl
> community.  If so, would someone post a url?

Well, in XEmacs you can do a regex forward and backward search that will
highlight what currently matches the regex you type.  If you type
grouping parenthesis or a character class (or something that make no
sense until its been finished) XEmacs will wait until the pattern is
complete enough to match something.
It won't give you a partial match however.  I don't think anything can
give you a partial match since what partial means is completely
arbitrary.  However, you can type in the regex and watch what matches
and then see when it fails.
I don't know for certain if regular emacs has this capability, but I'll
bet it does.

Garth


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 6 Jul 1999 19:54:10 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: repeating variables of the same name??
Message-Id: <7ltmt2$et$1@gellyfish.btinternet.com>

On Tue, 06 Jul 1999 12:30:54 +0100 bobby wrote:
>
> 	I want to let people check more than one checkbox (name=person
> value=$field[1]) - click submit to go to another screen that has all the
> people they selected .... the problem is i'm only getting the first
> checkbox they click, none of the other selections come through.. 
> 

You're not using CGI.pm are you ?

CGI.pm is part of the standard Perl distribution and very well documented.


/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Tue, 06 Jul 1999 20:30:53 -0400
From: Bob Walton <walton@frontiernet.net>
To: bobby <bobby@alpstreet.net>
Subject: Re: repeating variables of the same name??
Message-Id: <37829FBD.845A5B39@frontiernet.net>

bobby wrote:

> Can anyone help me with repeating variables
> I'm using a script to suck data out of a pipe delimited .dat file and
> format a html page...  to produce something like this:
>
> <input type=checkbox name=person value=$field[1]><B>$field[1]</B><P>
> $field[2]<p>
>
> <BR><U>Nationality</U>: $field[8]
> <BR><U>Size</U>: $field[3]
> <BR><U>Weight</U>: $field[4]
> <BR><U>Other</U>: $field[7]
>
> this gets repeated for any matched queries.
>
>         I want to let people check more than one checkbox (name=person
> value=$field[1]) - click submit to go to another screen that has all the
> people they selected .... the problem is i'm only getting the first
> checkbox they click, none of the other selections come through..

 ...
Bobby, you will need to give each checkbox a different name, since the value
the browser returns is name=value -- if there are more than one checkbox
with the same name, the results are not well defined, but definitely not
what you want.  And all the text strings in the HTML input statement should
have " around them, like:

<input type="checkbox" name="person1" value="whatever"> text ...
<input type="checkbox" name="person2" value="whichever"> text ...

I would suggest you get your HTML working using a text editor, then try to
get Perl to write it :-).  And newsgroup comp.infosystems.www.authoring.cgi
will probably give better help and fewer flames on this sort of question
(that is, an HTML question, not a Perl question).




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

Date: 7 Jul 1999 02:02:12 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: repeating variables of the same name??
Message-Id: <7lucf4$i4o@dfw-ixnews3.ix.netcom.com>

Bob Walton (walton@frontiernet.net) wrote:
: Bobby, you will need to give each checkbox a different name, since the value
: the browser returns is name=value -- if there are more than one checkbox
: with the same name, the results are not well defined, but definitely not
: what you want.  And all the text strings in the HTML input statement should

The results in such a case *are* well-defined (and identical to what 
you'd get from a <SELECT MULTIPLE> form element).

Parameter-decoding code written by programmers (e.g. CGI.pm) provides a 
well-defined interface to such parameter combinations.

Parameter-decoding code written by script kiddies (such as the widely 
cut-and-pasted code in several of Matt Wright's scripts) doesn't.


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

Date: Wed, 07 Jul 1999 03:48:06 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: repeating variables of the same name??
Message-Id: <3782ccfa.253281036@news.nikoma.de>

On Tue, 06 Jul 1999 20:30:53 -0400, Bob Walton
<walton@frontiernet.net> wrote:

>                And all the text strings in the HTML input statement should
>have " around them, like:
>
><input type="checkbox" name="person1" value="whatever"> text ...
><input type="checkbox" name="person2" value="whichever"> text ...

Not strictly necessary here for one-word, alphanumeric text strings.
But they don't hurt.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.net>


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

Date: 6 Jul 1999 23:08:01 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: repeating variables of the same name??
Message-Id: <slrn7o5kkc.tch.abigail@alexandra.delanet.com>

that's my address' Newton (nospam.newton@gmx.net) wrote on MMCXXXVI
September MCMXCIII in <URL:news:3782ccfa.253281036@news.nikoma.de>:
## On Tue, 06 Jul 1999 20:30:53 -0400, Bob Walton
## <walton@frontiernet.net> wrote:
## 
## >                And all the text strings in the HTML input statement should
## >have " around them, like:
## >
## ><input type="checkbox" name="person1" value="whatever"> text ...
## ><input type="checkbox" name="person2" value="whichever"> text ...
## 
## Not strictly necessary here for one-word, alphanumeric text strings.
## But they don't hurt.

You can actually omit quotes on alphanumhyphendots. And it doesn't have
to be ". ' is just as fine.

But I'm getting off-topic....



Abigail
-- 
perl -wlne '}for($.){print' file  # Count the number of lines.


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Wed, 7 Jul 1999 15:25:36 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: repeating variables of the same name??
Message-Id: <MPG.11ed8fe09d8d9795989b0d@news-server>

Abigail writes ..
>You can actually omit quotes on alphanumhyphendots.

while most browsers support this laziness .. strictly speaking (as you so 
often are) it's not correct and does not comply with the W3C HTML 
Recommendations

>But I'm getting off-topic....

heaven forbid

-- 
 jason - remove all hyphens for email reply -


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

Date: 7 Jul 1999 05:52:29 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: repeating variables of the same name??
Message-Id: <7luput$gss@dfw-ixnews12.ix.netcom.com>

elephant (e-lephant@b-igpond.com) wrote:
: Abigail writes ..
: >You can actually omit quotes on alphanumhyphendots.
: 
: while most browsers support this laziness .. strictly speaking (as you so 
: often are) it's not correct and does not comply with the W3C HTML 
: Recommendations

It's only non-compliant with the XHTML drafts.  Otherwise, name tokens 
can go unquoted.



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

Date: 7 Jul 1999 00:57:28 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: repeating variables of the same name??
Message-Id: <slrn7o5r1i.tch.abigail@alexandra.delanet.com>

elephant (e-lephant@b-igpond.com) wrote on MMCXXXVI September MCMXCIII in
<URL:news:MPG.11ed8fe09d8d9795989b0d@news-server>:
'' Abigail writes ..
'' >You can actually omit quotes on alphanumhyphendots.
'' 
'' while most browsers support this laziness .. strictly speaking (as you so 
'' often are) it's not correct and does not comply with the W3C HTML 
'' Recommendations


If you want to get into a 'right', 'wrong' fight, be prepared to
back up your claims. I can, can you?


From the latest and greatest HTML specification:

   3.2.2 Attributes

   [ ... ]

   In certain cases, authors may specify the value of an attribute without any
   quotation marks. The attribute value may only contain letters (a-z and A-Z),
   digits (0-9), hyphens (ASCII decimal 45), and periods (ASCII decimal 46). We
   recommend using quotation marks even when it is possible to eliminate them.

   [http://www.w3.org/TR/1998/REC-html40-19980424]


While it is true they recommend the use of quotes, I am correct.

I usually give a rats ass what this weeks behaviour of the popular
browsers is. MSIE is Microsoft, and Netscape is worse. Hence they can't
be taken seriously. The specifications however, can.

Followups set.


Abigail
-- 
Always, always, always, alwaysAlways, ALWAYS, ALWAYS
(what I mean is, EVERY FRIGGIN TIME!) cite a source.
Just Do It. Do The Right Thing. Keep the Faith.
Cite A Source!
                   [Dan Connolly in `Table Syntax' <www-html@w3.org:
                    archive/latest/7888> <199704161901.PAA27276@www19.w3.org>
                    Dan Connolly is the author of the HTML 2.0 DTD]


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Wed, 7 Jul 1999 17:06:17 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: repeating variables of the same name??
Message-Id: <MPG.11eda7717b5cb3b4989b0e@news-server>

Eric Bohlman writes ..
>It's only non-compliant with the XHTML drafts.

that must have been where I read it .. still - it's bad advice to leave 
the quotes off

-- 
 jason - remove all hyphens for email reply -


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

Date: Wed, 7 Jul 1999 08:41:47 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: repeating variables of the same name??
Message-Id: <FEHs5n.8En@csc.liv.ac.uk>

In article <37829FBD.845A5B39@frontiernet.net>,
Bob Walton <walton@frontiernet.net> writes:
> bobby wrote:
> 
>>         I want to let people check more than one checkbox (name=person
>> value=$field[1]) - click submit to go to another screen that has all the
>> people they selected .... the problem is i'm only getting the first
>> checkbox they click, none of the other selections come through..
> 
> ...
> Bobby, you will need to give each checkbox a different name, since the value
> the browser returns is name=value -- if there are more than one checkbox
> with the same name, the results are not well defined, but definitely not
> what you want.  And all the text strings in the HTML input statement should
> have " around them, like:

B*******

> 
> <input type="checkbox" name="person1" value="whatever"> text ...
> <input type="checkbox" name="person2" value="whichever"> text ...

Oh no he doesn't. He just needs to extract the array of values that come
from all the checkboxes called person.

Something like
	use CGI;

	my $query = new CGI;
	my @people = $query->param('person');

	print <<END;
Content-type: text/plain

@people
END

will work perfectly.

> 
> I would suggest you get your HTML working using a text editor, then try to
> get Perl to write it :-).  And newsgroup comp.infosystems.www.authoring.cgi
> will probably give better help and fewer flames on this sort of question
> (that is, an HTML question, not a Perl question).

Nope. I, like Jonathan, believe it's a CGI.pm question, and last time I
checked that is relevant to Perl.

I can assume you have never tried to extract values from a SELECT
statement that has the MULTIPLE attribute set then? Because there is very
little difference between that and the multiple checkboxes with the
same name method.

-- 
Ian J. Garlick
ijg@csc.liv.ac.uk

As long as the answer is right, who cares if the question is wrong?



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

Date: Tue, 06 Jul 1999 18:12:43 +0100
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Re: Retrieving NT Services
Message-Id: <3782390B.2D85FCF0@patriot.net>

Giovanni...

Hey, man, you never responded to any of that code I sent you.

Did you get it?  If so, how did it work?  _Did_ it work for you?

 ....not even a "thank you" for all that effort...

C

Giovanni Davila wrote:

> I've used Win32::Service::GetServices and no luck!
> I'm looking for a way to retrieve all NT services from a machine. I'm
> currently using "sclist" from the NT resource kit and then putting the data
> into a file that I read with Perl and finally get it the way I want.
> I want to be able to skip the use of sclist if possible.
>
> Thank you!





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

Date: Wed, 7 Jul 1999 10:04:05 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: Retrieving NT Services
Message-Id: <MPG.11ed447ca586b353989b09@news-server>

Giovanni Davila writes ..
>I've used Win32::Service::GetServices and no luck!
>I'm looking for a way to retrieve all NT services from a machine. I'm
>currently using "sclist" from the NT resource kit and then putting the data
>into a file that I read with Perl and finally get it the way I want.
>I want to be able to skip the use of sclist if possible.

I just had a look at my Service.pm file (ActiveState perl 5.005_02 build 
508) and apart from the AUTOLOAD it's empty .. would kind of explain why 
things aren't working

I don't see it on CPAN so maybe ActiveState couldn't get it happening .. 
talk to them

-- 
 jason - remove all hyphens for email reply -


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

Date: Wed, 07 Jul 1999 06:09:23 +0100
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Re: Retrieving NT Services
Message-Id: <3782E103.7466C028@patriot.net>

Wow.  I sent this Giovanni guy code for this and other things
that he wanted and haven't heard back from him yet...

I use Win32::Lanman to get not only the service and it's status, but
the account that the service is running under, too.  This is really
important b/c in a lab-setup (installing something on a non-production
machine), I noticed that both Exchange and SQLServer use an account
that has "Act as Operating System" privileges.  This account can be
logged into from the 'Net...and if compromised can have devastating
effects...

elephant wrote:

> Giovanni Davila writes ..
> >I've used Win32::Service::GetServices and no luck!
> >I'm looking for a way to retrieve all NT services from a machine. I'm
> >currently using "sclist" from the NT resource kit and then putting the data
> >into a file that I read with Perl and finally get it the way I want.
> >I want to be able to skip the use of sclist if possible.
>
> I just had a look at my Service.pm file (ActiveState perl 5.005_02 build
> 508) and apart from the AUTOLOAD it's empty .. would kind of explain why
> things aren't working
>
> I don't see it on CPAN so maybe ActiveState couldn't get it happening ..
> talk to them
>
> --
>  jason - remove all hyphens for email reply -





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

Date: Wed, 07 Jul 1999 14:45:33 +0200
From: Andreas Hagelberg <qpkasha@epk.ericsson.se>
Subject: Right-clicking buttons in Perl/TK
Message-Id: <37834BED.8BABA14F@epk.ericsson.se>

Hi,

Is there a way to make a button or a bitmap react to a right-click with
the mouse (using a different subroutine than for left-click) and can you
make a button or bitmap react to a double-click?

______________________________________________________________________
ANDREAS HAGELBERG  -  Student at "Högskolan i Karlskrona/Ronneby
                   -  IT-consultant at Ericsson Software Technology AB
                   -  Webmaster at AllGlobal (http://allglobal.com)
+ E-mail:   tlb@algonet.se or di97aha@student.hk-r.se
+ Web:      http://www.algonet.se/~tlb - Visual Systems Check
+ Addres:   Stenbocksvägen 6, SE-372 37 Ronneby, SWEDEN
+ ICQ UIN:  128240
+ Tel:      +46-(0)457-19141
_______________________________________


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

Date: 7 Jul 1999 15:20:21 GMT
From: "Stephen O. Lidie" <lusol@Pandora.CC.Lehigh.EDU>
Subject: Re: Right-clicking buttons in Perl/TK
Message-Id: <7lvr7l$12a6@fidoii.cc.Lehigh.EDU>

Andreas Hagelberg <qpkasha@epk.ericsson.se> wrote:
> Hi,

> Is there a way to make a button or a bitmap react to a right-click with
> the mouse (using a different subroutine than for left-click) and can you
> make a button or bitmap react to a double-click?

Yes.  Use bind() to link the button event to a callback, something like:

	$w->bind('<Button-3>' => \&callback);

You'll get faster, better, answers in comp.lang.perl.tk.



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

Date: Tue, 6 Jul 1999 18:43:48 -0700
From: "Dude Man" <dudeman@dude.com>
Subject: s/// Bug/bad syntax?? (WAS:$scalars in s/// not working - anyone have any ideas?)
Message-Id: <7lubc8$fh4$1@birch.prod.itd.earthlink.net>

Hi All,

I've gotten few replies (thank you!) about this - and it does seem that what
I'm doing is correct, but for some reason just does not work. (see code
snippet below).

I'm using winnt 4.0 sp4 and ActivePerl 5.005_03 build 517.  Has anyone
experienced this, or am I just nuts?

-Arlo

 ...

if ( open(CATBODYFILE, $CATBODY) )
{
 $bodyLine="";
 $bodyLine = <CATBODYFILE>;
 $lineCount=1;

 while ($bodyLine ne "")
 {
  $colTmp=0;
  while ($colTmp < $colCount)
  {
   $replace="<--##$fields[0][$colTmp]##-->";
   $replaceWith=$fields[$lineCount][$colTmp]; ##### if $lineCount and
$colTmp are replace with a real
   print "$replace --- $replaceWith<br>\n";    ##### number, it works just
fine.  This prints the correct

##### values from the .csv file.
   $bodyLine =~ s/$replace/$replaceWith/;
   $colTmp++;
  }

  print "$bodyLine\n";                                      ##### should
print $replaceWith text, but does not print
  $bodyLine="";                                               ##### the
variable - it does print the rest of the line.
  $bodyLine = <CATBODYFILE>;
  $lineCount++;
 }
}







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

Date: 06 Jul 1999 23:19:28 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: s/// Bug/bad syntax?? (WAS:$scalars in s/// not working - anyone have any ideas?)
Message-Id: <x7g131uoxr.fsf@home.sysarch.com>

>>>>> "DM" == Dude Man <dudeman@dude.com> writes:

  DM> if ( open(CATBODYFILE, $CATBODY) )

what if the open fails? it is more common to do
	open( HANDLE, $file ) || die "can't open $file $!" ;
then the rest of the code without the extra indents.

  DM> {
  DM>  $bodyLine="";
  DM>  $bodyLine = <CATBODYFILE>;
why assign "" to than and then assign the lin from the file?

  DM>  $lineCount=1;

  DM>  while ($bodyLine ne "")

why do that? and then assign the next line at the end of the loop?
also how can $bodyLine eq ""? it really gets a value of undef at
EOF. you should test for that. if you had the -w option on, that would
generate a warning.

the perl idiom is (delete the assignments to $bodyLine above)

	while( defined( $bodyLine = <CATBODYFILE> ) ) {

  DM>  {
  DM>   $colTmp=0;
  DM>   while ($colTmp < $colCount)
  DM>   {
  DM>    $replace="<--##$fields[0][$colTmp]##-->";
  DM>    $replaceWith=$fields[$lineCount][$colTmp]; ##### if $lineCount and
  DM> $colTmp are replace with a real
  DM>    print "$replace --- $replaceWith<br>\n";    ##### number, it works just
  DM> fine.  This prints the correct

  DM> ##### values from the .csv file.
  DM>    $bodyLine =~ s/$replace/$replaceWith/;

maybe you don't really have that string in $bodyLine? or maybe there are
regex metachars in $replace? there are many reasons why this might not
work. blaming a perl bug is most likely NOT the answer. we have never
seen the exact data in either $bodyLine or $replace. why not make a
simple program with real data in use and show us that the regex doesn't
work. 

  DM>    $colTmp++;
  DM>   }

  DM>   print "$bodyLine\n";                                      ##### should
  DM> print $replaceWith text, but does not print
  DM>   $bodyLine="";                                               ##### the
  DM> variable - it does print the rest of the line.

  DM>   $bodyLine = <CATBODYFILE>;

delete that line as i note above.

  DM>   $lineCount++;
  DM>  }

  DM> }

no need for that brace since there should be no if block.

hth,

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: Tue, 6 Jul 1999 15:42:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Scalars ---> Arrays
Message-Id: <MPG.11ec2633ab877efb989c66@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7lu7qm$dfl8@news.cyber.net.pk> on Tue, 6 Jul 1999 19:37:52 
+0500, Faisal Nasim <swiftkid@bigfoot.com> says...
> > Ok lets see (I throw in the bonus regex solution for comparison):
> >
> > Benchmark: timing 100000 iterations of Bart, Faisal, Jonathan, Regex,
> Traditional...
> >       Bart: 15 wallclock secs (15.17 usr +  0.00 sys = 15.17 CPU)
> >     Faisal: 16 wallclock secs (14.74 usr +  0.00 sys = 14.74 CPU)
> >   Jonathan: 18 wallclock secs (16.62 usr +  0.00 sys = 16.62 CPU)
> >      Regex: 13 wallclock secs (12.42 usr +  0.00 sys = 12.42 CPU)
> > Traditional: 13 wallclock secs (13.17 usr +  0.00 sys = 13.17 CPU)
> >
> > I Win !!! ;-}
> 
> I posted that initial 'traditional' so I came second, thats not bad for a
> kid though :)
> 
> If you look at non-traditional (regex and traditional) you are @ last!
> 
> BTW, If it took 14.74, 0 sys and 14.74 sec how can it be 16 wallclock secs?
> Your answer: the same way its 18 for 16.62, 0 and 16.62 :)
> My reply: Can ya tell me logic?

They are measuring different things using different system calls.  You 
could have discovered this yourself by peeking at the Benchmark.pm 
module.

The 'wallclock secs' measures elapsed time using the time() function; 
resolution is one second.  The other numbers are measures of processor 
time using the times() function; resolution is typically 0.01 second.

When there is other system activity (not on Windows 95, of course), the 
elapsed time can be much larger than the sum of the processor times.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 6 Jul 1999 17:24:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Scalars ---> Arrays
Message-Id: <MPG.11ec3e1ddc92e8fb989c69@nntp.hpl.hp.com>

In article <37806b3a.2031236@news.skynet.be> on Mon, 05 Jul 1999 
08:35:34 GMT, Bart Lateur <bart.lateur@skynet.be> says...
> Faisal Nasim wrote:
 ...
> >> I mean why go to all the expense of some meganutterbastard 'pootey if
> >> you're not going to use some of those spare cycles ;-}
> >
> >Again, I don't understand what you are trying to say.
> 
> I think he's referring to the current humorous habit of answerring FAQ's
> with working, but far to elaborate (and slow) solutions. I'd call it
> something like "FAQ obfuscation".

I'd call it something like "newbie abuse".

> Oh, here's my contribution:
> 
> 	$str = 'newsgroups';
> 	@array = map chr, unpack "C*",$str;
> 	# print "@array\n";

Yeah.  Ha, ha.  At least it's labeled, sort of.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V9 Issue 63
************************************


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