[17624] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5044 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 6 09:05:55 2000

Date: Wed, 6 Dec 2000 06:05:16 -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: <976111515-v9-i5044@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 6 Dec 2000     Volume: 9 Number: 5044

Today's topics:
        [OT] Re: Problem with split using | <joe+usenet@sunstarsys.com>
    Re: array of unique random numbers (Abigail)
        can't edit scripts nkelly@my-deja.com
    Re: can't edit scripts <josef.moellers@fujitsu-siemens.com>
    Re: DBI insert problem (Michel Dalle)
    Re: dbm <tward10@jaguar.com>
    Re: Document management question! <ivo@neroc.nl>
    Re: dumb question? - how do i find out current script n (Abigail)
    Re: find function ale@skate.mailbr.com.br
    Re: find function <josef.moellers@fujitsu-siemens.com>
    Re: help getting started with Active perl win32 <tick.toff@spam.com>
        Help with File Permissions (win32:perms) alaugusto@my-deja.com
    Re: Help with File Permissions (win32:perms) alaugusto@my-deja.com
        Help: How to read files from the end? <wstsoi@hongkong.com>
    Re: Help: How to read files from the end? (Michel Dalle)
        How do you convert a Perl script to binary executable i <c.manley@chello.nl>
    Re: How to read files from the end? <dontspamme@awdang.com>
    Re: How to write a packet sniffer for win32 (TCP Packet <carvdawg@patriot.net>
    Re: How to write a packet sniffer for win32 (TCP Packet <ZSSTL@Zeppelin.de>
    Re: Howto create setuid/setgid files and directories? kmyer@hotmail.com
    Re: kill and security (suid) (Abigail)
    Re: kill and security (suid) <rick.delaney@home.com>
    Re: mail ??? <Per-fredrik.Pollnow@epk.ericsson.se>
    Re: Need help with Http{referrer} <dontspamme@awdang.com>
        Object member variables <jvm@ysabel.com>
    Re: Object member variables <nickco3@yahoo.co.uk>
    Re: Object member variables <jvm@ysabel.com>
    Re: perl printer problem <crud_alex@yahoo.com>
    Re: Problem creating DBM database <b.englefield@uel.ac.ku>
        Problem using Net::FTP <Tadeusz.Zwolinski@rzeszow.tpsa.pl>
        Profanity Check <habfan2@my-deja.com>
        random caracters <Per-fredrik.Pollnow@epk.ericsson.se>
    Re: random characters <dontspamme@awdang.com>
    Re: Sorting the result of a function (Abigail)
    Re: SSLeay, LWP and HTTPS (Jan Stocker)
        syscall.h missing on AIX <michael_roper@hotmail.com>
        Using 'require' and performance gains <c.manley@chello.nl>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 06 Dec 2000 08:35:10 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: [OT] Re: Problem with split using |
Message-Id: <m3hf4hn04x.fsf_-_@mumonkan.sunstarsys.com>

logan@cs.utexas.edu (Logan Shaw) writes:

> In article <slrn92rdbl.ouu.tadmc@magna.metronet.com>,
> Tad McClellan <tadmc@metronet.com> wrote:
> >Except that should be:
> >
> >   @thingies = split (/\|/, $stringy);
> >
> >If it is a pattern match, then it should _look like_ a pattern match.
> 
> Good point.  I'm not sure what I was thinking.  (However, I am teaching
> myself C++ right now despite having avoided it out of a preference for
> Perl, so maybe that explains why my brain is at half capacity...)

Beware of templates! Trying them to work will make you appreciate
perl more and more- they actually drove me so mad I started learning
XS ;)

-- 
Joe Schaefer


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

Date: 6 Dec 2000 11:19:20 GMT
From: abigail@foad.org (Abigail)
Subject: Re: array of unique random numbers
Message-Id: <slrn92s85o.80s.abigail@tsathoggua.rlyeh.net>

On 5 Dec 2000 19:13:22 GMT, Ilmari Karonen (iltzu@sci.invalid) wrote in comp.lang.perl.misc <URL: news:<976039986.23027@itz.pp.sci.fi>>:
++ In article <slrn92ntqh.vnu.abigail@tsathoggua.rlyeh.net>, Abigail wrote:
++ >++ 
++ >++   sub unique_random_ints {
++ >++       my ($n, $lim) = @_;
++ >++       my (@res, %buf);
++ >++       while (@res < $n) {
++ >++           my $rn = int rand $lim--;
++ >++           push @res, $buf{$rn} || $rn;
++ >++           $buf{$rn} = $buf{$lim} || $lim;
++ >++       }
++ >++       return @res;
++ >++   }
++ >++ 
++ >++ There.  Both the running time and the memory usage are proportional to
++ >++ $n even in the worst case, and completely independent of $lim.
++ >++ 
++ >++ Should this be in the FAQ?  Can anyone suggest improvements?
++ >
++ >This works quite well, but depends heavily on the fact integers are a
++ >countable set. How would you do it with reals, with strings, or with
++ >a selector that isn't uniform?
++ 
++ I don't see much hope for nonuniform selectors.  The algorithm is
++ still a Fisher-Yates shuffle underneath, and therefore assumes a
++ uniform distribution.  I can think of no simple way to change that.

