[17702] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5122 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 15 11:05:32 2000

Date: Fri, 15 Dec 2000 08:05:11 -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: <976896311-v9-i5122@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 15 Dec 2000     Volume: 9 Number: 5122

Today's topics:
    Re: #include files? sort of (Stan Brown)
    Re: [q] split in while loop <bh_ent@my-deja.com>
    Re: Attach file in email? mike_solomon@lineone.net
        cookies <brasen@email.dk>
        flat text file or MySQL bababozorg@aol.com
    Re: flat text file or MySQL bababozorg@aol.com
    Re: flat text file or MySQL <fty@mediapulse.com>
    Re: Is it possible to log into an area protected by .ht <tony_curtis32@yahoo.com>
        Multiple ICMP Pings <rodneyra@my-deja.com>
    Re: ndbm/gdbm problem with Perl 5.6 asorrell@troweprice.com
    Re: Network <eric@urbanrage.com>
        New lines when writing to files <coz@paston.co.uk>
    Re: New lines when writing to files <eric@urbanrage.com>
    Re: New lines when writing to files <ccx138@coventry.ac.uk>
    Re: New lines when writing to files (Richard Zilavec)
    Re: perl scripts as exe's (Arek P)
        Quick and easy question about arrays msalerno@my-deja.com
    Re: Quick and easy question about arrays <jdhunter@nitace.bsd.uchicago.edu>
    Re: Regex can't be greedy with /(a|ab)/ ? - what would  (Tom Christiansen)
    Re: Stripping out meta tags from web pages (Rafael Garcia-Suarez)
        This must be a FAQ (; in stings) (Stan Brown)
    Re: This must be a FAQ (; in stings) <josef.moellers@fujitsu-siemens.com>
    Re: while(m//g) v.s. while(s///g) <bart.lateur@skynet.be>
    Re: Why are multiple zeroes true? (Tom Christiansen)
    Re: Windows cant recognize the original owner <Alessandro.Augusto@br.bosch.com>
    Re: Windows cant recognize the original owner <mwood@mhw.ULib.IUPUI.Edu>
    Re: Windows cant recognize the original owner <gareth@uberdog.net>
    Re: Windows cant recognize the original owner <Alessandro.Augusto@br.bosch.com>
    Re: Windows cant recognize the original owner (Martijn Lievaart)
    Re: Windows cant recognize the original owner <Alessandro.Augusto@br.bosch.com>
    Re: Windows cant recognize the original owner <Alessandro.Augusto@br.bosch.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 15 Dec 2000 09:07:09 -0500
From: stanb@panix.com (Stan Brown)
Subject: Re: #include files? sort of
Message-Id: <91d8id$ahb$1@panix3.panix.com>

In <91bnhd$opk$1@panix6.panix.com> stanb@panix.com (Stan Brown) writes:

>In <iigi3tc4q0foktlmko4irr20ulsde9ovpd@4ax.com> Bart Lateur <bart.lateur@skynet.be> writes:

>>Stan Brown wrote:

>>>	I have a small perl script that will eventually be one of a pair of
>>>	co-operating tasks. I am planing on using on confiugration file for
>>>	both tasks. Since the code for pareseing this file is common, I wnat to
>>>	pull it out into a file to "#included" by both scripts. Hees what I
>>>	have at the top of the existing script.
>>...

>>Hold your horses. First of all, you declare your variables with "my", so
>>they are NOT global variables. They are, in this incarnation, file
>>scoped variables. Therefore, the config library file cannot touch them
>>directly. Why don't you really make them global variables, by dropping
>>the "my"? If you just put "::" in font of the variable's names, then you
>>don't need to declare them, not even when using strict, and better
>>still, the config file can set them directly. Like this:

>	Ah, I had not picked up on thta. I jsut started puting my in front of
>	them when I turned strict on, and it brought on the complaints. I did
>	figure out not to use local. which was my first inclination.
>	I was not aware of teh :: syntaz, thnaks for the tipe.

>>	$::pid_file = '/opt/local/run/pi_collect.pid';

	I just wanted to say THABK YOU to all the helpful people who helped me
	learn how this worked, and get it going.

	Thanks very much.


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

Date: Fri, 15 Dec 2000 15:13:50 GMT
From: Drew Myers <bh_ent@my-deja.com>
Subject: Re: [q] split in while loop
Message-Id: <91dcf7$vka$1@nnrp1.deja.com>

Ok,

That solved the split issue.  The second problem I'm having.  It seems
that the line:

next if (/avm/) {
  $free = (split)[1];
  print $free;
}

matches the string avm, which is what I want.  The output from the
print statement prints everything except the line with "avm".  How do I
match just the second field of the following line?

The log looks like:
 avm     free  si   so   pi   po   fr   de   sr   in    sy   cs
62401  418249  0    0    0    0    0    0    0    74    99  268

CPU
    cpu          procs
us sy id    r    b    w
24  6 71    1    2    0

I only want the 418249, but I get everything except the avm line.  Any
suggestions?

Thanks for your patience!


--
Drew Myers
perotsystems


Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 15 Dec 2000 14:07:00 GMT
From: mike_solomon@lineone.net
Subject: Re: Attach file in email?
Message-Id: <91d8i1$s8u$1@nnrp1.deja.com>

In article <wQo_5.574$wz.31406@nntp1.chello.se>,
  "Lars Svensson" <lars_lars@home.se> wrote:
> Hello.
> I've written a small script to send email from a website. I want to
expand
> it so I can attach a file and I don't know where to start.
> Can someone help me?
>
> regards Lars
>
> --**--**--**--**--
>
> #!/usr/local/bin/perl
> use CGI ':standard';
> print header('text/html');

have a look at the  MIME Lite module

It works well

Regards

Mike Solomon


> open F, ">email" or die "Fel! :$!";
> print F "To: " . param('to') . "\n";
> print F "From: " . param('from') . "\n";
> print F "Subject: " . param('subject') . "\n\n";
> print F param('message') . "\n";;
> close F;
>
> system('/usr/lib/sendmail -t -oi < email');
>
> print "<html><body><h1>OK!</h1></body></html>";
>
> open(EMAIL, "<email") or die "Bummer...";
> while($row = <EMAIL>) {
>  $row =~ s/---(.*?)---/eval $1/eg;
>  print "$row";
> }
> close EMAIL;
> system("rm ./email");
>
>


Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 15 Dec 2000 16:03:35 +0100
From: "Claus" <brasen@email.dk>
Subject: cookies
Message-Id: <91dbov$he$1@news.cybercity.dk>

hi guys! :)

