[23853] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6056 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 30 18:05:57 2004

Date: Fri, 30 Jan 2004 15:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 30 Jan 2004     Volume: 10 Number: 6056

Today's topics:
    Re: Can someone tell me what is wrong with this? <bigswifty00000@yahoo.com>
        filename regex? (Jules)
    Re: filename regex? (Walter Roberson)
    Re: filename regex? <mbroida@fake.domain>
    Re: First-Class Filehandle Trick in 5.8 <nobull@mail.com>
    Re: First-Class Filehandle Trick in 5.8 <nospam-abuse@ilyaz.org>
        how to loop over instances of a class fulko.hew@sita.aero
    Re: how to loop over instances of a class (Jay Tilton)
    Re: HTTP::Daemon <Joe.Smith@inwap.com>
        Merging two text files based on some kind of text ancho (triangle)
    Re: Merging two text files based on some kind of text a <noreply@gunnar.cc>
        Net::FTP and "mput" issue...cannot change local current (John Davis)
    Re: perl script to exe <minter@lunenburg.org>
    Re: perl script to exe <javier@t-online.de>
        permissions <todd@asgweb.net>
    Re: permissions (Walter Roberson)
    Re: permissions <todd@asgweb.net>
    Re: permissions (Walter Roberson)
    Re: permissions <todd@asgweb.net>
    Re: permissions (Walter Roberson)
    Re: regexp <dwall@fastmail.fm>
    Re: Spam Filter Pattern Matching <dwilga-MUNGE@mtholyoke.edu>
    Re: Unexpected initial null in return from split() <nobull@mail.com>
    Re: Unexpected initial null in return from split() (Malcolm Dew-Jones)
    Re: Unexpected initial null in return from split() <xx087@freenet.carleton.ca>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 30 Jan 2004 22:28:09 GMT
From: Big Swifty <bigswifty00000@yahoo.com>
Subject: Re: Can someone tell me what is wrong with this?
Message-Id: <Xns9480B1C26DD94kburdishoptonlinenet@167.206.3.3>

Gnari:

"gnari" <gnari@simnet.is> wrote in news:bvc3i6$872$1@news.simnet.is:

>> >>
>> >>  print "<PRE><TT><B>$doc_id  $doc_name  $score</B></TT></PRE>";
>> >>
>> >> the value for the variable prints correctly.
>> >
>> > Not really.  Change that line to:
>> >
>> > print
>> > "<PRE><TT><B>|||||$doc_id|||||||$doc_name||||$score||||</B></TT></PR
>> > E>" ;
>> >
>> > And see what get's printed.
>>
>>
>> |||||3|||||||learn_oracle3.txt||||87||||
>> |||||4|||||||learn_oracle4.txt||||3||||
>> |||||2|||||||learn_oracle2.txt||||3||||
>> |||||1|||||||learn_oracle.txt||||3||||
>>
>>
>> I'm not seeing your point...
> 
> did you make the program print it or did you just write
> what you assumed would be printed?

No, that is output copied and  pasted from the html page that was 
output.... 



