[10748] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4347 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 2 22:07:23 1998

Date: Wed, 2 Dec 98 19:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 2 Dec 1998     Volume: 8 Number: 4347

Today's topics:
    Re: $! type variables mike808@mo.net
    Re: $! type variables <r28629@email.sps.mot.com>
    Re: Any way to get drive letters on Win95 Machines? <jeff@vpservices.com>
    Re: awk system call (Charles DeRykus)
    Re: Behavior of C<for $var (..)> <r28629@email.sps.mot.com>
        Database questions ... <darrensweeney@eswap.co.uk>
    Re: die() message available at END time? (Charles DeRykus)
    Re: Excel Spreadsheets, Perl, CGI and Linux <dejahvu@erols.com>
    Re: New idiom? <rick.delaney@shaw.wave.ca>
    Re: no instance of a classy kludge (method) (Damian Conway)
    Re: Okay, I took the advice -- now what? (Matthew Bafford)
        Pattern Matching Question (easy...) <webmaster@topproducer.com>
    Re: Pattern Matching Question (easy...) (Sam Holden)
    Re: Pattern Matching Question (easy...) <rick.delaney@shaw.wave.ca>
    Re: Pattern Matching Question (easy...) <webmaster@topproducer.com>
    Re: Pattern Matching Question (easy...) (Sam Holden)
    Re: Pattern Matching Question (easy...) <admin@asarian-host.org>
    Re: perlcc; cc complains about undefined sym "runops" vishalb@my-dejanews.com
        pos function - How do you manipulate it? (Bryce Pursley)
    Re: system commands in WinNT <joshb@cadence.nospamnojunk.com>
    Re: Trim Functionality ?? mike808@mo.net
    Re: Trim Functionality ?? (Larry Rosler)
    Re: When does CLOSE not FLUSH? (Larry Rosler)
        Win32::FileSecurity::Set <feskencj@plu.edu>
    Re: Win32::OLE question--GetActiveObject() (Jan Dubois)
    Re: win32API module available for Unix? (Fluffy)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Thu, 03 Dec 1998 00:09:42 GMT
From: mike808@mo.net
Subject: Re: $! type variables
Message-Id: <744ks5$kp6$1@nnrp1.dejanews.com>

In article <7448bl$1dg0$1@nntp6.u.washington.edu>,
  snow@biostat.washington.edu (Gregory Snow) wrote:
> I remember reading somewhere how to make variables like $!, that
> return different values in string context and numeric context.

Check out the "Advanced Perl Programming Book" and pay attention to the
sections on XS programming. You need to write some XS stuff to do this.

Maybe perldoc perlguts ?

Michael King
Just another pervlet programmer.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 02 Dec 1998 17:51:57 -0600
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: $! type variables
Message-Id: <3665D29D.8910D7AD@email.sps.mot.com>

Sam Holden wrote:
> 
> On Wed, 02 Dec 1998 16:02:04 -0600, Tk Soh <r28629@email.sps.mot.com> wrote:
> >[posted to c.l.p.m and copy emailed]
> >
> >Sam Holden wrote:
> >>
> >> On 2 Dec 1998 20:36:05 GMT, Gregory Snow <snow@biostat.washington.edu> wrote:
> >> >
> >> >I remember reading somewhere how to make variables like $!, that
> >> >return different values in string context and numeric context.  I've
> >> >spent the last hour pouring through the docs and faq but have not
> >> >found it (and DejaNews won't search for $! and other searches have
> >> >been useless).  Can anyone point me to the correct doc or post?
> >>
> >> I've never needed to do that so I could be wrong but I suspect :
> >>
> >> perldoc overload
> >>
> >> might have the answers you want (of course it's quite possible that
> >> that is the extremely long and comlicated way to do it in which case I
> >> guess it won't jog your memory anyway)...
> >
> >overload? I think this is overkill ;-)
> >
> >     perldoc perlvar
> 
> Where does perlvar tell me how to make variables which have 'magical'
> properties like many of the built in variables that perlvar lists?
> 
> All I see is a list of variables that are special in various ways already,
> nothing about making my own though...

Oops! My apology, I didn't read it (...to make variable...) correctly
the first time.

-TK


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

Date: 3 Dec 1998 01:49:38 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Any way to get drive letters on Win95 Machines?
Message-Id: <3665ED4F.EEA9C095@vpservices.com>