I'm trying to create my first script.
I want to set a cookie.
Is this code ok:

#! /usr/bin/perl
use CGI qw/:standard/;
use CGI::Cookie;
# Create new cookies and send them
$cookie1 = new CGI::Cookie(-name=>'testcookie',-value=>testtal)
print header(-cookie=>[$cookie1]);

I save it as test.cgi, upload it and chmod 755.
Then I call it with:
<a href=/cgi-bin/test.cgi>test cookie</a>
but it doesn't work :(

anyone know why? Thanks! :)

Also: is there another way, that I can call the script, without the surfer
has to do anything?





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

Date: Fri, 15 Dec 2000 14:59:59 GMT
From: bababozorg@aol.com
Subject: flat text file or MySQL
Message-Id: <91dblb$usa$1@nnrp1.deja.com>

hi

i am about to write this Advertising program, but i am not sure about
one thing... whether or not use MySQL or flat text files as my
database...

I would like to use MySQL, but i am worried if it will work fast enough
since everytime a banner is requested a connection have to be made to
the database... i know that i could use mod_perl under apache to speed
the things up... but this program going to be sold commecrially so
customers may not have mod_perl installed.... or want to use this
program under other webservers...

and i dont know if flat text files would be reliable for this type of
program or not...

I am realy concerned about he speed of this program and if it can
handel the speed if there is a large volume of banners requested per
day...

what do you think i should use?

Best regards
Hamed


Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 15 Dec 2000 15:10:55 GMT
From: bababozorg@aol.com
Subject: Re: flat text file or MySQL
Message-Id: <91dc9o$vhs$1@nnrp1.deja.com>

Hey, i forgot to include something for those guys that want to
say "wrong newsgroup"...

i am going to write this program in perl,... so considering that... and
your previuos experiences... please answer my question! ;))

thank you all

regards
hamed



In article <91dblb$usa$1@nnrp1.deja.com>,
  bababozorg@aol.com wrote:
> hi
>
> i am about to write this Advertising program, but i am not sure about
> one thing... whether or not use MySQL or flat text files as my
> database...
>
> I would like to use MySQL, but i am worried if it will work fast
enough
> since everytime a banner is requested a connection have to be made to
> the database... i know that i could use mod_perl under apache to speed
> the things up... but this program going to be sold commecrially so
> customers may not have mod_perl installed.... or want to use this
> program under other webservers...
>
> and i dont know if flat text files would be reliable for this type of
> program or not...
>
> I am realy concerned about he speed of this program and if it can
> handel the speed if there is a large volume of banners requested per
> day...
>
> what do you think i should use?
>
> Best regards
> Hamed
>
> Sent via Deja.com
> http://www.deja.com/
>


Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 15 Dec 2000 16:02:08 GMT
From: "Jay Flaherty" <fty@mediapulse.com>
Subject: Re: flat text file or MySQL
Message-Id: <3gr_5.88627$IP1.2987597@news1.giganews.com>