That's the point I was trying to make.

++ As for domains other than integer ranges, there are two general cases
++ in which most situations fall.  If the domain is conceptually finite,
++ one could just use the algorithm to generate a sequence of integers
++ and then map them to the desired domain.

Well, the domain of the integers isn't finite. I think you might mean
countable.

++ On the other hand, for conceptually infinite domains, such as reals in
++ the range ]0,1], one could argue that the uniqueness requirement is
++ meaningless anyway, since even if two random floating point numbers
++ happen to have an identical representation, the probability that the
++ two "infinite precision reals" which they are supposed to approximate
++ would be precisely equal is still zero.

If the selector isn't uniform, it might still happen. If the selector is
uniform, you are already having a problem if the domain is the set of
integers; after all, the chance of picking a number that can be fit in
all the memory in the world is 0.



Abigail


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

Date: Wed, 06 Dec 2000 11:12:21 GMT
From: nkelly@my-deja.com
Subject: can't edit scripts
Message-Id: <90l6ui$v8j$1@nnrp1.deja.com>

hi,
 my problem is editing my scripts.....no matter what i do....an old
version of the script is run......it's the only copt i can find and
it's not a casched version of the script.....any ideas????


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 06 Dec 2000 12:57:18 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: can't edit scripts
Message-Id: <3A2E299E.A53C2077@fujitsu-siemens.com>

nkelly@my-deja.com wrote:
> =

> hi,
>  my problem is editing my scripts.....no matter what i do....an old
> version of the script is run......it's the only copt i can find and
> it's not a casched version of the script.....any ideas????

Hmm, my crystal ball is broken, what OS are you using, what is your PATH
variable, can you post the script that shows this behaviour?

Have you tried putting an explicit path before your program, e.g.
"./script.pl"?

-- =

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


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

Date: Wed, 06 Dec 2000 12:38:39 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: DBI insert problem
Message-Id: <90lc29$kgk$1@news.mch.sbs.de>

In article <90iqs4$ipc@netnews.hinet.net>, "John" <john@imining.com.tw> wrote:
>Hi all:
>
>I am using DBI to write a database program.
>I have prepared an insert SQL command.
>The target database is MS Access.
>Database driver is DBD::ODBC.
>One field of the table is of the type 'memo'.
>When I insert a long string(about 300 characters) into this field, I get an
>error.
>But when I use do to insert the same data, I succeed.
>Everything is ok with short strings.
>WHY?
>
>Thanks in advance.
>
>John Hsieh
>john@imining.com.tw

Are you using exactly the same SQL statement for the do() and
for the prepare(), or are you using placeholders in the second case ?

You might put a trace to see exactly what is happening :
$sth->trace(2,'error.log');

One of the errors you might see is something like this :

    bind 4: CTy=1, STy=VARCHAR, CD=657, Sc=0, VM=657.
_rebind_ph/SQLBindParameter error -1 recorded: [Microsoft][ODBC
Microsoft Access Driver]Invalid precision value  (SQL-S1104)(DBD: 
_rebind_ph/SQLBindParameter err=-1)
    !! ERROR: -1 '[Microsoft][ODBC Microsoft Access Driver]Invalid
precision value  (SQL-S1104)(DBD: _rebind_ph/SQLBindParameter
err=-1)'

Basically, it's trying to bind a param of length 657 (> 255) with the
default VARCHAR type here, and that gives a fatal error.

From the description of execute in the DBI doc :
========
If any arguments are given, then execute will effectively call
bind_param for each value before executing the statement. Values
bound in this way are usually treated as SQL_VARCHAR types unless
the driver can determine the correct type (which is rare), or unless
bind_param (or bind_param_inout) has already been used to specify
the type.
========

What you can do here is specify the type explicitly :
 ..
$sth->bind_param(4, $message, DBI::SQL_LONGVARCHAR);
 ..
$sth->execute;

HTH,

Michel.


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

Date: Wed, 6 Dec 2000 07:57:29 -0000
From: "Trevor Ward" <tward10@jaguar.com>
Subject: Re: dbm
Message-Id: <90krha$hj82@eccws12.dearborn.ford.com>

Perl DBM files are the same as hashes:

if thats not enough info DBMLIST{key} = $hello;

retrieval is the same way.

Well hope this helps

Per- Fredrik Pollnow <Per-fredrik.Pollnow@epk.ericsson.se> wrote in message
news:90ifn2$54f$1@newstoo.ericsson.se...
> Hi,
>
> I need help with a dbm script I'm building.. This is the function:
> First I want to open the dbmfile, I did it like this.
> $hello = "gunde";
> dbmopen(%DBMLIST, "/etc/dbmfile", 0644);
> Ok, now I want the scalar variable $hello to be written in to the
> dbmfile.????
> dbmclose($hello);
> Ok, the other program I need to find the $hello value in the dbmfile ?????
>
> pleas can some1 show me how to do this / thanx
>
>




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

Date: Wed, 06 Dec 2000 12:56:30 +0100
From: ivo <ivo@neroc.nl>
Subject: Re: Document management question!
Message-Id: <B653E7FD.2EB5%ivo@neroc.nl>

Take a look at Zope and it's knowledege management system. It is iin FreeBSD
ports collection.
Ivo