> because see the following snippet:
> 
>> >>         while (@row = $sth->fetchrow_array ) {
>> >>                 push (@documents,"$row[0]  $row[1]    $row[2] ");
> 
> see you are adding one string only, that happen to contain the 3
> values, so the
>   print
> "<PRE><TT><B>|||||$doc_id|||||||$doc_name||||$score||||</B></TT></PRE>"
> ; above should have printed:
>  |||||3 learn_oracle3.txt  87 |||||||||||||||


It adds 4 "rows" of 3 "columns" each


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

Date: 30 Jan 2004 14:11:01 -0800
From: groupspost@yahoo.com (Jules)
Subject: filename regex?
Message-Id: <dab3c207.0401301411.7fce0a28@posting.google.com>

Am trying to modify a regular expression in a perl script at:
http://groups.google.com/groups?selm=bb5bn4%242ljv%241%40FreeBSD.csie.NCTU.edu.tw

> the regex in this line:
>     if (my ($ft) = $_ =~ m|^(\d+)\.\d+\.|) {
> has to match the file name of your mail files.  I use mail files named like
> so:
>
> 1049831444.88767.thunderbird.etv.net,S=2514
>
> timestamp.procId.domainname,S=filesize

My mail files are named slightly different, for example:
1075497569.85543_0.host.domain.net

timestamp.procId_0.domainname

Can anyone help modify the regex to match my filename?


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

Date: 30 Jan 2004 22:18:03 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: filename regex?
Message-Id: <bvel6r$n25$1@canopus.cc.umanitoba.ca>

In article <dab3c207.0401301411.7fce0a28@posting.google.com>,
Jules <groupspost@yahoo.com> wrote:
|Am trying to modify a regular expression in a perl script at:
|http://groups.google.com/groups?selm=bb5bn4%242ljv%241%40FreeBSD.csie.NCTU.edu.tw

|> the regex in this line:
|>     if (my ($ft) = $_ =~ m|^(\d+)\.\d+\.|) {
|> has to match the file name of your mail files.  I use mail files named like
|> so:

|> 1049831444.88767.thunderbird.etv.net,S=2514

|My mail files are named slightly different, for example:
|1075497569.85543_0.host.domain.net

|Can anyone help modify the regex to match my filename?

  m|^(\d+)\.\d+_0\.|

would be the closest equivilent.
-- 
"Meme" is self-referential; memes exist if and only if the "meme" meme
exists. "Meme" is thus logically a meta-meme; but until the existance
of meta-memes is more widely recognized, "meta-meme" is not a meme.
   -- A Child's Garden Of Memes


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

Date: Fri, 30 Jan 2004 22:45:10 GMT
From: MPBroida <mbroida@fake.domain>
Subject: Re: filename regex?
Message-Id: <401ADE76.3C5F3A5@fake.domain>

Jules wrote:
> 
> Am trying to modify a regular expression in a perl script at:
> http://groups.google.com/groups?selm=bb5bn4%242ljv%241%40FreeBSD.csie.NCTU.edu.tw
> 
> > the regex in this line:
> >     if (my ($ft) = $_ =~ m|^(\d+)\.\d+\.|) {
> > has to match the file name of your mail files.  I use mail files named like
> > so:
> >
> > 1049831444.88767.thunderbird.etv.net,S=2514
> >
> > timestamp.procId.domainname,S=filesize
> 
> My mail files are named slightly different, for example:
> 1075497569.85543_0.host.domain.net
> 
> timestamp.procId_0.domainname
> 
> Can anyone help modify the regex to match my filename?

		m|^(\d+)\.\d+_0\.|

	might work.  All I did was add the _0 after the
	last set of digits.  If that's not always a ZERO,
	change _0 to _\d or use \d+ if it might be more
	than one digit after the underscore.  NOTE: This
	REQUIRES the underscore to be present!

		Mike


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

Date: 30 Jan 2004 19:52:03 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: First-Class Filehandle Trick in 5.8
Message-Id: <u9znc5fc4c.fsf@wcl-l.bham.ac.uk>

Scott McGerik <scottlm@visi.com> writes:

> I am using the First-Class Filehandle Trick, described at
> http://perl.plover.com/local.html#3_The_First_Class_Filehandle_Tr.
> 
> In a particular program, I had this line:
> 
>     $INFILE = do { local *FH }; $OUTFILE = do { local *FH };
> 
> I then proceed to open $INFILE for reading and $OUTFILE for writing with
> 
>     unless ( open $INFILE, '<', $infile ) {
> 
> and
> 
>     unless ( open $OUTFILE, '>', $outfile ) {
> 
> 
> This worked in 5.6.1, but when I do the same under 5.8.0, I get the
> following error message:
> 
>     Filehandle FH opened only for output at ...
> 
> I find this confusing because I thought that 
> 
>     do { local *FH }
> 
> would return an unnamed glob. But from the error message, it appears
> that it returned the glob for FH.
> 
> I looked through the perldelta file, at
> http://www.perldoc.com/perl5.8.0/pod/perldelta.html, for 5.8, but I did
> not find any hints. Pointers and explanations are appreciated.

I must admit that my gut feeling is that the semantics of do { local
*FH } would not be something I'd expect to be stable.

Indeed anything to do with putting bare GLOBs in to scalars as opposed
to GLOBrefs makes my head (and my guts) spin.

I suggest you ask MJD what are the 'definite disadvantages' he
perceives in using GLOBrefs like everybody else does.

(Note that as of 5.6.1[*] you have autovification of GLOBrefs in open()
et al).

All that said, I just tried MJD's hack in 5.8.0 and it worked just
fine.  So this brings us back to the advice is the posting guidelines:
"First make a short (less than 20-30 lines) and /complete/ program
that illustrates the problem you are having. People should be able to
run your program by copy/pasting the code from your article."

[*] The autovification functionality appears in 5.6.1 but didn't get
into the POD in that version.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 30 Jan 2004 21:49:34 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: First-Class Filehandle Trick in 5.8
Message-Id: <bvejhe$24pa$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Brian McCauley 
<nobull@mail.com>], who wrote in article <u9znc5fc4c.fsf@wcl-l.bham.ac.uk>:
> > I find this confusing because I thought that 
> > 
> >     do { local *FH }
> > 
> > would return an unnamed glob. But from the error message, it appears
> > that it returned the glob for FH.

> Indeed anything to do with putting bare GLOBs in to scalars as opposed
> to GLOBrefs makes my head (and my guts) spin.
> 
> I suggest you ask MJD what are the 'definite disadvantages' he
> perceives in using GLOBrefs like everybody else does.

I know only one such "defdis": for the target discussed above
(creation of anonymous unopened filehandles) the references "do not
work".  Maybe it is fixed now, but at the time of 5.005 you could not
create a reference to an anonymous (and properly garbage-collected)
glob.

Thus the abomination used above.

Hope this helps,
Ilya


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

Date: 30 Jan 2004 11:57:22 -0800
From: fulko.hew@sita.aero
Subject: how to loop over instances of a class
Message-Id: <b1d24bf9.0401301157.20c0f76c@posting.google.com>

There has got to be a built in way to loop over all instances of a class.
But I can't find it.

ie.

foreach $y (MYCLASS::) {
  $y->mymethod();
}


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

Date: Fri, 30 Jan 2004 20:41:53 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: how to loop over instances of a class
Message-Id: <401ac166.185170318@news.erols.com>

fulko.hew@sita.aero wrote:

: There has got to be a built in way to loop over all instances of a class.

What have you read that makes you believe that?



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

Date: Fri, 30 Jan 2004 21:48:29 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: HTTP::Daemon
Message-Id: <MiASb.145963$sv6.805067@attbi_s52>

Lars Oeschey wrote:

> sub Action {
> 	print "Gruss von der Sub!\n";
> 	sleep 20;
> }
> ---------------------------------------------------------------
> 
> $html, $working and $done are html pages as string. $html displays a
> button with method "post". The first page with the button gets
> displayed fine, when I click on the button, there's a 20sec delay, and
> then $working and $done get displayed at once. Is there a way to have
> the delay actually happen between $working and $done?

Yes.  Change that to
  	print "Gruss von der Sub!<br>\n";
so that the browser will render the current paragraph.
		-Joe


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

Date: 30 Jan 2004 11:57:41 -0800
From: david.knecht@anyweb.ch (triangle)
Subject: Merging two text files based on some kind of text anchors
Message-Id: <43118bf2.0401301157.1bedd5dd@posting.google.com>

Dear all,

I would like to merge two text files based on some criteria driven by
regular expressions.

Basically, this is what I'd like to achieve:

Contents of file 1:

abc 
def
ghi

Contents of file 2 (defines the anchors and their contents):

[anchor1]This is some text for anchor 1.
[anchor2]This is some text for anchor 2.

The file which is the result of the merger process should look like
this:

abc This is some text for anchor 1.
def
ghi This is some text for anchor 2.

I'd like to define the anchors as regular expressions (identifying a
single line in file 1 or a range of multiple lines). Here, [anchor1]
is a regular expression which identifies the text "abc" in file 1.

Of course, "abc" might occur several times in file 1. To clearly
identify one particular instance of "abc" multiple identification
criteria might be required.

The basic idea is to merge comments in a fully automated manner to
some kind of source code, configuration file and the like.

I think of writing a Perl script for this but before doing that, I'd
like to check if there are other solutions/tools around. The plattform
is Linux.

If scripting it in Perl, are there any special Perl modules around for
this task?

Thanks, David


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

Date: Fri, 30 Jan 2004 22:00:52 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Merging two text files based on some kind of text anchors
Message-Id: <bvegk6$rhesp$1@ID-184292.news.uni-berlin.de>

triangle wrote:
> I would like to merge two text files based on some criteria driven
> by regular expressions.

<snip>

> I think of writing a Perl script for this but before doing that,
> I'd like to check if there are other solutions/tools around. The
> plattform is Linux.

Don't think this is the best place to ask for other solutions, but I
can tell you that Perl is sufficient.

> If scripting it in Perl, are there any special Perl modules around
> for this task?

Don't know. But it's not exactly rocket science, so why not just go
for it?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: 30 Jan 2004 13:42:28 -0800
From: tudmuf2b@onebox.com (John Davis)
Subject: Net::FTP and "mput" issue...cannot change local currently directory
Message-Id: <7167a8d.0401301342.3ed637df@posting.google.com>

I'm trying to use the Net::FTP module in an "mput" like way, but it
does not seem to work correctly. I have a script that gets any number
of files from another server and put them in a directory called
"/tmp/dbinfo"

From /tmp/dinfo, I want to mput all of those files that are in the
directory with the db.out attached to the name, and only those files.
So files such as acedb.out, testdb,out are good, etc.

From my code below, it continues to say that files such as acedb.out,
testdb.out cannot be accessed. If that because the local currently
directory is not set right? I have a chdir (/tmp/dbinfo) - where the
files are, but it cannot put them onto the remote host.

I've moved the chdir around but without success...

Any ideas?

Thanks!


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


#!/opt/perl/bin/perl -w

use strict;
use Net::FTP;
my ($hostname, $username, $password, $directory, $ftp, @last);
$hostname="dbmaster1";
$username="ftp";
$password="nothing";
$directory="/incoming";

my @filelist;
my $file;

chdir ("/tmp/dbinfo");

opendir (DIR, "/tmp/dbinfo") || die "Can't open: $! \n";
@filelist=readdir(DIR);
closedir(DIR);

$ftp=Net::FTP->new ($hostname);
$ftp->login($username, $password);
$ftp->cwd ($directory);

foreach $file (@filelist) {
  next if ! ($file=~/db.out/) ;
  $ftp->put("$file");  
}
$ftp->quit;


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

Date: Fri, 30 Jan 2004 20:21:32 GMT
From: "H. Wade Minter" <minter@lunenburg.org>
Subject: Re: perl script to exe
Message-Id: <g1zSb.25753$F86.2183909@twister.southeast.rr.com>

Xaver Biton <javier@t-online.de> wrote:
> Hi,
> 
> I'm playing a little bit around, trying to compile some script  to exe. Many
> of the script are working, but there a bit of code that give me a message
> error :

I'd recommend the great PAR utility (http://par.perl.org/) for bundling
Perl scripts into Windows .exe files.  It's free, Free, and works great. 

--Wade


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

Date: Fri, 30 Jan 2004 22:58:57 +0100
From: "Xaver Biton" <javier@t-online.de>
Subject: Re: perl script to exe
Message-Id: <bvejvp$n4e$02$1@news.t-online.com>


"H. Wade Minter" <minter@lunenburg.org> ha scritto nel messaggio
news:g1zSb.25753$F86.2183909@twister.southeast.rr.com...
> Xaver Biton <javier@t-online.de> wrote:
> > Hi,
> >
> > I'm playing a little bit around, trying to compile some script  to exe.
Many
> > of the script are working, but there a bit of code that give me a
message
> > error :
>
> I'd recommend the great PAR utility (http://par.perl.org/) for bundling
> Perl scripts into Windows .exe files.  It's free, Free, and works great.
>
> --Wade

Tanks,  works really fine!!!!!!!

Xaver




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

Date: Fri, 30 Jan 2004 12:10:27 -0700
From: Todd Anderson <todd@asgweb.net>
Subject: permissions
Message-Id: <401AAB6F.2841BB02@asgweb.net>

hello,
I recently moved my site from a virtual server where every perl script I
uploaded was owned by the default user 'nobody'. I could set permisions
on a user dir of 644 and the user file of 755. This worked fine.
Now with my new host where I have root access the default upload owner
is me the user. I now have to set permisions to 755 and 777 just to get
the script to run. I'm not sure what the problem is.
Any help is appreciated and thanks in advance.



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

Date: 30 Jan 2004 19:23:12 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: permissions
Message-Id: <bveav0$iep$1@canopus.cc.umanitoba.ca>

In article <401AAB6F.2841BB02@asgweb.net>,
Todd Anderson  <todd@asgweb.net> wrote:
:I recently moved my site from a virtual server where every perl script I
:uploaded was owned by the default user 'nobody'. I could set permisions
:on a user dir of 644 and the user file of 755. This worked fine.
:Now with my new host where I have root access the default upload owner
:is me the user. I now have to set permisions to 755 and 777 just to get
:the script to run. I'm not sure what the problem is.

That's not a perl question.

You probably don't need 777 on the user files, just 755. Probably the
755 on the directory was what did the trick. 644 permissions on the
directory doesn't allow "x" permissions on the directory by anyone,
which means that no-one can use that directory as part of a pathname to
reach a file -- but they can still use "ls" to look to see what files
are there. This becomes more important when the WWW server is not
running under the same userid as owns the directories.
-- 
   Scintillate, scintillate, globule vivific 
   Fain would I fathom thy nature specific. 
   Loftily poised on ether capacious 
   Strongly resembling a gem carbonaceous.   -- Anon


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

Date: Fri, 30 Jan 2004 13:14:27 -0700
From: Todd Anderson <todd@asgweb.net>
Subject: Re: permissions
Message-Id: <401ABA65.B502E8B1@asgweb.net>

Additionally, when the script writes an authentication file it defaults to
644 which won't let the script in turn read it to authenticate. go figure.

Walter Roberson wrote:

> In article <401AAB6F.2841BB02@asgweb.net>,
> Todd Anderson  <todd@asgweb.net> wrote:
> :I recently moved my site from a virtual server where every perl script I
> :uploaded was owned by the default user 'nobody'. I could set permisions
> :on a user dir of 644 and the user file of 755. This worked fine.
> :Now with my new host where I have root access the default upload owner
> :is me the user. I now have to set permisions to 755 and 777 just to get
> :the script to run. I'm not sure what the problem is.
>
> That's not a perl question.
>
> You probably don't need 777 on the user files, just 755. Probably the
> 755 on the directory was what did the trick. 644 permissions on the
> directory doesn't allow "x" permissions on the directory by anyone,
> which means that no-one can use that directory as part of a pathname to
> reach a file -- but they can still use "ls" to look to see what files
> are there. This becomes more important when the WWW server is not
> running under the same userid as owns the directories.
> --
>    Scintillate, scintillate, globule vivific
>    Fain would I fathom thy nature specific.
>    Loftily poised on ether capacious
>    Strongly resembling a gem carbonaceous.   -- Anon

--
<•˜ }}}} ><<
Regards