<bababozorg@aol.com> wrote in message news:91dblb$usa$1@nnrp1.deja.com...
> hi
>
> i am about to write this Advertising program, but i am not sure about
> one thing... whether or not use MySQL or flat text files as my
> database...
>
> I would like to use MySQL, but i am worried if it will work fast enough
> since everytime a banner is requested a connection have to be made to
> the database... i know that i could use mod_perl under apache to speed
> the things up... but this program going to be sold commecrially so
> customers may not have mod_perl installed.... or want to use this
> program under other webservers...

mod_perl is not the only thing available that provides persistent database
connections for web servers.
Your application will be more rubust and scalable if you use a database. A
big performance hit will be the CGI overhead for your perl script anyway so
if they don't have mod_perl (or another solution to speed up CGI with perl)
they will run into performance problems with or without a database
connection.

jay

--
###############################
Take care of your shoes...jay
Jay Flaherty                     fty@mediapulse.com
Mediapulse, Inc. -The pulse of your eBusiness



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

Date: 15 Dec 2000 09:23:23 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Is it possible to log into an area protected by .htaccess with a perl script and how.
Message-Id: <87elz9ogic.fsf@limey.hpcc.uh.edu>

>> On Fri, 15 Dec 2000 01:38:21 -0600,
>> "John Michael" <johnm@acadiacom.net> said:

> Is it possible to log into an area protected by .htaccess with a
> perl script and how.

    perldoc lwpcook

has an example

hth
t
-- 
Eih bennek, eih blavek.


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

Date: Fri, 15 Dec 2000 14:01:43 GMT
From: Rodney Ramos <rodneyra@my-deja.com>
Subject: Multiple ICMP Pings
Message-Id: <91d884$rtv$1@nnrp1.deja.com>

Does anyone know how can I make a scrip to ping several hosts at same
time? I mean, I want to ping several hosts without having to wait one
finish to ping the next, because I have to do this in a short period of
time and I have more than 1,000 hosts.

Thanks,

Rodney.




Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 15 Dec 2000 14:22:19 GMT
From: asorrell@troweprice.com
Subject: Re: ndbm/gdbm problem with Perl 5.6
Message-Id: <91d9em$std$1@nnrp1.deja.com>

In article <91d0od$v8o$1@lublin.zrz.tu-berlin.de>,
  anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
> Al  <"al<NoSpam> wrote in comp.lang.perl.misc:
> >Environment - Solaris 2.6 sparc, Perl 5.005.02 & Perl 5.6, gdbm-1.8.0
> >
> >Initially, Perl 5.005.02 was built without gdbm support. We ran into
a
> >problem with bucket 'overload' so I decided to go to gdbm which
> >supposedly doesn't have that problem. We have a number of files,
> >generated via hash 'tie' statements and using NDBM_File which have
had
> >no problem in the past.
> >
> >I downloaded SMCgdbm-1.8.0 and installed it (/usr/local/lib) with no
> >apparent problem. I then got the latest stable Perl version (5.6),
and
> >installed it. The install found the gdbm libraries, although the
build
> >initially failed until I added /usr/local/lib to LD_LIBRARY_PATH.
After
> >that the SNMP build proceeded normally and all tests passed. After a
> >'make install', I found that existing programs using NDBM could no
> >longer open the file - no error was returned via $!, just couldn't
open
> >it!
> >
> >If I created a new file (still using the exact same programs using
> >NDBM), the programs worked as expected - just unable to open existing
> >files.
>
> Yes, of course.  You must migrate your database to GDBM before GDBM
> can use it.  The migration process is basically:
>
> 1 Tie one hash %h_ndbm to the original database using NDBM.
>
> 2 Create a new hash %h_gdbm and tie it to a new database using
>   GDBM.  Use a different name from the old database file.
>
> 3 Copy the old hash to the new one.  You can simply say %h_gdbm =
>   %h_ndbm, but that loads the whole hash into memory (twice,
actually),
>   so you may want to loop over the key/value pairs using each().
>
> 4 Step 3 has created a database file (or two).  Rename them to the
>   old name.
>
> Repeat this for every database you have.  Now the old program should
> run using GDBM instead of NDBM in the tie statements.
>
> Anno
>

Thanks for your comments, but I think you misunderstood - after creating
the new version of Perl, including GDBM, existing programs using
NDBM_File attempting to run on existing NDBM files could no longer open
the file! In fact, the process you outlined is exactly what I had been
planning to do but was thwarted because I was unable to open the
existing NDBM file.