On 14/11/2000 21:46, in article rwhQ5.486$xb1.28908@eagle.america.net,
"Garry Williams" <garry@ifr.zvolve.net> wrote:

> On Tue, 14 Nov 2000 12:25:10 -0800, Gary <gary@dkstat.com> wrote:
>> ...
>> We have a need to create a document management warehouse where we can
>> do the following:
>> 
>> 1. take MS/word docs and save them to a database.
>> 
>> 2. be able to search those docs for words/phases and display a list
>> of which documents contain the words/phrases.
>> 
>> 3. Be able to view the word documents that contain the phrases/words
>> with a www/browser.
>> 
>> 4. Be able to print the documents back out in MS/Word format.
>> 
>> An additional item is:
>> 
>> 1. To be able to scan document into the Database (mysql).
>> 
>> I am basically looking for suggestions, maybe from someone who has
>> done something similar, on what they found to be the best combination
>> of tools/software to do this.  We are open, with a limited budget, to
>> paying for a bundled product that would fit nicely into our above
>> mentioned environment.
> 
>> Thanks for any ideas, thoughts on this question!
> 
> I don't know what this has to do with Perl.
> 
> You might want to take your problem to Xerox and look at their
> DocuShare product.  It does all of the above and more "out of the
> box".  



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

Date: 6 Dec 2000 13:49:35 GMT
From: abigail@foad.org (Abigail)
Subject: Re: dumb question? - how do i find out current script name
Message-Id: <slrn92sgvf.80s.abigail@tsathoggua.rlyeh.net>