Todd Anderson
ASGWEB.net
1362 East 3345 South
Salt Lake City, Utah 84106 USA
801.487.3675

http://asgweb.net
http://JesusThing.com
http://www.DocuHarbor.com
http://www.christianlink.com/search/index.cgi
http://TV20.org
http://asgweb.net/asgpro
http://SecureShip.com
http://MrNoItAll.com




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

Date: 30 Jan 2004 21:18:01 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: permissions
Message-Id: <bvehm9$lhh$1@canopus.cc.umanitoba.ca>

In article <401ABA65.B502E8B1@asgweb.net>,
Todd Anderson  <todd@asgweb.net> wrote:
:Additionally, when the script writes an authentication file it defaults to
:644 which won't let the script in turn read it to authenticate. go figure.

Sounds like directory permissions. The permissions such as 644 are
in three clusters of 3 bits each (octal), with the first cluster
controlling access for the owner, the second controlling access
for those belonging to the same unix group, and the third controlling
access for everyone else. Within each cluster, the first bit
(numeric value 4) controls read access, the second bit (numeric value 2)
controls write access, and the third bit (numeric value 1) controls
execute access [files] or search access [directories.]
Thus, 644 is read (4) + write (2) = 6 and no execute access
for the file owner, and just read (4) access for the group and
just read access (4) for everyone else. So with 644 permissions,
everyone *has* read permissions on the file... provided they can
get through the permissions hierarchy on the directory structure
that names the full file.