Gareth Jones wrote:

[snip]
> I need a way to get the local hard drives.

Do you mean get the names of available drives?  If so, this snippet
works for me:

    my  @drives = grep -e "$_:/", 'A' .. 'Z';
    for(@drives){print "$_\n";}

- Jeff


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

Date: Wed, 2 Dec 1998 23:44:16 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: awk system call
Message-Id: <F3D39s.J60@news.boeing.com>

In article <3665a307.190771014@ausnews.austin.ibm.com>,
Lance Miller <lemiller@us.ibm.com> wrote:
>I've been trying to use awk in a system statement in my perl program
>
>examlple
>
>(  !system," /usr/bin/awk '{print$1}'  filename );
>
>I believe it has to do something with $1 variable, and awk and perl
>are mis-translating it.
>

there's a spurious comma after the C<system> function I've 
taken the liberty to remove. Otherwise, you have a comma  
operator.

Something more like this perhaps:

   system "/usr/bin/awk '{print \$1}' filename";

or, eliminating that troublesome interpolative shell:  

   system '/usr/bin/awk', '{print$1}', 'filename';


For more info:  perldoc -f system

hth,
--
Charles DeRykus


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

Date: Wed, 02 Dec 1998 17:57:04 -0600
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: Behavior of C<for $var (..)>
Message-Id: <3665D3D0.58C0B7CF@email.sps.mot.com>

Jeff Pinyan wrote:
> I always use for anyway... call it bad style, it's 4 less chars, and I
> like it. :)

ever thought of the reasons why 'foreach' and 'for' co-exist?

-TK


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

Date: Wed, 2 Dec 1998 18:05:55 -0800
From: "Darren" <darrensweeney@eswap.co.uk>
Subject: Database questions ...
Message-Id: <744rm1$7kv@sjx-ixn4.ix.netcom.com>

Hi all

I have a script which creates and then goes on to read/write to a dB.

The script gives a choice of using either DBMS or BerkeleyDB ... my host
supports neither!!

Is there an easy way to change the coding to enable the script to read/write
a mSQL or MySQL database instead?

The opening of the script is as follows:

#!/usr/bin/perl
use DB_File;
#use SDBM_File; # un-comment to use SDBM instead of BerkeleyDB
sub O_CREAT { 0x0100 }
sub O_BINARY { 0x8000 }
sub O_RDWR { 0x0002 }

Thanks for any help.

Regards

Darren





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

Date: Wed, 2 Dec 1998 22:54:19 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: die() message available at END time?
Message-Id: <F3D0yJ.F9D@news.boeing.com>

In article <36645988.1c9.chess@watson.ibm.com>,  <chess@watson.ibm.com> wrote:
>Can an END routine get access to the string that was passed to die()
>in any plausible way?  For instance:
>
>    ...
>      or die "frob not twizzled."
>    ...
>
>  END {
>     ...
>     Log("Reason for death: $@");
>     ...
>  }
>
>except that $@ doesn't in fact contain the death-string at that
>point.  I know something similar can be done with eval()s and all,
>but it'd be fun to be able to do it this way...
>

Another related question:

Does anyone know why C<$@> doesn't ever propagate to the   
C<END> block ? 

--
Charles DeRykus


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

Date: Wed, 02 Dec 1998 18:49:47 -0600
From: Mary E Tyler <dejahvu@erols.com>
Subject: Re: Excel Spreadsheets, Perl, CGI and Linux
Message-Id: <3665E028.4043@erols.com>

michalk@awpi.com wrote:
> 
> I have a shared networked Excel spreadsheet that I would like to make
> available to the web via CGI and Perl on a Linux machine.
> 
> I have found the ODBC drivers, but it looks like all that is only for Win
> platforms.
> 
> Is there anything that will allow me to natively query the spreadsheet from
> Perl?
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

Excel has *some* very basic SQL type abilities... i imagine that some
combonation of ActiveX  or OLE would allow you to pass a SQL formatted
request from your Perl CGI to your excel program and pass the resulting
data back...

but it's not a perl question you need answered. it's an excel one.

i know there is a way to do it with Applescript, but i doubt you're
running a mac...

you could also open up the excel file with a text editor and see if you
can't figure out enough of the structure to fake it.
dejah
-- 
i trust i make myself obscure, i have need of obscurity now- robert bolt