On Tue, 5 Dec 2000 14:08:29 -0800, David Wong (tdwong@powertv.com) wrote in comp.lang.perl.misc <URL: news:<90jp0v$4jb$1@nntp1.ba.best.com>>:
++ 
++ In other shell scripting languages, such as sh, csh, ksh, or bash, 
++ argv[0] is always reserved as the script name.  Same holds true for C, 
++ C++, and java.  But not for perl 8-(.

Are you sure about sh and bash? Perhaps you read the man page of sh
again, and then rethink your idea Perl is different.



Abigail


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

Date: Wed, 06 Dec 2000 11:24:01 GMT
From: ale@skate.mailbr.com.br
Subject: Re: find function
Message-Id: <90l7ke$vl3$1@nnrp1.deja.com>

Ok,

So I want to know how to do not output directories as result.
For example, if you try this on Windows c:\temp
the first output is c:\temp
the 2nd is c:\temp\file1.txt

how do I eliminate c:\temp
and all its subdirectories?

Thanks
Alessandro

> > nodo70@my-deja.com <nodo70@my-deja.com> wrote:
> > >
> > >
> > >> The explicit package name should be:
> > >>
> > >>    $_ = $File::Find::name;
> > >>
> > >


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 06 Dec 2000 12:54:50 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: find function
Message-Id: <3A2E290A.98976C0B@fujitsu-siemens.com>

ale@skate.mailbr.com.br wrote:
> =

> Ok,
> =

> So I want to know how to do not output directories as result.
> For example, if you try this on Windows c:\temp
> the first output is c:\temp
> the 2nd is c:\temp\file1.txt
> =

> how do I eliminate c:\temp
> and all its subdirectories?
> =

> Thanks
> Alessandro
> =

> > > nodo70@my-deja.com <nodo70@my-deja.com> wrote:
> > > >
> > > >
> > > >> The explicit package name should be:
> > > >>
> > > >>    $_ =3D $File::Find::name;
> > > >>
> > > >

The following code prints all files:

use File::Find;

find sub { print "$File::Find::name\n" unless -d }, ".";

hth,
-- =

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


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

Date: Wed, 06 Dec 2000 12:33:13 GMT
From: "SuperGumby" <tick.toff@spam.com>
Subject: Re: help getting started with Active perl win32
Message-Id: <dmqX5.6812$xW4.57207@news-server.bigpond.net.au>

<snip>

here-documents ? pardon newbie, but what's a 'here-document'

>And _do_ find out about Here-documents, they can make life a lot more
>comfortable when you're generating boilerplate HTML.
>
>good luck
>
>Erm, no offence meant, but where are you getting this cargo stuff
>from?  It might be useful to warn others against it.
>
>




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

Date: Wed, 06 Dec 2000 10:58:47 GMT
From: alaugusto@my-deja.com
Subject: Help with File Permissions (win32:perms)
Message-Id: <90l656$upn$1@nnrp1.deja.com>

Hi,

I have been trying to use Win32::Perms for a
while, but I am not having success with it.

I want to set permissions on remote machines, on
directories and files. I log as administrator of
the PDC, and try to perform it on the
workstations.

For example,
1. directory: /temp of the workstation
2. Permissions that I want: Administrators: FULL
                            Everyone: READ

Ps. Set this to folder c:\temp and to the files
of this folder

But I cant get it done. I would like to ask help
for that. Can someone help me changing my code
bellow or showing me some new code as example.

The code bellow works, but I think it is setting
permissions ONLY to the folder /temp, and not to
all files within it. Suppose that there are files
inside this folder. After I apply this permissions
on it, I can still modify this files.


Also, when I try to see the permissions with
Explorer, it shows me:

Administrator   Special Access(All) (Not Specif.)
Everyone        Special Access(R)   (Not Specif.)

Ok,
here is the code that I am using.


-------------------------------------------------
use Win32::Perms;

# changing the permissions of the folder c:\temp
from the workstation

$Dir = new Win32::Perms
( '//workstation/C$/temp' ) || die;

# First I remove all the entries
$Dir->Remove(-1);

# Then I try to add the permissions that I want
$Dir->Add( 'administrator',FULL);
$Dir->Add( 'everyone',READ);

$Dir->Set();

print "Finish";
-------------------------------------------------
Thanks,

Al


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 06 Dec 2000 11:10:10 GMT
From: alaugusto@my-deja.com
Subject: Re: Help with File Permissions (win32:perms)
Message-Id: <90l6qg$v7h$1@nnrp1.deja.com>

I already solved part of the problem before. The question now is how
to set permissions to directories and to all files within this
directory.

I am posting my code too, so part of it works good, and the other
does not work yet.

----------------------------------------------------
Apply it to c:\temp, and all files c:\temp\*.*

--------------- main script ------------------------
use File::Find;

find(\&wanted, 'c:\temp');

sub wanted {

  ## This portion will will remove . and ..
  next if $_ =~ /^\.\.?$/;

  print "The current file is: $_\n";

  # here I'will put the permissions script
  #
  # if $_ is a directory { &apply2dir }
  #  elsif $_ is a file { &apply2file }
}

------------ apply acl to directory ---------------------
If I use the code bellow as a single script,
It works good, so I think I can put it as
sub apply2dir.

use Win32::Perms;

# new security descriptor and auto import permissions from the directory
$Dir = new Win32::Perms( '//remotewks/C$/temp' ) || die;

# remove all ACLS that current existe
$Dir->Remove(-1);

$Dir->Add( {Account=>'administrator',Mask=>FULL, Flag=>DIRECTORY} );
$Dir->Add( {Account=>'administrator',Mask=>FULL, Flag=>FILE} );

$Dir->Add( {Account=>'everyone',Mask=>READ, Flag=>DIRECTORY} );
$Dir->Add( {Account=>'everyone',Mask=>READ, Flag=>FILE} );

# Set the directory permissions
$Dir->Set();

----------------- apply acl to files ---------------------------

And the code bellow is for files. But it works only
for local files, I don't have any ideia why it is not
working with remote files. (This part should be sub apply2file)


use Win32::Perms;

# new security descriptor and auto import permissions from the directory
$Dir = new Win32::Perms( '//remotewks/C$/temp/file1.txt' ) || die;

$Dir->Remove(-1);

$Dir->Add( {Account=>'administrator',Mask=>FULL, Flag=>FILE} );

$Dir->Add( {Account=>'everyone',Mask=>READ, Flag=>FILE} );

# Set the directory permissions
$Dir->Set();
--------------------------------------------------


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 6 Dec 2000 20:36:20 +0800
From: "Lucas" <wstsoi@hongkong.com>
Subject: Help: How to read files from the end?
Message-Id: <90lbr5$27m1@imsp212.netvigator.com>

Hi,

I got a large log file that holding over 500,000 records, and each
record per line:

123456789 1997/8/24 13:24 ...
123456790 1997/8/24 13:50 ...
 ...
 ......
 .........

145678902 2000/11/23 2:30 ...


For some reasons, I need to read some recent logs from the log
files, how could I read the logs from the end of file, but not the
start?

Thanks very very much, and thanks to people looking into my
post!!




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

Date: Wed, 06 Dec 2000 12:54:23 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Help: How to read files from the end?
Message-Id: <90lcvo$kgk$2@news.mch.sbs.de>

In article <90lbr5$27m1@imsp212.netvigator.com>, "Lucas" <wstsoi@hongkong.com> wrote:
[snip]
>For some reasons, I need to read some recent logs from the log
>files, how could I read the logs from the end of file, but not the
>start?

Looks like File::Tail from CPAN would be a solution for your problem.

Otherwise, look at the PPT tail command at :
http://language.perl.com/ppt/src/tail/index.html

HTH,

Michel.


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

Date: Wed, 06 Dec 2000 12:17:55 +0100
From: Craig Manley <c.manley@chello.nl>
Subject: How do you convert a Perl script to binary executable in Linux?
Message-Id: <3A2E2063.BB5F5200@chello.nl>

Hi,

I'm looking for a way to convert my Perl CGI scripts to binaries to
speed up processing time. I've tried converting the Perl scripts to C
but the C code doesn't compile. I'm not too familiar with Linux but
there should be a way to dump a binary image of the compiled Perl script
in memory to a file and make that file executable (similar to Perl2Exe
in Windows). I've heard about udump but read that it's a deprecated
utility. The target OS is I'm using is Red Hat Linux 7.0.

-Craig Manley.


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

Date: Wed, 6 Dec 2000 06:35:12 -0600
From: "LimboStar" <dontspamme@awdang.com>
Subject: Re: How to read files from the end?
Message-Id: <3a2e37f0@news.cc.umr.edu>

"Lucas" <wstsoi@hongkong.com> wrote...
>
> For some reasons, I need to read some recent logs from the log
> files, how could I read the logs from the end of file, but not the
> start?

  local *FILE;
  open( FILE, $filename );
  seek( FILE, -500, 2 ); # 500 bytes before EOF
  my @lines = <FILE>;
  shift @lines; # remove half-eaten line

Assuming you know roughly the length of each line, you can return roughly
the correct amount of lines (or, if all the lines are exactly the same
width, you can remove the shift and return an exact number of lines).

Or you could just use tail(1) from your favorite shell:

  ~/$ tail -50 myfile

 ...which will display the last 50 lines of the file.

Incidentally, you could do that in perl, too:

  local *FILE;
  open( FILE, "tail -$numlines $filename |" );
  my @lines = <FILE>;
  close( FILE );

But that's not very portable.

--sjd;




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

Date: Wed, 06 Dec 2000 06:17:37 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: How to write a packet sniffer for win32 (TCP Packets)
Message-Id: <3A2E2051.D1E40637@patriot.net>

As of yet, there is none.  You can use a packet sniffer to retrieve
packets in a
tcpdump format, and then use a Perl script to decipher them...

Patrick Steiner wrote:

> I need a packet sniffer for Windows NT, written in perl. It must be
> analyse TCP Packets.
> Which Modul can i use?
> Have anyone a example Script?
>
> (Sorry for my bad english)

--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.




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

Date: Wed, 06 Dec 2000 14:15:44 +0100
From: ZSSTL <ZSSTL@Zeppelin.de>
Subject: Re: How to write a packet sniffer for win32 (TCP Packets)
Message-Id: <3A2E3BFF.C827CFD3@Zeppelin.de>

Patrick Steiner schrieb:

> I need a packet sniffer for Windows NT, written in perl. It must be
> analyse TCP Packets.
> Which Modul can i use?
> Have anyone a example Script?
>
> (Sorry for my bad english)

Hi Patrik,

AFAIK there is no perl module for decoding IP packets.

To get a sniffer an an analyzer take a look at www.etherreal.com: The
have both tools as freeware. Hope that this helps a litle.

Greetings,

Tom



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

Date: Wed, 06 Dec 2000 13:51:48 GMT
From: kmyer@hotmail.com
Subject: Re: Howto create setuid/setgid files and directories?
Message-Id: <90lg9j$61d$1@nnrp1.deja.com>

In article <5RhX5.85$T3.170584064@news.frii.net>,
  cfedde@fedde.littleton.co.us (Chris Fedde) wrote:


> That's octal 02707. and is equivalent to binary
>
>     010111000111
>     sgtrwxrwxrwx
> 	u  g  o

Sorry that I didn't make it clear.  I need octal 2707 permissions, which
is what you've listed above.  Don't ask why the permissions are set that
way - thats just the way netatalk creates the Network Trash Folder and
rather than question it, I just want to duplicate it :)