There is one other possibility that can end up giving wierd results.
If the system supports Access Control Lists (ACLs), then sometimes
whether a given ACL entry bit is in effect or not is controlled
by the standard permission bits. For example, with 644 permissions,
instead of the last 4 meaning "everyone else is allowed to read
this", the 4 could mean that "in the ACL associated with this file,
pay attention to whatever read permissions are given by the ACL,
but ignore any write or execute permissions given in the ACL."
And if that's happening [e.g., SGI's IRIX] then you need to look
at the details of the ACL.

In systems that have ACLs, the last character of the  ls -l
permissions list often shows up as a plus sign:

$ ls -ld ~radm/hosts                                       
-rw-rw-r--+  11 root     sys        75953 Jan 26 15:32 /usr/local/sysadm/rdist/hosts

To see the ACL contents, you may have to add an extra option to ls:

$ ls -ldD ~radm/hosts                                      
-rw-rw-r--+  11 root     sys        75953 Jan 26 15:32 /usr/local/sysadm/rdist/hosts [u::rw-,g::rwx,o::r--,u:ken:rwx,u:bob:rwx,u:nancy:rwx,u:cheryl:rwx,u:ritchie:rwx,u:kerningham:rwx,m::rw-]


But none of this has to do with perl.
-- 
   Rump-Titty-Titty-Tum-TAH-Tee             -- Fritz Lieber


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