BTW, creating a symlink from /usr/lib/<gdbm> to the real libs in
/usr/local/lib resolved the need for LD_LIBRARY_PATH and fixed the httpd
problem.


Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 15 Dec 2000 09:06:41 -0600
From: eric <eric@urbanrage.com>
Subject: Re: Network
Message-Id: <3A3A3381.2EFB5587@urbanrage.com>

Rick Langschultz wrote:

> I have a windows and a linux server, one upstairs(linux) and windows
> downstairs, I want to set up a chat client so we don't have to yell down to
> my mom when we need something. Or vice-versa. Can i do this with the
>
> IO::Socket
> IO::Select
>
> Thingers. I hope so, if you could lead me to great resources that would be
> cool, thx

set up pircd ( a perl implementation of irc) on linux box and use xchat (or
other irc client) on linux side and any window's  irc client and your good to
go...

Eric



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

Date: Fri, 15 Dec 2000 14:19:15 -0000
From: "Marcus" <coz@paston.co.uk>
Subject: New lines when writing to files
Message-Id: <91d9d7$obh$1@reader-00.news.insnet.cw.net>

Hey,

I run a nameserver and I am trying to automate the process of editing the
conf files
for each domain by using a perl script to write the files for me after
taking some input on
the standard input, (unix) and assigning them to scalars to be printed
during the writing to the file,

The problem is that after these scalars are printed they are followed by a
new line, how can I stop this ??

Mark









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

Date: Fri, 15 Dec 2000 08:57:01 -0600
From: eric <eric@urbanrage.com>
Subject: Re: New lines when writing to files
Message-Id: <3A3A313D.A709BF57@urbanrage.com>

Marcus wrote:

> Hey,
>
> I run a nameserver and I am trying to automate the process of editing the
> conf files
> for each domain by using a perl script to write the files for me after
> taking some input on
> the standard input, (unix) and assigning them to scalars to be printed
> during the writing to the file,
>
> The problem is that after these scalars are printed they are followed by a
> new line, how can I stop this ??

chomp;

>
>
> Mark



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

Date: Fri, 15 Dec 2000 15:17:37 +0000
From: John Tutchings <ccx138@coventry.ac.uk>
Subject: Re: New lines when writing to files
Message-Id: <3A3A3610.C60CE99A@coventry.ac.uk>

Try using chomp or chop
chomp is the preferred one because it only removes the new line character,
chop will remove what ever the last character is.
e.g.

$input = <STDIN>;
chomp($input);
print FILE $input;

Marcus wrote:

> Hey,
>
> I run a nameserver and I am trying to automate the process of editing the
> conf files
> for each domain by using a perl script to write the files for me after
> taking some input on
> the standard input, (unix) and assigning them to scalars to be printed
> during the writing to the file,
>
> The problem is that after these scalars are printed they are followed by a
> new line, how can I stop this ??
>
> Mark



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

Date: Fri, 15 Dec 2000 15:20:29 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: New lines when writing to files
Message-Id: <3a3d3696.249056143@news.tcn.net>

On Fri, 15 Dec 2000 14:19:15 -0000, "Marcus" <coz@paston.co.uk> wrote:

>
>The problem is that after these scalars are printed they are followed by a
>new line, how can I stop this ??

perldoc -f chomp

$in = <>;
chomp $in;

--
 Richard Zilavec
 rzilavec@tcn.net


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

Date: Fri, 15 Dec 2000 10:55:45 EST
From: Arek@nospam._pietruszewski_.com (Arek P)
Subject: Re: perl scripts as exe's
Message-Id: <91deu1$2foi$1@earth.superlink.net>

On Fri, 15 Dec 2000 03:01:18 GMT, "John Boy Walton"
<johngros@Spam.bigpond.net.au> wrote:

Use perl2exe  http://www.indigostar.com/ (my choice) or if You have
Perl Dev Kit, thats another alternative.

		ArekP
>I have seen it somewhere in the docs once but I have been cruising the docs
>back and forth for a few hours and can't find it. If any one could point me
>in the right direction I thank you.
>
>



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

Date: Fri, 15 Dec 2000 15:15:22 GMT
From: msalerno@my-deja.com
Subject: Quick and easy question about arrays
Message-Id: <91dci3$vtn$1@nnrp1.deja.com>

In article <91b396$626$1@nnrp1.deja.com>,
  msalerno@my-deja.com wrote:
> In article <1rpuivcbd4.fsf@video.bsd.uchicago.edu>,
>   John Hunter <jdhunter@nitace.bsd.uchicago.edu> wrote:
> > >>>>> "msalerno" == msalerno  <msalerno@my-deja.com> writes:
> >
> >     >>
> >     msalerno> There was absolutely nothing wrong with the proposed
> >     msalerno> solution, but, I want to get as much information as
> >     msalerno> possible before I consider the script complete.  There
> >     msalerno> are many ways to accomplish the same task with perl,
and
> >     msalerno> I like to get as many opinions as I can.  The
> >     msalerno> information supplied by Chris Fedde was perfect, but
the
> >     msalerno> reason that we all post here is so that we can collect
> >     msalerno> as much information as possible, and that is all that
I
> >     msalerno> am doing.  And since I just got 4+ posts letting me
know
> >     msalerno> that I cannot modify a field in the passwd file
without
> >     msalerno> rewriting the entire file, I can focus on that.
> >
> > Here's another solution.  If assumes colon separated fields in
> > /etc/passwd and a shell cp in your path.  The script writes to
STDOUT.
> > Uncomment line to write to /etc/passwd after testing.
> >
> > There is a hash of pairs from usernames to encrypted passwords which
> > stores the values that need updating.
> >
> > Good luck,
> > John Hunter
> >
> > #!/usr/local/bin/perl -w
> >
> > use strict;
> > use Shell('cp');
> >
> > #username passwd pairs
> > my %updates = ('jdhunter' => 'passwd1',
> > 	       'miriam' => 'passwd2');
> >
> > #make this whatever you want
> > my $backupFile = 'passwd.bak';
> > cp('/etc/passwd', $backupFile);  #make a backup
> > open(PASSWD, "<$backupFile") || die "can't open /etc/passwd\n";
> >
> > #uncomment after sufficient testing convinces you the script is ok
> > #open(OUTFILE, ">/etc/passwd") || die "Can't write /etc/passwd\n";
> > open(OUTFILE, ">-") || die "Can't write to STDOUT\n";
> >
> > while (<PASSWD>) {
> >   my @fields = split /:/;
> >   $fields[1] =  $updates{$fields[0]} || $fields[1];
> >   print OUTFILE join ':', @fields;
> > }
> >
>
> I actually just finished working out another way to do it.  I used a
> more mundane logic, but I am pretty sure that it will do what I need
it
> to.  I will go back over it an see what I can improve.  It may not be
> the best script but it is a start.
>
> Thanks again,
> Matt
>
> # Still need lock file, copy and backup of passwd file -
> # but that is no problem. This is just for functionality
> #!/usr/bin/perl -w
> use strict;
> use vars qw($o $user $pword $uid $gid $comment $home $shell);
>
> PASSWD:
> print "Enter the user information that you want to search for : ";
> chomp(my $search =  <STDIN> );
> print "\n";
> goto PASSWD unless length($search) > 0;
>
> my $file = '/etc/passwd';
> open(INFO, $file);
> my @lines = <INFO>;
> close(INFO);
> my $cnt = 0;
>
> for (my $i= 0; $i < @lines; $i++)
> {
>         if (lc($lines[$i]) =~ /\Q$search/){
>         my($user, $pword, $uid, $gid, $comment, $home, $shell) =
> split(/:/, $lines[$i]);
>         print "User: $user\tComments: $comment\n";
>         $cnt++;
>         $o = $i;
>         }
> }
>
> die "No Users found with current search criteria - \"$search\"\n" if
> $cnt < 1;
> die "\n$cnt users found who match the search criteria \nPlease refine
> your search or look at the above list for the user\n\n" if $cnt > 1;
>
> if ($cnt == 1){
> my($user, $pword, $uid, $gid, $comment, $home, $shell) = split(/:/,
> $lines[$o]);
> $pword = "testing";
> my $test = join(':',$user, $pword, $uid, $gid, $comment, $home,
$shell);
> print $test;
> print $o;
> $lines[$o] = $test;
> open(NP, "> /tmp/passwd");
> print NP @lines;
> close(NP);
> }
>

What if there is another value after $shell, what will happen to it ?

my($user,$pword,$uid,$gid,$comment,$home,$shell)=split(/:/,$lines[$i]);


Sent via Deja.com
http://www.deja.com/


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

Date: 15 Dec 2000 09:37:30 -0600
From: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
Subject: Re: Quick and easy question about arrays
Message-Id: <1rhf45wv9h.fsf@video.bsd.uchicago.edu>


Quick etiquette point: when responding to posts, only include as much
of the previous post to preserve the context of the question.

>>>>> "msalerno" == msalerno  <msalerno@my-deja.com> writes:

    msalerno> What if there is another value after $shell, what will
    msalerno> happen to it ?

    msalerno> my($user,$pword,$uid,$gid,$comment,$home,$shell)=split(/:/,$lines[$i]);