I've found my error, namely misinterpreting the documentation.  I need
to use:

chmod oct(2707), ....
OR
chmod 02707, ...

instead of:

chmod 2707, ....

I wrongly assumed that the first bit corresponded to the
sticky/setuid/setgid bits, when in reality, it is used to determine what
base the number is written in.

Maybe its because few people use the chmod function to actually do
anything but fiddle with the user, group and world bits but the
documentation is unclear on this point.

> This is really more a unix question than it is a Perl one.  You might
get a
> better answer in a group that has unix somewhere in it's name.

I'd say its more of a perl question than a unix one actually.  While
chmod is a UNIX utility and the perl chmod function clearly emulates the
unix utility, the problem I was having was in using the perl chmod, with
the arguments I passed to it, not in calculating the UNIX bits, per se
(although improperly expressing 2707 is a bit calculation I guess).

Anyway, problem solved.  I'm wiser for it and its time to create 600
home directories.

Kevin


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 6 Dec 2000 11:22:14 GMT
From: abigail@foad.org (Abigail)
Subject: Re: kill and security (suid)
Message-Id: <slrn92s8b6.80s.abigail@tsathoggua.rlyeh.net>

On 6 Dec 2000 10:34:26 -0000, Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote in comp.lang.perl.misc <URL: news:<90l4ni$3s3$1@lublin.zrz.tu-berlin.de>>:
++ 
++ Yes, that's what's puzzling me too.  While it is true that the unix
++ kill command uses TERM as a default (not only under Linux), Perl's
++ kill() doesn't do that, and, for the reason you give, it would make
++ little sense if it did.


Imagine:  kill 1, @empty;


Abigail


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

Date: Wed, 06 Dec 2000 13:22:03 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: kill and security (suid)
Message-Id: <3A2E40E8.A0BA61E8@home.com>


Anno Siegel wrote:
> 
> Rick Delaney  <rick.delaney@home.com> wrote in comp.lang.perl.misc:
> >
> >Anno Siegel wrote:
> >>
> >> Chris Fedde <cfedde@fedde.littleton.co.us> wrote in comp.lang.perl.misc:
> >> >In article <87k89ftryb.fsf@nujoma.perrins>,
> >> >Andrew J. Perrin <aperrin@demog.berkeley.edu> wrote:
> >> >>
> >> >>system("/bin/kill $_") foreach (split(/\s+/,$pppds));
> >> >>
> >> >    system('/bin/kill', '-TERM', $_);  # called with proper switch
> >>
> >> Indeed.  The system() variant couldn't work the way the OP wrote it.
> >
> >Why not?  It works for me on a Linux box where SIGTERM is the default
> >signal for kill.