Date: Fri, 30 Jan 2004 14:51:25 -0700
From: Todd Anderson <todd@asgweb.net>
Subject: Re: permissions
Message-Id: <401AD111.F705E4C8@asgweb.net>

checked and there is NO ACL.
if i change my default user from 'nobody' to 'me', the script can read it's own authentication files and everything else works fine. is there a danger in doing this?
why did 644 work on the user directory on the other server?
if a script is ownwed by 'user' and some one prompts the script from the browser, doesn't the server see that action as by the owner (user)? if so, shouldn't 700 be the best choice for a dir
that needs to be read, write, and execute by the script??

Walter Roberson wrote:

> In article <401ABA65.B502E8B1@asgweb.net>,
> Todd Anderson  <todd@asgweb.net> wrote:
> :Additionally, when the script writes an authentication file it defaults to
> :644 which won't let the script in turn read it to authenticate. go figure.
>
> Sounds like directory permissions. The permissions such as 644 are
> in three clusters of 3 bits each (octal), with the first cluster
> controlling access for the owner, the second controlling access
> for those belonging to the same unix group, and the third controlling
> access for everyone else. Within each cluster, the first bit
> (numeric value 4) controls read access, the second bit (numeric value 2)
> controls write access, and the third bit (numeric value 1) controls
> execute access [files] or search access [directories.]
> Thus, 644 is read (4) + write (2) = 6 and no execute access
> for the file owner, and just read (4) access for the group and
> just read access (4) for everyone else. So with 644 permissions,
> everyone *has* read permissions on the file... provided they can
> get through the permissions hierarchy on the directory structure
> that names the full file.
>
> There is one other possibility that can end up giving wierd results.
> If the system supports Access Control Lists (ACLs), then sometimes
> whether a given ACL entry bit is in effect or not is controlled
> by the standard permission bits. For example, with 644 permissions,
> instead of the last 4 meaning "everyone else is allowed to read
> this", the 4 could mean that "in the ACL associated with this file,
> pay attention to whatever read permissions are given by the ACL,
> but ignore any write or execute permissions given in the ACL."
> And if that's happening [e.g., SGI's IRIX] then you need to look
> at the details of the ACL.
>
> In systems that have ACLs, the last character of the  ls -l
> permissions list often shows up as a plus sign:
>
> $ ls -ld ~radm/hosts
> -rw-rw-r--+  11 root     sys        75953 Jan 26 15:32 /usr/local/sysadm/rdist/hosts
>
> To see the ACL contents, you may have to add an extra option to ls:
>
> $ ls -ldD ~radm/hosts
> -rw-rw-r--+  11 root     sys        75953 Jan 26 15:32 /usr/local/sysadm/rdist/hosts [u::rw-,g::rwx,o::r--,u:ken:rwx,u:bob:rwx,u:nancy:rwx,u:cheryl:rwx,u:ritchie:rwx,u:kerningham:rwx,m::rw-]
>
> But none of this has to do with perl.
> --
>    Rump-Titty-Titty-Tum-TAH-Tee             -- Fritz Lieber