a heated exchange of unread mail would be welcomed by all- christensen

Skating Fiction. Featuring the  highly acclaimed serial On The Edge!
http://www.DejahsPrivateIce.com



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

Date: Thu, 03 Dec 1998 00:20:14 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: New idiom?
Message-Id: <3665DAF5.8499BC41@shaw.wave.ca>

[posted & mailed]

Sean McAfee wrote:
> 
> >Comments?  Any hidden gotchas that I haven't noticed?
> 
> Found one already!  When I ran code similar to the above with warnings
> enabled, I got
> 
> Undefined value assigned to typeglob at ...
> 
> when each() returned undef after iterating through the entire hash.
> 

Are you sure there's nothing else wrong with the other code?  I was able
to use your idiom with -w and received no warnings.  There is also no
problem using strict as long as you 'use vars qw/*param/'.

    while ((my $host, local *param) = each %paramhash) {
        ...
    }

This works quite well with a suitably set %paramhash.

> Oh well.  It looked like such a nifty little idiom...

And it still does.  Kudos and thanks.

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: 3 Dec 1998 01:20:40 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: no instance of a classy kludge (method)
Message-Id: <744p18$cli$1@towncrier.cc.monash.edu.au>

trueblue2@bellsouth.net (Verily Blue) writes:

>  package Bird;

>  sub has
>    { # Bird method
>    my $self = shift;
>    my $attribute = shift;
>    ...
>    return $value if $value = $self->has( $attribute );
>                              ^^^^^
>    ...
>    }

>  ...

>I want to be able to call Animal 'has' above but using '$self'
>obviously won't work.

As others have mentioned, calling

	$self->SUPER::has( $attribute )

will (probably) do what you want.

The only caveat is that you have to be careful under multiple
inheritance. The "->SUPER::methodname" syntax means "start looking
for &methodname in the parent classes of the current class". So, if
Bird inherits from several classes, the &has you'll invoke will be
the one first encountered by a left-to-right depth-first search of
those classes.

For instance, if Bird was declared:

	package Bird
	@ISA = qw( Avian Animal NourishingAndTastyMeal );

then the call to $self->SUPER::has( $attribute ) could 
very well end up invoking &Avian::has (if such a method
existed). 

If you want to be absolutely sure that it's &Animal::has
that is invoked, you need to request it by name:

	$self->Animal::has( $attribute )

which means: "start looking for a &has method in the 
Animal class (and then any of its ancestors, if need be)".


Damian


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

Date: Wed, 2 Dec 1998 20:51:52 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Okay, I took the advice -- now what?
Message-Id: <MPG.10cfb8c2e6dcf98f98974c@news.scescape.net>