I suppose I should have written kill(1).

> Hmm... the specification of kill() has indeed changed from "kill LIST"
> to "kill SIGNAL, LIST".  However,
> 
>   perl -e '$SIG{ TERM} = sub {print "TERM\n"}; kill $$'
> 
> prints nothing.  (This is also a Linux system.)

Of course.  Look at what I've quoted.  Nowhere is Perl's kill mentioned. 

"The system() variant" will work fine "the way the OP wrote it."

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Wed, 6 Dec 2000 13:07:32 +0100
From: "Per- Fredrik Pollnow" <Per-fredrik.Pollnow@epk.ericsson.se>
Subject: Re: mail ???
Message-Id: <90l9ln$kog$1@newstoo.ericsson.se>

Thanx fore the help :)
"SimBean" <schneider@xtewa.de> wrote in message
news:90l5ne$uf1$1@nnrp1.deja.com...
>
>
> > I have done a mail script like this, whay don i work ?
>                                        ^^^^^^^^^^^^^^^
> What error-message do you get?
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Wed, 6 Dec 2000 06:39:05 -0600
From: "LimboStar" <dontspamme@awdang.com>
Subject: Re: Need help with Http{referrer}
Message-Id: <3a2e38d9@news.cc.umr.edu>


"Loans2001" <loans2001@aol.com> wrote...
> Here is the portion of the script from clicks.cgi that is supposed
> to do this.  But it is currently not working properly.

What, in particular, is it not doing correctly?  You must be specific, or
your throw yourself on the mercy of people like me, who have nothing better
to do than debug problems we don't know exist...

> $id=$ENV{'QUERY_STRING'};
> $id=lc($id);

$id is going to be URL-encoded.  Spaces will be replaced with %20, etc.  You
should be aware of that, in case you're not already.

> $timenow = time;

time() returns the time in seconds since January 1, 1970, UTC (the epoch).
It's not very useful for being understood by humans.  More likely you meant
something like this:

  use POSIX;
  my $timenow = strftime( '%Y-%m-%d %H:%M', localtime( time() ) );

> open(FILE, ">>$clicklog") || die "I can't open $logfile2";

If it can't open $clicklog, it dies with a message saying it can't open
$logfile2.  That's going to cause you hours of debugging later :)

Well, that's about all I can say about it without knowing anything.

--sjd;





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

Date: Wed, 06 Dec 2000 11:58:55 +0100
From: Jan van Mansum <jvm@ysabel.com>
Subject: Object member variables
Message-Id: <3A2E1BEE.5323239E@ysabel.com>

Hello group,

I have been browsing at Deja but I can't find the solution to my
problem, although I think it cannot be too difficult.

I want to create two instances of the same class and use them like this:

$o1 = MyClass->new("1");
$o2 = MyClass->new("2");
$o1->printvalue();
$o2->printvalue();

In the MyClass pacakage I have defined a variable (which is supposed to
be a non-static member variable):

package MyClass;

$member; # (my,local, ...???)
sub new
{
    my $class = shift;
    return bless {}, $class;
}

sub printvalue
{
    print $member;
}

The program prints "2" twice, so I suppose $member is a static class
variable. How can I declare it to be non-static (or fake a non-static
variable), that is to say make it unique for each instance of MyClass?
I have tried putting my or local before the $member definition but that
doesn't work.

Thanks in advance of any help.
Regards,

Jan van Mansum.



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

Date: Wed, 06 Dec 2000 12:47:15 +0000
From: Nick Condon <nickco3@yahoo.co.uk>
Subject: Re: Object member variables
Message-Id: <3A2E3553.ABF79076@yahoo.co.uk>

Jan van Mansum wrote:

> Hello group,
>
> I have been browsing at Deja but I can't find the solution to my
> problem, although I think it cannot be too difficult.
>
> I want to create two instances of the same class and use them like this:
>
> $o1 = MyClass->new("1");
> $o2 = MyClass->new("2");
> $o1->printvalue();
> $o2->printvalue();
>
> In the MyClass pacakage I have defined a variable (which is supposed to
> be a non-static member variable):
>
> package MyClass;
>
> $member; # (my,local, ...???)
> sub new
> {
>     my $class = shift;
>     return bless {}, $class;
> }
>
> sub printvalue
> {
>     print $member;
> }
>
> The program prints "2" twice, so I suppose $member is a static class
> variable. How can I declare it to be non-static (or fake a non-static
> variable), that is to say make it unique for each instance of MyClass?
> I have tried putting my or local before the $member definition but that
> doesn't work.

So instead of a static class variable, you want "member" to be an object
attribute?

Declare a get/set method for your attribute, and use that.

package MyClass;

sub new {
    my $class = shift;
    my $self = {};
    bless ($self, $class);
    if (@_) { $self->member(@_) }
    return $self;
}

sub member {
    # A get/set method for the "member" attribute
    my $self = shift;
    if (@_) { $self->{member} = shift }
    return $self->{member};
}