--
<•˜ }}}} ><<
Regards

Todd Anderson
ASGWEB.net
1362 East 3345 South
Salt Lake City, Utah 84106 USA
801.487.3675

http://asgweb.net
http://JesusThing.com
http://www.DocuHarbor.com
http://www.christianlink.com/search/index.cgi
http://TV20.org
http://asgweb.net/asgpro
http://SecureShip.com
http://MrNoItAll.com




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

Date: 30 Jan 2004 22:13:00 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: permissions
Message-Id: <bvektc$mt9$1@canopus.cc.umanitoba.ca>

In article <401AD111.F705E4C8@asgweb.net>,
Todd Anderson  <todd@asgweb.net> wrote:
:if a script is ownwed by 'user' and some one prompts the script from
:the browser, doesn't the server see that action as by the owner (user)?

Again, that isn't a perl question, but to answer it:

  No, a http server usually runs as a specific user (probably 'nobody'
  on your new system), and usually attempts all accesses as that
  user. Apache2 [and possibly some others] have provisions for
  automatically accessing some hierarchies by becoming other users;
  I have never looked into how that is configured. It is, though,
  pretty much unknown for the http server to temporarily become
  the owner of each and every file prior to trying to use that file.
  Suppose you, in one of your pages, made a reference to someone else's
  sensitive file: it wouldn't be good for the server to automatically
  become them so that it could show you the content of the file that
  shouldn't be accessible.