It's still in $lines[$i], but you don't have access to it in
your variable list.  As with all programming questions, when in doubt,
test:

        my ($var1, $var2, $var3) = split /:/, 'John:Hunter:Was:Here';
        print "$var1 $var2 $var3\n";

That is why I liked the approach I took in the solution I posted
above.  You do not need to know anything about the fields after the
username and password part.  As long as username is first and password
is second, the script works for an arbitrary number of fields in an
arbitrary order after that.  I still suggest that approach: easier to
read, write, maintain and debug.

Good luck,
John Hunter


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

Date: 15 Dec 2000 08:51:59 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: Regex can't be greedy with /(a|ab)/ ? - what would happen if they were ?
Message-Id: <3a3a3e1f$1@cs.colorado.edu>

In article <91cp2f$qhu$01$1@news.t-online.com>,
Patrick Stein  <thisisnotanemailaddress@dtag.de> wrote:
>The only solution 
>in perl seems now the suggested "while( $stringToSearch =~ $regex ){.." which 
>in my case will be too slow.

You mean while ($string =~ /$regex/g).  And that's not necessarily too
slow.  In some cases, you might do better to pre-"compile" it, as in
to create $regex = qr/$string/. 

>So my next question is, if someone would hack a new style | regex into perl 
>would it break older programs ? - I think not but my vision might be limited 
>to regexes I usually work with.
>An extension like '(?lLa|ab)'  ( questionmark lowercase L ( ongest ) ) should 
>always be backward compatible right ?

You can't do that.  The letters are reserved for modifiers.  Any
such (?X....) syntax must be the same as /..../X, for all X.

I just posted a longish message to p5p about why Perl doesn't
do guaranteed worst-case behavior here.  You might check it out.

--tom


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

Date: Fri, 15 Dec 2000 14:30:54 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Stripping out meta tags from web pages
Message-Id: <slrn93kao3.2h2.rgarciasuarez@rafael.kazibao.net>

Tony O Sullivan wrote in comp.lang.perl.misc:
> Hi,
> Sorry if this is a bit too simple a thing to be asking , just I have spent
> the last few days on it and I can't find the solution anywhere on the net or
> think my way round the problem
> 
> here it is:
> I am trying to strip out the keywords, descriptions and authors from html
> documents

You should look at the HTML::Parser module, available from CPAN.

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: 15 Dec 2000 09:56:37 -0500
From: stanb@panix.com (Stan Brown)
Subject: This must be a FAQ (; in stings)
Message-Id: <91dbf5$f46$1@panix6.panix.com>

	This must be a FAQ, but searching in this newsgroup on the ket FAQ did
	not reveal the answer.

	How do I get a ; in a string?

	I'm trying to do someting like this:

	$var2 = $var1, '.*;*';
	$ftp->delete($var2):

	That is, take an existing string variable, and add ".*;*" to it, the
	use this variable.



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

Date: Fri, 15 Dec 2000 16:20:58 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: This must be a FAQ (; in stings)
Message-Id: <3A3A36DA.C72A8A59@fujitsu-siemens.com>

Stan Brown wrote:
> =

>         This must be a FAQ, but searching in this newsgroup on the ket =
FAQ did
>         not reveal the answer.
> =

>         How do I get a ; in a string?
> =

>         I'm trying to do someting like this:
> =

>         $var2 =3D $var1, '.*;*';
>         $ftp->delete($var2):
> =

>         That is, take an existing string variable, and add ".*;*" to it=
, the
>         use this variable.

User the . operator, not the comma!

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize (T.  Pratchett)


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