sub printvalue {
    my $self = shift;
    print $self->member;
}



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

Date: Wed, 06 Dec 2000 13:39:09 +0100
From: Jan van Mansum <jvm@ysabel.com>
Subject: Re: Object member variables
Message-Id: <3A2E336D.88C26A02@ysabel.com>

Thanks. I take it $self is a reference to a hash (the object), so the member
variables and their values are just name/value pairs on this hash. I *think* I
am *beginning* to understand.

Regards,

Jan van Mansum.

Nick Condon wrote:

> Jan van Mansum wrote:
>
> > Hello group,
> >
> > I have been browsing at Deja but I can't find the solution to my
> > problem, although I think it cannot be too difficult.
> >
> > I want to create two instances of the same class and use them like this:
> >
> > $o1 = MyClass->new("1");
> > $o2 = MyClass->new("2");
> > $o1->printvalue();
> > $o2->printvalue();
> >
> > In the MyClass pacakage I have defined a variable (which is supposed to
> > be a non-static member variable):
> >
> > package MyClass;
> >
> > $member; # (my,local, ...???)
> > sub new
> > {
> >     my $class = shift;
> >     return bless {}, $class;
> > }
> >
> > sub printvalue
> > {
> >     print $member;
> > }
> >
> > The program prints "2" twice, so I suppose $member is a static class
> > variable. How can I declare it to be non-static (or fake a non-static
> > variable), that is to say make it unique for each instance of MyClass?
> > I have tried putting my or local before the $member definition but that
> > doesn't work.
>
> So instead of a static class variable, you want "member" to be an object
> attribute?
>
> Declare a get/set method for your attribute, and use that.
>
> package MyClass;
>
> sub new {
>     my $class = shift;
>     my $self = {};
>     bless ($self, $class);
>     if (@_) { $self->member(@_) }
>     return $self;
> }
>
> sub member {
>     # A get/set method for the "member" attribute
>     my $self = shift;
>     if (@_) { $self->{member} = shift }
>     return $self->{member};
> }
>
> sub printvalue {
>     my $self = shift;
>     print $self->member;
> }



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

Date: Wed, 6 Dec 2000 20:39:53 +0800
From: "­»΄δΈ}" <crud_alex@yahoo.com>
Subject: Re: perl printer problem
Message-Id: <90lc5o$omk$1@taliesin.netcom.net.uk>

why windows is wrong?

Kiel Stirling <taboo@comcen.com.au> wrote in message
news:3a2d8c33@nexus.comcen.com.au...
:
: "­»΄δΈ}" <crud_alex@yahoo.com> wrote:
: >open (PRNT , ">LPT1") || die "$!";>
: >and the error message is " Permission denied at C:\B.PL line 2."?
: >
: >it's running on the win98 system?what's going wrong?
:
: it's windoz that's whats wrong
:




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

Date: Wed, 06 Dec 2000 12:13:39 +0000
From: Bernard Englefield <b.englefield@uel.ac.ku>
Subject: Re: Problem creating DBM database
Message-Id: <3A2E2D73.B8B843D7@uel.ac.ku>



Flint Slacker wrote:

> I had this problem when I moved some code from a UNIX box  to NT, but
> fixed it by changing the DBM package.  I don't know why, but it might
> help you so....  :)
>
> use DB_File;
> to
> use GDBM_File;
>
> Well something like the above, anyways it worked.
>
> $mode = oct("0644");
> dbmopen(%WORDS, "words", $mode) || die "....
>
> Flint
>
> On Tue, 05 Dec 2000 15:40:31 +0000, Bernard Englefield

Thanks that worked. I would still like to know why I can't write a DBM file.



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

Date: Wed, 6 Dec 2000 14:12:57 +0100
From: "Tadeusz Zwolinski" <Tadeusz.Zwolinski@rzeszow.tpsa.pl>
Subject: Problem using Net::FTP
Message-Id: <90ldvb$749$1@sunsite.icm.edu.pl>

I wrote program which gets the file from ftp server.
If there is a probem during transfer, program exits with error:
"Timeout at C:/Perl/site/lib/Net/FTP.pm line 382"
What should I do to made condition  'if(!$ftp->get("file"))'
works properly and returns program to begining of the loop?


Here is the code:

$cnt=1;
while ($cnt<10) {
 if (!($ftp = Net::FTP->new("srv_adress")))
  {print "Error 1";
   $cnt++;
   next;};
 if (!$ftp->login("anonymous","email"))
  {print "Error 2";
   $cnt++;
   next;};
 $ftp->type("I");
 if (!$ftp->get("file"))
  {print "Error 3";
   $cnt++;
   next;};
 $ftp->quit;
 last;}

Thanks,
Tadeusz




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

Date: Wed, 06 Dec 2000 13:45:02 GMT
From: Teacher Guy <habfan2@my-deja.com>
Subject: Profanity Check
Message-Id: <90lfst$5k3$1@nnrp1.deja.com>

Hello.  I have set up a Perl message board on our school's website and
I need to add a profanity check to subject and body sections.  I need
code that will check for all instances of a word.  For example, I need
to account for mixed upper and lower case possibilites  (ex. BAStard,
BASTARd, Bastard, etc.).   Here is the code that works so far:

# body profanity check
if (($FORM{'body'} =~ /fuck/)||($FORM{'body'} =~ /asshole/)||($FORM
{'body'} =~ /slut/)|

Can I convert all data to uppercase prior to checking for words????


Teacher Guy :)


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 6 Dec 2000 13:05:14 +0100
From: "Per- Fredrik Pollnow" <Per-fredrik.Pollnow@epk.ericsson.se>
Subject: random caracters
Message-Id: <90l9hd$kbr$1@newstoo.ericsson.se>

Hi,

I  search the web bot found nothing.

My question is, how to I random characters like [a-zA-Z] ?? I have done the
rand with the numbers:
srand( time() ^ ($$ + ($$ <<15)) );$rand = rand();$rand =~s/\D.//;--$rand
;@nice = split //, $rand;
@sifr2 = (@nice[1, 7, 3, 5, 0, 4]);
print "@sifr2\n";
but I can't figure out how to do it with charters. Can someone please help
me..





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

Date: Wed, 6 Dec 2000 06:12:10 -0600
From: "LimboStar" <dontspamme@awdang.com>
Subject: Re: random characters
Message-Id: <3a2e3287@news.cc.umr.edu>

> ...but I can't figure out how to do it with characters. Can
> someone please help me?

The way I do it (probably non-optimal) is this:

  my $charset = 'bcdfghjklmnpqrstvwxz';
  my $ret = '';
  for (0..10)
    { $ret .= substr( $charset, rand( length($charset) ), 1 ); }
  print $ret . "\n";

Well, that way you can change the character set you want it to draw from, at
least.

Hope this helps,

--sjd;





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

Date: 6 Dec 2000 11:24:34 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Sorting the result of a function
Message-Id: <slrn92s8fi.80s.abigail@tsathoggua.rlyeh.net>

On Tue, 05 Dec 2000 13:37:33 +0100, Wolfgang Hielscher (W.Hielscher@mssys.com) wrote in comp.lang.perl.misc <URL: news:<3A2CE18D.AB183D98@mssys.com>>:
++ 
++ What I was trying to say was that IMO  'sort +f()'  demonstrates the
++ practical use of the unary plus in a more "realistic" or "natural"
++ situation than 

I use unary plus quite often; most of the time in hash keys:

    $hash {+shift} = "foo";


Abigail


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

Date: 6 Dec 2000 12:04:55 GMT
From: jstocker@s61.informatik.uni-bremen.de (Jan Stocker)
Subject: Re: SSLeay, LWP and HTTPS
Message-Id: <slrn92sar7.8da.jstocker@s61.informatik.uni-bremen.de>

Thanx, yes i dont need the auth-feature. Is there anything to speed
up this stuff? Its very slow.

Jan


In article <u9wvdjgb2r.fsf@wcl-l.bham.ac.uk>, nobull@mail.com wrote:
>jstocker@s61.informatik.uni-bremen.de (Jan Stocker) writes:
>
>> Hi,
>> 
>> i've tried to make a HTTPS connection via LWP->UserAgent->request().
>> It runs for HTTP quite right, for HTTPS the file README.SSL reads you've
>> to intsall SSLeay and IO::Socket::SLL. If you try then a HTTPS request
>> it ends in a connection error.
>> 
>> My apache-log shows that OpenSSL dont accepts the ca send to it.
>
>If all you want to use SSL for is encryption then simply switch off
>the checking:
>
>use IO::Socket::SSL;
>IO::Socket::SSL::context_init({SSL_verify_mode => 0});
>
>-- 
>     \\   ( )
>  .  _\\__[oo
> .__/  \\ /\@
> .  l___\\
>  # ll  l\\
> ###LL  LL\\


-- 
The Kappamaki, a whaling research ship, was currently researching the
question: How many whales can you catch in one week?
        -- (Terry Pratchett & Neil Gaiman, Good Omens)


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

Date: Thu, 7 Dec 2000 01:02:01 +1100
From: "Michael Roper" <michael_roper@hotmail.com>
Subject: syscall.h missing on AIX
Message-Id: <90lgv6$ne5$1@spacebar.ucc.usyd.edu.au>

Hi,
    Im trying to run a script that requires sys/syscall.ph but there is no
sys/syscall.h header file on the system Im using (AIX 4.3.2 on RS/6000).
What's the story?

Thanks in advance,
Michael




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

Date: Wed, 06 Dec 2000 15:01:21 +0100
From: Craig Manley <c.manley@chello.nl>
Subject: Using 'require' and performance gains
Message-Id: <3A2E46B1.4EADBBAE@chello.nl>

Hi,

I've got a CGI script that uses a class that contains 6 different and
huge action handling functions. Only one action is executed per web
request. So my thought is: how much performance gain (or maybe loss) can
I expect if I place these 6 action handling functions each into seperate
files so that the class will load the correct file at runtime using
'require'?

In total, the code that Perl must interpret will have decreased in size
by about I guess 70% - so less interpreting has to be done - so less
work, more speed.

Perl must interpret the file loaded at runtime with 'require'. How much
overhead this causes (if any) I don't know, because I don't know much
about the internal operating of Perl.

-Craig Manley.


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

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


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