-- 
   Entropy is the logarithm of probability   -- Boltzmann


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

Date: Fri, 30 Jan 2004 19:46:48 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: regexp
Message-Id: <Xns94809657DD5DCdkwwashere@216.168.3.30>

Jayme Assuncao Casimiro <jayme@dcc.ufmg.br> wrote:

> I have this piece of html text from Amazon.com
> 
><dt><b><a
> href="/exec/obidos/ASIN/0965761762/qid=917872216/sr=1-1/002-1496444-00648
> 04">1 Business, 2 Approaches : How to Succeed in Internet Business by
> Employing Real-World Strategies</a></b>
>  ~ <NOBR><font color=#990033>Usually ships in 2-3 days</font></NOBR><dd>
> Ron Gielgun / Hardcover / Published 1998
><br>
> Our Price: $13.97 ~ <NOBR><font color =#990033>You Save: $5.98
> (30%)</font></NOBR>
><br>
><a
> href="/exec/obidos/ASIN/0965761762/qid=917872216/sr=1-1/002-1496444-00648
> 04"><i>Read more about this title...</i></a>
><p>
> 
> And I would like to use only one regexp to extract the title, the price,
> and the desconunt in percent.

I still think you should use one of the HTML parsing modules to get the 
otherwise unremarkable piece of HTML, but below is one regex that captures 
all three things.  Ugly and fragile.

my ($price, $title, $discount);
if ($html =~ m{
        <dt>\s*
            <b>\s*
                <a\s+href\s*=\s*"\S+">
                ([^<]+)             # title
                </a>\s*
            </b>
            .*?
            Our\s+Price:\s+
            (\S+)                   # price
            .*?
            You\s+Save:\s+\S+\s+
            \((\S+)\)               # discount
        }xs )
{
    ($title, $price, $discount) = ($1, $2, $3);
    $title =~ s/\s+/ /g;

    print "title: $title\n\n";
    print "price: $price\n\n";
    print "discount: $discount\n";

}

-- 
David Wall


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

Date: Fri, 30 Jan 2004 15:24:35 -0500
From: Dan Wilga <dwilga-MUNGE@mtholyoke.edu>
Subject: Re: Spam Filter Pattern Matching
Message-Id: <dwilga-MUNGE-CE45B0.15243430012004@nap.mtholyoke.edu>

In article <dwilga-MUNGE-1E3A1E.11060130012004@nap.mtholyoke.edu>,
 Dan Wilga <dwilga-MUNGE@mtholyoke.edu> wrote:

> The one I wrote yesterday (but haven't tested yet) is:
> 
>   ^Re:\s[A-Z][A-Z]+,(\s[a-z]+){3}

No sooner did I write the above, then I got a piece of spam with an 
apostrophe in the three words at the end :-(.

Perhaps this would work better:

  ^Re:\s[A-Z][A-Z]+,(\s[a-z\']+){3}

-- 
Dan Wilga          dwilga-MUNGE@mtholyoke.edu
** Remove the -MUNGE in my address to reply **


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

Date: 30 Jan 2004 19:28:07 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Unexpected initial null in return from split()
Message-Id: <u94qudgrso.fsf@wcl-l.bham.ac.uk>

"Craig M. Votava" <craig@lucent.com> writes:

> Folks-
> 
> I'm trying to do something fairly that should be
> fairly easy, and obvious:
> ------------------------------------------------
> my %info = split(/magic/, `pkginfo -l SUNWarc`);
> print $info{VERSION};
> ------------------------------------------------
> My problem is: what magic will make this work?

You don't say what the output of "pkginfo -l SUNWarc" looks
like, nor what %info should look like.

Random shot-in-the-dark you want to achive with split what most people
would do with a simple match:

my %info = map { /^\s*(\S+):\s+(.*)/ } `pkginfo -l SUNWarc`;

Or.

my %info = `pkginfo -l SUNWarc` =~ /^\s*(\S+):\s+(.*)/mg; 
 
> Here's my closest solution (using arrays for debugging):

> my @info = split(/^\s+(\S+:)\s+/m, `pkginfo -l SUNWarc`);

> In my environment, info[0] is null, all the rest of the
> array is exactly what I would expect.

Really?  I would have though that that would have had 'VERSION:' where
you wanted 'VERSION'. :-)

> WHERE IS THIS INITIAL NULL COMING FROM!!! Grrrr, I'm frustrated.

What split does is _split_ the string using the pattern as a
_delimiter_.  The first element of the returned list is the bit
_before_ the first place the pattern matches.  If the first match is
at the start of the string then the first element of the returned list
will be an empty string.

I can see no obvious way to avoid this.  If you insist on using split
you'll have to discard the empty string afterwards.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 30 Jan 2004 11:38:50 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Unexpected initial null in return from split()
Message-Id: <401ab2ca@news.victoria.tc.ca>

Craig M. Votava (craig@lucent.com) wrote:
: Folks-

: I'm trying to do something fairly that should be
: fairly easy, and obvious:
: ------------------------------------------------
: my %info = split(/magic/, `pkginfo -l SUNWarc`);
: print $info{VERSION};
: ------------------------------------------------
: My problem is: what magic will make this work?

: Here's my closest solution (using arrays for debugging):
: ---------------------------------------------------------
: use Data::Dumper;
: my @info = split(/^\s+(\S+:)\s+/m, `pkginfo -l SUNWarc`);
: print STDERR Dumper(\@info);
: ---------------------------------------------------------

: In my environment, info[0] is null, all the rest of the
: array is exactly what I would expect. WHERE IS THIS INITIAL
: NULL COMING FROM!!! Grrrr, I'm frustrated.

Does this make it clearer

	$_ = ",abc,123";		# three comma seperated items

	my @a = split /,/ ;		# split on the commas

	for (my $i=0; $i < @a; $i++ )
	{
	    print "$i:=>$a[$i]<=\n";	# see what each item is
	}



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

Date: 30 Jan 2004 20:14:15 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: Unexpected initial null in return from split()
Message-Id: <slrnc1leon.6pv.xx087@smeagol.ncf.ca>

Craig M. Votava <craig@lucent.com> wrote:
>  Folks-
>  
>  I'm trying to do something fairly that should be
>  fairly easy, and obvious:
>  ------------------------------------------------
>  my %info = split(/magic/, `pkginfo -l SUNWarc`);
>  print $info{VERSION};
>  ------------------------------------------------
>  My problem is: what magic will make this work?
>  
>  Here's my closest solution (using arrays for debugging):
>  ---------------------------------------------------------
>  my @info = split(/^\s+(\S+:)\s+/m, `pkginfo -l SUNWarc`);

Rule of thumb:  use split if you know what to throw away, use regular
expression if you know what to keep.

    perl -le '
        my %info = `pkginfo -l SUNWarc` =~ m{ 
            ([A-Z]+):\s+    # the key (assuming all upper case only)
            (.*?)\s*        # the value (non-greedy)                       
            (?=\Z|[A-Z]+:)  # lookahead for end of string or next label
        }xsg;
        use Data::Dumper; print Dumper(\%info);
    '

-- 
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca


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

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


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