Date: Fri, 15 Dec 2000 16:01:30 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: while(m//g) v.s. while(s///g)
Message-Id: <vufk3t01bmr086r6ja7vp6ejkjcfctks9t@4ax.com>

John Lin wrote:

>For the following program
>
>    $_ = "1 2 3 4 5";
>    while(m/\d/g) { print "matching $&\n" }
>
>__END__
>matching 1
>matching 2
>matching 3
>matching 4
>matching 5
>
>how can I do the same thing on s/// ?
>
>    $_ = "1 2 3 4 5";
>    while(s/\d/0/g) { print "replacing $&\n" }
>
>__END__
>replacing 5
>replacing 0
>...
>
>(I want "replacing 1, replacing 2 ... replacing 5".)

You can build the code block into the substitution side, if you provide
the /e modifier.

	$_ = " 1  2  3  4  5 ";
	s/\d/print "replacing $&\n"; "0"/ge;
	print;

-- 
	Bart.


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

Date: 15 Dec 2000 08:46:17 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: Why are multiple zeroes true?
Message-Id: <3a3a3cc9@cs.colorado.edu>

In article <x7zohygpod.fsf@home.sysarch.com>,
Uri Guttman  <uri@sysarch.com> wrote:
>it doea make sense if you think about perl's conversions. undef is the
>real false value. 

I don't think that's right.  Would you not agree that the result
of the expression C<< 1 < 0 >> is as "real" a false value as it
gets?  It returns the null string.  This is not undef, but rather
the defined null string.

    % perl -Mwarnings -le '$x = 1 < 0; print $x'


    % perl -Mwarnings -le '$x = 1 < 0; print defined $x'
    1

Actually, it's somewhat special: this version of the null
string is not the same as C<"">, because it is exempt from
whatever2string or whatever2number conversion warnings:

    % perl -Mwarnings -le '$x = 1 < 0; print $x . "fred"'
    fred

    % perl -Mwarnings -le '$x = 1 < 0; print $x+10'
    10

Isn't that interesting?  If not, look again. :-)

Here's the text from the Camel on this truth business:

    Another special don't-care scalar context is called I<Boolean
    context>.  Boolean context is simply any place where an expression
    is being evaluated to see whether it's true or false.  When we
    say "true" and "false" in this book, we mean the technical
    definition that Perl uses: a scalar value is true if it is not
    the null string C<""> or the number 0 (or its string equivalent,
    C<"0">).  A reference is always true because it represents an
    address which is never 0.  An undefined value (often called
    C<undef>) is always false because it looks like either C<"">
    or 0, depending on whether you treat it as a string or a number.
    (List values have no Boolean value because list values are never
    produced in a scalar context!)

It's cleanest to thing of there being just two false values in Perl:
zero and the null string--thus, anything that reduces to one of
these is itself false.  I like thinking of it like this because
it's easier to remember just 2 rules than the 4, 5, or even 6 that
you often see people cite.

However, the C<"0"> case is a bit of an outlier.

    whether_'tis_false ::= (length==0) || (length==1 && string eq "0")

But yes, it's to facilitate more transparent er, um, "numerocadential
introconvertibility" :-).  You wouldn't want the internal representation
to matter.  It would be nasty if something's Boolean value were
different depending on how you got to the C<"0">.

This is not always a completely compelling argument, I realize.
Larry could doubltess offer a more convincing treatment.

--tom


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

Date: Fri, 15 Dec 2000 12:18:18 -0200
From: Alessandro Augusto <Alessandro.Augusto@br.bosch.com>
Subject: Re: Windows cant recognize the original owner
Message-Id: <3A3A282A.15E00EE3@br.bosch.com>

Sorry, but I didnt understand what you mean.
Also, say some practical example.

Alessandro



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

Date: 15 Dec 2000 14:21:58 GMT
From: "Mark H. Wood" <mwood@mhw.ULib.IUPUI.Edu>
Subject: Re: Windows cant recognize the original owner
Message-Id: <91d9e6$ju9$2@hercules.iupui.edu>

In comp.os.ms-windows.nt.admin.misc Alessandro Augusto <Alessandro.Augusto@br.bosch.com> wrote:
> I dont think.
> 
> The goal of a security administrator is that his network be secure.
> so if he sets some permissions, probably that is the best solution to known
> exploits.

NT security is designed also for use in places where even security
admin.s are suspect, if they step outside carefully plotted
procedures.  In most environments, your advice here is reasonable, but
not everywhere.

> but if the user chances it, he leaves open holes.
> 
> The problem is, why, when the administrator has no permission to a
> file/folder, when he wants to get the ownership, why NT does not
> recognize the older owner?

The original owner may have had access to files only because it was
granted to the builtin Creator/Owner object.  If you change the
ownership, you change the user object to which such permissions apply.

We would have to have detailed information about the ACLs of affected
files before and after the ownership change, to give a definite
explanation.

-- 
Mark H. Wood, Lead System Programmer   mwood@IUPUI.Edu
The AVR menu said, "if you are running Novell, press 4."  Eric Schmidt
is running Novell; the rest of us are running Netware.


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

Date: Fri, 15 Dec 2000 14:51:21 GMT
From: Gareth Jones <gareth@uberdog.net>
Subject: Re: Windows cant recognize the original owner
Message-Id: <prbk3to83lhe853e7ikdm8net319rrs5dv@4ax.com>

"Mark H. Wood" <mwood@mhw.ULib.IUPUI.Edu> wrote:

>In comp.os.ms-windows.nt.admin.misc Alessandro Augusto <Alessandro.Augusto@br.bosch.com> wrote:
>> I dont think.
>> 
>> The goal of a security administrator is that his network be secure.
>> so if he sets some permissions, probably that is the best solution to known
>> exploits.
>
>NT security is designed also for use in places where even security
>admin.s are suspect, if they step outside carefully plotted
>procedures. 

This isn't correct. There are, I believe, operating systems with such
features, but nt isn't one of them. The administrator can do anything.
It is perfectly possible to seize ownership of a file, examine it, and
then set the ownership and permissions back the way they were....

Gareth


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

Date: Fri, 15 Dec 2000 13:06:53 -0200
From: Alessandro Augusto <Alessandro.Augusto@br.bosch.com>
Subject: Re: Windows cant recognize the original owner
Message-Id: <3A3A338C.F21CCF45@br.bosch.com>

Thats exacly what I want to do on NT.
How do I do it, to get the older owner, set the administrator as the owner,
change some permissions of this object, then set back the original owner.

How do I do that on a object (file or folder) that the administrator permissions
were removed?

Alessandro


> It is perfectly possible to seize ownership of a file, examine it, and
> then set the ownership and permissions back the way they were....
>
> Gareth



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

Date: 15 Dec 2000 15:11:23 GMT
From: xnews.public.home@bogus.rtij.nl (Martijn Lievaart)
Subject: Re: Windows cant recognize the original owner
Message-Id: <Xns900BAA2E7youdontwannaknow@194.109.6.74>

"KlausL" <NoJunkMail&Klaus.L@attglobal.net> wrote in 
<91d2jb$upk$1@arachne.labyrinth.net.au>:

>Alessandro,
>
>I don't think this is a weakness; its a design feature! It allows users
>to protect their files from the prying eyes of unethical system
>administrators.
>If an administrator seizes ownership of the folder in question then he
>leaves a telltale behind that makes it clear to the owner that someone
>has obtained access to his folders.
>

Ah, but being administrator, there are so many ways around this[1]! It's a 
bug.

HTH,
M4
[1] F.i. try the at command, it runs a command with system priviliges and 
can be used to start a shell.

>Klaus
>
>Alessandro Augusto wrote in message <3A39F66B.91EE4157@br.bosch.com>...
>>I found a Windows weakness with the ownership. I havenīt heard anything
>>about
>>it, so let me try to explain.
>>
>>Supose this:
>>c:\home\user1
>>c:\home\user2
>>c:\home\...
>>
>>Now, suppose that user1, a normal user, who is the owner of directory
>>"c:\home\user1" removed the permissions (ACE) of the administrator. So
>>the administrator cant change
>>any permission on this directory.
>>
>>The only way I found , being the administrator, to change the
>>permissions of this
>>directory, is taking the ownership of it. But when I do that, it mess up
>>with the
>>older permissions. Also, when I try to take the ownership, Windows does
>>not
>>recognize the original owner.
>>
>>How can I find a better solution to that?
>>Have any one seen this before?
>>
>>Thanks
>>Alessandro
>>
>>Ps. I posted this message to comp.lang.perl cause, I found this during a
>>test
>>of my perl script which apply ACLs to files. If the user removed the
>>administrator
>>ACE, my script cant change the permissions.
>>
>
>



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

Date: Fri, 15 Dec 2000 13:27:37 -0200
From: Alessandro Augusto <Alessandro.Augusto@br.bosch.com>
Subject: Re: Windows cant recognize the original owner
Message-Id: <3A3A3868.2CDAD4AD@br.bosch.com>

sorry but I think you are confunsing everything.

the question is not about at command. BTW, a normal user cannot
schedule task with at. Only administrators are allowed to do it.

The question here is:
How do get the older owner, set the administrator as the owner,
change some permissions of this object, then set back the original owner.

How do I do that on a object (file or folder) that the administrator
permissions
were removed?

Martijn Lievaart wrote:

> [1] F.i. try the at command, it runs a command with system priviliges and
> can be used to start a shell.



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

Date: Fri, 15 Dec 2000 13:53:00 -0200
From: Alessandro Augusto <Alessandro.Augusto@br.bosch.com>
Subject: Re: Windows cant recognize the original owner
Message-Id: <3A3A3E5C.BA719FAA@br.bosch.com>

sorry but I think you are confunsing everything.

the question is not about at command. BTW, a normal user cannot
schedule task with at. Only administrators are allowed to do it.

The question here is:
How do get the older owner, set the administrator as the owner,
change some permissions of this object, then set back the original owner.

How do I do that on a object (file or folder) that the administrator
permissions
were removed?

Martijn Lievaart wrote:

> [1] F.i. try the at command, it runs a command with system priviliges and
> can be used to start a shell.



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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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


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