In article <3665b15e.26041575@news.primeline.com>, gemhound@gemhound.com 
says...
=> I just got the welcome message to this Ng, and tried using some of the
=> suggestions.  When I included <use diagnostics;> in my source, I got
=> the following long message (I am using activestate's win32 perl.)
=> 
=> couldn't find diagnostic data in
=> C:\ActivePerl\5.00502\lib/pod/perldiag.pod C:\A
=> CTIVEPERL\5.00502\lib/MSWin32-x86-object C:\ACTIVEPERL\5.00502\lib
=> C:\ACTIVEPERL \site\5.00502\lib/MSWin32-x86-object
=> C:\ACTIVEPERL\site\5.00502\lib C:\ACTIVEPER L\site\lib . hello.pl at
=> C:\ACTIVEPERL\5.00502\lib/diagnostics.pm line 229, <POD _DIAG> chunk
=> 533. 
=> 
=> Is there something I can do to get this data package for win32 perl,
=> so I can use diagnostics?

This is, thankfully, fixed in later versions.  Download build 507 today!

[snip]

=> Thanks. 

HTH!

=> Jim Mooney

--Matthew


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

Date: Wed, 2 Dec 1998 16:58:22 -0800
From: "Alistair Calder" <webmaster@topproducer.com>
Subject: Pattern Matching Question (easy...)
Message-Id: <744nne$ino$1@supernews.com>

I have looked through the perl man pages on Pattern Matching and I have come
across what (I think) is the correct way to do this, but I cant get it to
work.

Here is the situation:  I have a gigantic list of words and their
definitions, each on their own line, seperated by a pipe.  I want to be able
to enter a word that my perl script will then search the definition string
for.  If my input matches anything on the in the definition (not the entire
thing), I want the query to print the line.

Sound easy?  It does to me...BUT:

I have managed to open the file containing the definitions, read them in
line by line and try a matching test on each definition.  But for some
reason, I cannot get the input to match anything in the definition.

As an example:

computer|a device used for making calculations based on user input.

If I enter 'user', it should match the word in the definition part and print
it out, but for some reason I can't get it to go.

I have read the Regexp and the Pattern Matching sections, but I am a newbie,
and the examples that they gave weren't exactly 'on point' for me.  I
understand this is a newbie question, but could someone help me out with
this?

Thanks,
Alistair




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

Date: 3 Dec 1998 01:06:32 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Pattern Matching Question (easy...)
Message-Id: <slrn76bp0o.evr.sholden@pgrad.cs.usyd.edu.au>

On Wed, 2 Dec 1998 16:58:22 -0800, Alistair Calder <webmaster@topproducer.com>
	wrote:
>I have looked through the perl man pages on Pattern Matching and I have come
>across what (I think) is the correct way to do this, but I cant get it to
>work.
<snip problem> 
>
>As an example:
>
>computer|a device used for making calculations based on user input.
>
>If I enter 'user', it should match the word in the definition part and print
>it out, but for some reason I can't get it to go.
>
>I have read the Regexp and the Pattern Matching sections, but I am a newbie,
>and the examples that they gave weren't exactly 'on point' for me.  I
>understand this is a newbie question, but could someone help me out with
>this?

Since you didn't post any of your code I can only guess at the problem. The
most common reason for this type of problem is forgetting to strip the '\n'
from the user input. You should chomp the input (see perldoc -f chomp) since
the pattern /user\n/ does no occur in the text and thus you will not
get a match.

You should probably be using something like :
$input = <STDIN>; # maybe <>...
chomp $input; # remove trailing newline

-- 
Sam

People get annoyed when you try to debug them.
	--Larry Wall


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

Date: Thu, 03 Dec 1998 01:09:29 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: Pattern Matching Question (easy...)
Message-Id: <3665E67C.3CD06BA5@shaw.wave.ca>

[posted & mailed]

Alistair Calder wrote:
> 
> I have read the Regexp and the Pattern Matching sections, but I am a 
> newbie, and the examples that they gave weren't exactly 'on point' for 
> me.  I understand this is a newbie question, but could someone help me 
> out with this?

Gladly.  Post the code that you have tried and we will point out where
you went wrong and try to put you back on track.

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: Wed, 2 Dec 1998 17:16:43 -0800
From: "Alistair Calder" <webmaster@topproducer.com>
Subject: Re: Pattern Matching Question (easy...)
Message-Id: <744opq$jfo$1@supernews.com>

Good point, Sam.  Here is my (very newbie) code:


#!/perl -w

$searchfile = "c:/gaelic/total.htm";
$count= 0;
$gaelic = "";
$def = "";

$input = <STDIN>;
chomp $input;
open (IN, "$searchfile") || die "No input file";
@data = <IN>;
close(IN);

print "Attempting to find a match for $input...searching...\n\n";
foreach $line(@data){
  chomp $line;
 ($gaelic, $def)= split (/\|/, $line);
 if ($input =~ m/$def/) {
   print "$gaelic : $def\n";
  $count++;
  }
 }

if ($count < 1){
  print "No matches\n";
 } else {
 print "$count total matches.\n";
 }


Thanks for any help
Alistair


Sam Holden wrote in message ...
>On Wed, 2 Dec 1998 16:58:22 -0800, Alistair Calder
<webmaster@topproducer.com>
> wrote:
>>I have looked through the perl man pages on Pattern Matching and I have
come
>>across what (I think) is the correct way to do this, but I cant get it to
>>work.
><snip problem>
>>
>>As an example:
>>
>>computer|a device used for making calculations based on user input.
>>
>>If I enter 'user', it should match the word in the definition part and
print
>>it out, but for some reason I can't get it to go.
>>
>>I have read the Regexp and the Pattern Matching sections, but I am a
newbie,
>>and the examples that they gave weren't exactly 'on point' for me.  I
>>understand this is a newbie question, but could someone help me out with
>>this?
>
>Since you didn't post any of your code I can only guess at the problem. The
>most common reason for this type of problem is forgetting to strip the '\n'
>from the user input. You should chomp the input (see perldoc -f chomp)
since
>the pattern /user\n/ does no occur in the text and thus you will not
>get a match.
>
>You should probably be using something like :
>$input = <STDIN>; # maybe <>...
>chomp $input; # remove trailing newline
>
>--
>Sam
>
>People get annoyed when you try to debug them.
> --Larry Wall




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

Date: 3 Dec 1998 01:27:39 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Pattern Matching Question (easy...)
Message-Id: <slrn76bq8b.fm8.sholden@pgrad.cs.usyd.edu.au>

On Wed, 2 Dec 1998 17:16:43 -0800, Alistair Calder <webmaster@topproducer.com>
	wrote:
>Good point, Sam.  Here is my (very newbie) code:
>
>
>#!/perl -w
>
>$searchfile = "c:/gaelic/total.htm";
>$count= 0;
>$gaelic = "";
>$def = "";
>
>$input = <STDIN>;
>chomp $input;
>open (IN, "$searchfile") || die "No input file";
>@data = <IN>;
>close(IN);
>
>print "Attempting to find a match for $input...searching...\n\n";
>foreach $line(@data){
>  chomp $line;
> ($gaelic, $def)= split (/\|/, $line);
> if ($input =~ m/$def/) {

That last line is the problem I suspect.... It will return true if the
definition in the file matches the user input. Assuming there are no 
meta-characters, that means if the definition is a substring of what the user
enters...

What you want is : if ($def=~/$input/) {

You might want case insensitivity as well but that's up to you...

Also if | occurs in $line you might not get exactly what you want...

Try the following to see how you might want to fix that :

$test = "one | two | three";
($g,$d) = split /\|/, $test;
print "$d\n";
($g,$d) = split /\|/,$test,2;
print "$d\n";


-- 
Sam

Just don't create a file called -rf.  :-)
	--Larry Wall


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

Date: Thu, 3 Dec 1998 03:45:15 +0100
From: Mark <admin@asarian-host.org>
Subject: Re: Pattern Matching Question (easy...)
Message-Id: <199812030245.TAA24615@asarian-host.org>

Alistair Calder wrote in message <744opq$jfo$1@supernews.com>...

>Good point, Sam.  Here is my (very newbie) code:
>
>
>#!/perl -w
>
>$searchfile = "c:/gaelic/total.htm";
>$count= 0;
>$gaelic = "";
>$def = "";
>
>$input = <STDIN>;
>chomp $input;
>open (IN, "$searchfile") || die "No input file";

>@data = <IN>;

Hi Alistair. You can also write this line as:

chomp (@data = <IN>);

That will trim all entries of @data all at once. :) It will safe you the
repeated "chomp $line;" further in your code.

>close(IN);
>
>print "Attempting to find a match for $input...searching...\n\n";
>foreach $line(@data){
>  chomp $line;
> ($gaelic, $def)= split (/\|/, $line);
> if ($input =~ m/$def/) {

if ($def =~ m/\Q$input/) {

you probably meant. :) (unless, of course, you allow $input to contain
regular expressions too, in which case you can dump the \Q again).

Still,  if you really have a "gigantic list of words," then I think what you
are really looking for here, is the use of associative arrays (hashes). Erm,
next chapter in the Camel Book. :)

Take care,

- Mark

        System Administrator Asarian-host.org







--
For more information about this posting service, contact:

help@asarian-host.org    -- for instant general information about our services
admin@asarian-host.org   -- for the server's administrator
nclark@asarian-host.org  -- for our PR manager
abuse@asarian-host.org   -- for abuse of this posting service

If you wish to get an anonymous email/posting account, visit our sign-up page:

http://asarian-host.org/emailform.html


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

Date: Thu, 03 Dec 1998 02:12:56 GMT
From: vishalb@my-dejanews.com
To: wkw@htc.com
Subject: Re: perlcc; cc complains about undefined sym "runops"
Message-Id: <744s36$r41$1@nnrp1.dejanews.com>

That was a bug that has been fixed in the newer versions along
with a lot of other bugs. So it would be worthwhile to
try a newer release either 5.005_54 or perl5.00503 +MAINT_TRIAL_1
perlcc is still being developed, but do expect some big improvements in
the next development version.

If you get errors like
1>Modification of read only value
2>Core dumps.

with the latest version, please do report them. If your errors are like

1>Unable to locate method A::B
please be patient for the next version and read the B::CC manpage once again
if you are in a hurry for work around.

In article <7417sk$n0e$1@nnrp1.dejanews.com>,
  wkw@htc.com wrote:
> Hi,
>
> Have been trying to use the long awaited "perlcc", and
> I get the output below, complaining about the undefined
> symbol "runops".  Funny thing is, though I see runops
> references in the Change logs & such, I can't actually
> find a reference anywhere in my foo.pl.c.  Anyone seen this?

It is in the ccruntime.h or some such header file in the pp_eval macro.

>
> Keith
>
> PS:	The Perl version, etc. is ID'd in the output, and the
> 	cc version is Sun's WorkShop Compilers 4.2 30 Oct 1996 C 4.2
>
> 	Any help much appreciated.
>
> ----------------------------------------- Compiling prword.pl:
> -----------------------------------------------------------------------------
> --- Making C(prword.c) for prword.pl! /usr/local/perl5.005/bin/perl
> -I/usr/local/perl5.005/lib/5.00502/sun4-solaris-thread
> -I/usr/local/perl5.005/lib/5.00502
> -I/usr/local/perl5.005/lib/site_perl/5.005/sun4-solaris-thread
> -I/usr/local/perl5.005/lib/site_perl/5.005 -I. -MO=CC,- oprword.c prword.pl
> prword.pl syntax OK Compiling C(prword) for prword.pl!
> /usr/local/perl5.005/bin/perl
> -I/usr/local/perl5.005/lib/5.00502/sun4-solaris-thread
> -I/usr/local/perl5.005/lib/5.00502
> -I/usr/local/perl5.005/lib/site_perl/5.005/sun4-solaris-thread
> -I/usr/local/perl5.005/lib/site_perl/5.005 -I. /tmp/prw ord.pl.tst cc
> -I/usr/local/include -O
> -I/usr/local/perl5.005/lib/5.00502/sun4-solaris-thread/CORE
> /usr/local/perl5.005/lib/5.00502 /sun4-solaris-thread/auto/Fcntl/Fcntl.so -o
> prword prword.c  -L/usr/local/lib -L/usr/local/perl5.005/lib/5.00502/sun4-s
> olaris-thread/CORE -lperl -lsocket -lnsl -lgdbm -ldl -lm -lc -lcrypt
> "prword.c", line 6398: warning: statement not reached "prword.c", line 6940:
> warning: statement not reached "prword.c", line 7031: warning: statement not
> reached "prword.c", line 7380: warning: statement not reached "prword.c",
> line 7439: warning: statement not reached "prword.c", line 7728: warning:
> statement not reached "prword.c", line 8007: warning: statement not reached
> "prword.c", line 8265: warning: statement not reached Undefined  first
> referenced  symbol  in file runops  prword.o ld: fatal: Symbol referencing
> errors. No output written to prword ERROR: In compiling code for prword.c !
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 03 Dec 1998 02:23:55 GMT
From: hbpursle@duke-energy.com (Bryce Pursley)
Subject: pos function - How do you manipulate it?
Message-Id: <366af390.1149121379@news.infoave.net>

Guys (and gals),
Please tell me where else to look or how to do this.

The perlfunc.htm says:

"pos SCALAR 
Returns the offset of where the last m//g search left off for the
variable in question. May be modified to change that offset. "

But I can't figure out how to get it's value or set it's value or,
more importantly right now, reset it to the top of the file.

Bryce


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

Date: Wed, 2 Dec 1998 17:07:57 -0800
From: "Josh Baudhuin" <joshb@cadence.nospamnojunk.com>
Subject: Re: system commands in WinNT
Message-Id: <744o9m$6j6$1@news.cadence.com>

(confused + don't know much about webbie perl)
Do you mean, you're trying to run the script on the client's machine?

darmawan wrote in message <3665D0EE.9034E477@email.com>...
>I am trying to get a script to work on NT but when run through a Web
>page it doeesn't seem to return anything for system calls.
>
>Let's say I have the lines
>
>$version = `ver`;
>print "Version: $version";
>
>somewhere in my script.  When run from the command line I get
>
>Version: Window NT Version 4.0
>
>But when run from a browser I get
>
>Version:
>
>What is the deal?  Is there something, somewhere that needs to be set so
>that the default Web user can reference system commands through scripts?
>
>Thanks
>
>Cliff Corder





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

Date: Wed, 02 Dec 1998 23:59:30 GMT
From: mike808@mo.net
Subject: Re: Trim Functionality ??
Message-Id: <744k91$k8b$1@nnrp1.dejanews.com>

sub alltrim { shift; s/(^\s+|\s+$)//g; }
works for me.

HTH, Michael King

In article <36655c5a.0@news.mediacity.com>,
  "BenJamin Prater" <bprater@jipes.com> wrote:
> I'm pretty darn sure the FAQs explain how to clip leading and trailing
> spaces. Here's a hint: It's not a function, it's a regex (or two).
> Ben
>
> Sunil Karnik wrote in message <3665483B.B9059126@rotfl.com>...
> >Is there any function for trimming the leading and trailing spaces of a
> >string??
> >..something like alltrim(char *) in C ...

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 2 Dec 1998 16:56:55 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Trim Functionality ??
Message-Id: <MPG.10cf81ae322526c59898aa@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <744k91$k8b$1@nnrp1.dejanews.com> on Wed, 02 Dec 1998 
23:59:30 GMT, mike808@mo.net <mike808@mo.net> says...
> sub alltrim { shift; s/(^\s+|\s+$)//g; }
                         ^         ^
       discard an arg!   unnecessary capture

> works for me.
> 
> HTH, Michael King

It's hard to see how that function works for anyone, or can help.

It discards its argument (if any), then operates slowly on the contents 
of $_, and returns a boolean depending on whether the regex succeeded.

As others have said, perlfaq4 "How do I strip blank space from the 
beginning/end of a string?" has the correct (and fastest) solution. 

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


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

Date: Wed, 2 Dec 1998 16:42:13 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: When does CLOSE not FLUSH?
Message-Id: <MPG.10cf7e429bc03abe9898a9@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <3665c98a.1143428@news.skynet.be> on Wed, 02 Dec 1998 
23:36:19 GMT, Bart Lateur <bart.lateur@skynet.be> says...
> Russ Allbery wrote:
> 
> >> Except that it is appending to the file as it stands at the open - it
> >> might be that another process has added to the file between the open and
> >> the lock.
> >
> >No.  That's the whole point of O_APPEND.  O_APPEND does an implicit seek
> >to end of file *before every write to the file*.  So it doesn't matter if
> >the file changes after you opened it; if you opened it with O_APPEND,
> >you'll still be writing to the current end of the file.
> 
> I'd like to believe that.
> 
> Could anybody provide a code snippet that would irrefutably prove that?
> 
> 	Bart.

#!/usr/local/bin/perl -w
use strict;

open FOO, '>foo' or die "Couldn't create 'foo'. $!\n";
print FOO "a\n";
close FOO;

open FOO, '>>foo' or die "Couldn't append to 'foo'. $!\n";
select FOO; ++$|;
print FOO "b\n";

open FOO1, '>>foo' or die "Couldn't append to 'foo'. $!\n";
select FOO1; ++$|;
print FOO1 "c\n";

system "echo d >>foo";

print FOO "e\n";
close FOO;

open FOO, '<foo' or die "Couldn't read 'foo'. $!\n";
print STDOUT <FOO>;
__END__
a
b
c
d
e

Here the main process writes a b and c (on two separate filehandles), 
the shelled process appends d, and the first process appends e.  No 
seeks necessary, and not even a close of the second filehandle (because 
unbuffered).

I don't know about 'irrefutably prove' -- but it seems to work.  Note 
that it doesn't work on Windows NT, because the shell complains:

The process cannot access the file because
it is being used by another process.

and the output contains no 'd' line.

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


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

Date: Wed, 02 Dec 1998 16:36:19 -0800
From: Casey Feskens <feskencj@plu.edu>
Subject: Win32::FileSecurity::Set
Message-Id: <3665DD03.F62660C@plu.edu>

I've been working on a script to read file names from a file and set
permissions to each filename in the datafile.  It seems that the
Win32::FileSecurity::Set function is destroying my ACL hashes,
making recursion a problem.  I've been pulling my hair out over
this one.  Other examples that I've looked at seem to yield the
same results.  This seems to work fine on a single file, or on any
list without domain account names in it.  Is this a problem with the
way the domain names are listed?  I've tried:

'domain\user'
"\\domain\\user"

without any luck.  My scripts and output follows.

Thanks in advance.

Casey Feskens

#--BEGIN--
use Win32::FileSecurity qw (MakeMask Set);

#
#Here are the various permission masks
#

$dir_perms_read     = MakeMask (qw (READ GENERIC_READ GENERIC_EXECUTE));
$dir_perms_full     = MakeMask (qw (FULL GENERIC_ALL));

#
#Users
#
$f = "testuser";
$e = "everyone";
$fD = "\\PLU\\testuser";


#permission hash for RWX on General
$dir_RX{$f} = $dir_perms_read;
$dir_RX{$e} = $dir_perms_read;
$dir_RX{$fD} = $dir_perms_full;


#here's where the work is done
$filename = "d:/scripts/lab/perms/read.txt";
open (FILE, $filename) || die "Can't open file: $filename";
@file = <FILE>;
foreach $file (@file) {

chomp($file);
print %dir_RX,"\n"; #check the hash
print ("Setting permissions on $file.\n");
Set($file, \%dir_RX) || die "Could not set the DACL
for $_: $!\n";
print ("Moving on to next file.\n"."\n");
}
#--END--

And here's the output I get:

testuser-1609432919\PLU\testuser270467583everyone-1609432919
Setting permissions on d:/mock/file3.txt.
Moving on to next file.
testuser-1609432919 PLU\testuser270467583everyone-1609432919
Setting permissions on d:/mock/file2.txt.
(null)\
Error handling error: 1332, LookupAccountName at d:\scripts\lab\cripe.plx
line 33, <FILE> chunk 3.



--
-------------------------------------------------
Casey Feskens
Lab Manager/Software Support Specialist
Computing and Telecommunication Services
Pacific Lutheran University
Tacoma, WA 98447

Phone: (253) 535-7525
Fax: (253) 536-5099
E-mail: feskencj@plu.edu
-------------------------------------------------





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

Date: Thu, 03 Dec 1998 01:57:57 +0100
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: Win32::OLE question--GetActiveObject()
Message-Id: <366adc0c.6071330@news3.ibm.net>

[mailed & posted]

"Josh Baudhuin" <joshb@cadence.nospamnojunk.com> wrote:

>Is there any way of choosing from a set of available instantiated objects of
>a given sort?
>
>I have a script that should open a document in a particular automation host.
>Suppose there are two instances of the automation-server application. If I
>use GetActiveObject() to get an object, it tries to get from the most
>recently-registered automation server, apparently, so I really only am able
>to access one session, which may be the wrong one! D'oh!

This doesn't seem to be possible. The GetActiveObject API (of Win32) only
takes a reference to a class id. It then looks into the Running Object Table
(ROT) to see if any application/object has registered itself there.

I just started two instances of Excel on my computer. I could see two Excel
entries in the ROT, but they seemed to point to the same instance. Anyways,
even when we would try to enumerate the ROT ourselves; how would we
differentiate between instances?

-Jan


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

Date: 3 Dec 1998 00:13:27 GMT
From: gerglery@usa.net (Fluffy)
Subject: Re: win32API module available for Unix?
Message-Id: <744l37$56o$1@meowhost.meow.invalid>

elcaro@my-dejanews.com <elcaro@my-dejanews.com> wrote:
> Does anyone know if the win32API is available for Unix? I've seen
> the module but it seems to be precompiled for i386 and I need to do
> this work under Sun Solaris.

The mind boggles.  On the remote chance that you have some Windows
code that you want to move into an XSUB or something bizarre like
that, here goes....

Bristol Technology <http://www.bristol.com> sells a library called
Wind/U that will let you recompile many windows apps on Unix, VMS or
even mainframes.

For some platforms you could even use SoftWindows
<URL:http://www.insignia.com>.  This is an emulation package, so it's
not really going to let you integrate windows code into a unix app.

For a list of other emulation and source-compatibility products --
mostly free, in varying stages of working-ness -- see
<URL:http://www.winehq.com/others.html> and
<URL:http://www.winehq.com> itself too.



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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

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

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

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 4347
**************************************

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