[10599] in Perl-Users-Digest
Perl-Users Digest, Issue: 4191 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 10 16:07:24 1998
Date: Tue, 10 Nov 98 13:00:19 -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 Tue, 10 Nov 1998 Volume: 8 Number: 4191
Today's topics:
adding \' to a string <ours@casema.net>
Re: adding \' to a string (Tad McClellan)
Re: Can I assign an user account to script??? <ours@casema.net>
Re: Can I assign an user account to script??? <rootbeer@teleport.com>
Re: concurrently writing to a file without doing flock <rootbeer@teleport.com>
Cybercash?? lefkogt.xp@usafa.af.mil
Re: HELP , I just can figure this out <rootbeer@teleport.com>
Re: Help, I'm stuck again (this one may push the envelo <baliga@synopsys.com>
Re: History Lesson... (Geoff Simmons)
Re: Learning Perl by video <uri@fastengines.com>
Re: Learning Perl by video (Ilya Zakharevich)
Re: Not to start a language war but.. (Ilya Zakharevich)
Re: Perl bug? die() and DESTROY (Ilya Zakharevich)
Re: Perl class question jbharvey@corp.home.net
Re: Perl Reg Exp Hanging on NT <rootbeer@teleport.com>
Re: perl2exe <indy@NOSPAMdemobuilder.com>
Re: Perl2exe (Reinoud van Leeuwen)
Re: perlscriptoutput from a perlscript via cgi <rootbeer@teleport.com>
Re: Poll: How Did You Learn Perl? <keithmur@mindspring.com>
Problem access Sun Apache server through Windows IE4 or supradave@earthlink.net
Re: pwd without backticks? <uri@fastengines.com>
Re: pwd without backticks? (Ilya Zakharevich)
Re: Reading binary data from HTTP body <rootbeer@teleport.com>
Re: Reading binary data from HTTP body (Larry Rosler)
Ref: Perl class question xaqtnr@my-dejanews.com
Re: unable to write to MS access database...HELP <ours@casema.net>
Re: Want to learm Perl <perlguy@technologist.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 10 Nov 1998 20:41:36 +0100
From: "Casema" <ours@casema.net>
Subject: adding \' to a string
Message-Id: <72a4vv$fba$1@sun4000.casema.net>
Allright newsies,
If ya got a string say, $name containing "Michel" is it possible to change
the content to:
"\'Michel\'" ????
I know this:
$nam = "\'".$name."\'"
isn't there a bind (=~) that does this?.....
yup, newbie in action, sorry guys.......
thanks for helping,
Michel
------------------------------
Date: Tue, 10 Nov 1998 14:49:56 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: adding \' to a string
Message-Id: <kt8a27.3ad.ln@flash.net>
Casema (ours@casema.net) wrote:
: If ya got a string say, $name containing "Michel" is it possible to change
: the content to:
: "\'Michel\'" ????
: isn't there a bind (=~) that does this?.....
s/^/\\'/; # add to the beginning
s/$/\\'/; # add to the end
or
s/(.*)/\\'$1\\'/s; # both at once
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 10 Nov 1998 21:05:39 +0100
From: "Casema" <ours@casema.net>
Subject: Re: Can I assign an user account to script???
Message-Id: <72a6ct$5nc$1@sun4000.casema.net>
I think, but am not sure, you can read the registry key HKEY_CURRENT_USER to
find who's logged on to the nt system. do not know however if this would be
of any help.
Michel
Vaughn Fox wrote in message <729ok5$f63$1@garnet.nbnet.nb.ca>...
>
>I'm running NT 4.0, service pack 3, IIS 4, and I have a Perl script that
>produces an HTML page that indexes a given directories contents. It's very
>similar to windows explorer in that when you click on a directory you see
>it's contents, or click on a file and up pops the appropriate application.
>
>When I try to get this script to access a restricted area on my Intranet it
>chokes up. I'm assuming it's got to do with the script having the proper
>permissions to read the contents of the folder.
>
>Is there a way to assign a specific user name and password to a script
(with
>correct permissions), or read the requesting client user name from the NT
>logon and tie access back that way?
>
>Thanks
>
>
------------------------------
Date: Tue, 10 Nov 1998 20:20:14 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Can I assign an user account to script???
Message-Id: <Pine.GSO.4.02A.9811101218310.7469-100000@user2.teleport.com>
On Tue, 10 Nov 1998, Vaughn Fox wrote:
> Is there a way to assign a specific user name and password to a script
> (with correct permissions), or read the requesting client user name
> from the NT logon and tie access back that way?
It sounds as if you want to get your system or server to do something when
it runs your program. Perhaps the docs, FAQs, and newsgroups about your
system or server would be helpful. You may wish to see whether NT has some
equivalent of Unix's set-id concept. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 10 Nov 1998 19:48:20 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: concurrently writing to a file without doing flock
Message-Id: <Pine.GSO.4.02A.9811101117450.7469-100000@user2.teleport.com>
On Tue, 10 Nov 1998 ronald_f@my-dejanews.com wrote:
> What is the worst thing that can happen when several processes print
> to the same file, without using flock, every print writes exactly one
> line, and the file handles are set to unbuffered?
The worst thing? Here's the worst I can think of.
An urgent message comes in to the NSA from a branch office of the CIA. It
turns out that Ginger Spice has just discovered the secret files with the
true story of the assassination of JFK, as well as an inventory of Area
51, the hiding place of a sasquatch family, and the real reason that the
Olsen twins have another TV show. If she's not stopped, she will use this
information to force her way into the UN, then work secretly behind the
scenes to force Newt Gingrich out of office, leak internal memos from
Microsoft, and give Alanis Morrisette an uncontrollable desire to run
around naked on MTV. Ginger's evil activities will go undetected because
thousands of people will be talking about putting on ape suits and burying
the Statue of Liberty up to the neck before John Glenn returns.
Alas, because some programmer failed to properly use flock, the message is
over-written by some message asking what colors an iMac comes in. The end
of the world comes shortly thereafter.
Don't let this happen to you; always use flock when several processes need
to access the same file. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 10 Nov 1998 19:32:47 GMT
From: lefkogt.xp@usafa.af.mil
Subject: Cybercash??
Message-Id: <72a4cv$vev$1@nnrp1.dejanews.com>
Any PERL scripts available for use with Cybercash? PERL modules for
Cybercash? Any consultants with PERL, flatfile ASCII database management or
MySQL, authentication in conjunction with DB access and Cybercash experience?
Concept:
Classified Ads Database Website (We sell ads ONLY).
Sellers can add/delete OWN (authentication) purchased ads (through CYBERCASH).
Buyers can view database to purchase. Items are not SOLD by this site only
the ads are. Sellers/Buyers exhcnage through email/phone, we are NOT
involved.
Gary
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 10 Nov 1998 20:45:21 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: HELP , I just can figure this out
Message-Id: <Pine.GSO.4.02A.9811101234430.7469-100000@user2.teleport.com>
On Tue, 10 Nov 1998, Darrin Edwards wrote:
> > > $CMD->Parameters("lname")->{value}=$linesin{$lname};
> If the value of "exists($linesin{$lname})" were false, couldn't
> that also have produced the "Use of uninitialized value at..." error?
Well, it would mean that the statement would be trying to assign a value
of undef, but that's not going to trigger a warning. That particular
warning that you're talking about should happen only with actual _use_ of
the value in an expression, where the undef needs to be converted to
either '' or 0. And, at that, Perl should recognize several legitimate
uses for undefined (values from) variables, and not complain.
$count++;
$sum += 4;
$page .= "another line\n";
read(FH, $buffer, 1024);
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 10 Nov 1998 11:41:46 -0800
From: Yogish Baliga <baliga@synopsys.com>
To: Rusty Williamson <rwilliamson@uno.gers.com>
Subject: Re: Help, I'm stuck again (this one may push the envelope)
Message-Id: <364896FA.C301C70E@synopsys.com>
open( FILEFP, "arm_controls.h" ) || die "Cannot Open File arm_controls.h \n";
@lines = <FILEFP>;
@match=grep /^start_'/i, @lines;
foreach ( @match ) {
( $l1, $l2 ) = split /=/, $_;
$hash{$l1} = "$l2";
}
-- Baliga
Rusty Williamson wrote:
> Hi!
> I'm finding that sometimes its the simple things that hurt (well, simple to
> most UNIX buffs), like how do you do the equivalent of:
>
> #!/bin/sh
> ...
> grep -i '^start_' | awk -F\" '{print $1 "," $2}'
> ...
>
> I'm searching a file (arm_controls.h) for stuff like:
> START_ARMFS="true"
>
> and want to wind up with a hash containing:
> START_ARMFS, true, .....
>
> This is embarrassing!
>
> Rusty
------------------------------
Date: Tue, 10 Nov 1998 21:36:41 +0100
From: g.simmons@elmshorn.netsurf.de (Geoff Simmons)
Subject: Re: History Lesson...
Message-Id: <g.simmons-1011982136420001@e4-02.shlink.de>
In article <3647BD5C.F4CB73D3@cgo.wave.ca>, Toni-Lynn Hamilton
<tonilynn@cgo.wave.ca> wrote:
> I'm doing a group presentation at school on Perl and I have been elected
> to find the history of Perl. I checked out the one FAQ and it has
> Perl's physical history, release dates and updates but it is not exactly
> what I'm looking for.
Well, this may not be much use to you either, but all of the major
releases of Perl starting from version 1.0, and what appears to be an
early Usenet message in which Larry Wall introduced the language, can be
found at:
http://www.leo.org/pub/comp/programming/languages/script/perl/oasis/src/index.html
Best,
Geoff
------------------------------
Date: 10 Nov 1998 14:46:20 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: Learning Perl by video
Message-Id: <sarogqf9vqr.fsf@camel.fastserv.com>
>>>>> "s" == scott <scott@softbase.com> writes:
s> Different people learn in different ways. For a good treatment of this,
s> read Tony Robbins' two books. He has an approachable, non-academic
s> explanation of all this. Basically, there are three orientations --
s> visual, audio, and touch -- a person may have. One usually
s> predominates. Another is usually secondary.
other cognitive theories cover this as well. NLP (neuro-linguistic
programming), PP (perceptual processing) are among them. the whole
concept is part of what i posted recently about the psychology of
coding. this is partly why people may prefer different languages. verbal
types may like the wordiness of python and visual types may like the
funny chars of perl.
uri
P.S. however useful robbins is, i can't go near any of his stuff until he
stop grinning like a horse. :-)
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: 10 Nov 1998 20:09:31 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Learning Perl by video
Message-Id: <72a6hr$1h4$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Casper Kvan Clausen
<ckc@dmi.dk>],
who wrote in article <Pine.GSO.3.92.981110152817.17940K-100000@edb>:
> On Tue, 10 Nov 1998, Brent Michalski wrote:
>
> > Honestly, if you go through the books and DO the example programs, that
> > is probably the __best__ training you can get. Pick a small project and
> > then do it, learning along the way. Once you have that done, find a
> > more difficult project.
>
> I agree with this, but in addition I am unable to see what good a Perl
> video would do. How could seeing someone type in a program and run it be
> better than either typing it in yourself or downloading it, and then
> running it?
perl -d
comes to mind. It (and many jems half-hidden in perldebug) would
benefit from a visual presentation - not necessarily a video.
Similar for CPerl mode. (Oups, it is transforming in a shameless plug
- imagine my headflora on video. ;-)
Ilya
------------------------------
Date: 10 Nov 1998 20:05:10 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Not to start a language war but..
Message-Id: <72a69m$1aa$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Tom Christiansen
<tchrist@mox.perl.com>],
who wrote in article <729lg7$76$1@csnews.cs.colorado.edu>:
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, Klaus Schilling <Klaus.Schilling@home.ivm.de> writes:
> :Perl lacks an equivalent to Scheme's call-with-current-continuation .
> :(and so do python and tcl)
>
> What's your point? Scheme also lacks ...
Tom, I think the point was absolutely clear. It was an interesting
answer for an interesting question.
> It is not helpful to expect all tools to do all things in all ways,
Right, but it *is* helpful to expect this from Perl ;-).
> On the other hand, I frequently find myself wanting python to support
> scheme's or perl's closures so that callbacks can be properly scoped.
Tom, you still remember the time one month before closures were added
to Perl? A lot of proponents were explaining that we *can* live
without this feature. (I would quite expect you to be in that camp ;-).
I *needed* callcc (*inside* perl, not in Perl) to implement (?p{}) in
REx engine. (I found a dirty workaround, so it works now - thanks,
Hugo). I would imagine that some problems would be solved much easier
if callcc were available in Perl.
However, I never got such an insight about any particular problem,
maybe because my vague familiarity with callcc.
Ilya
------------------------------
Date: 10 Nov 1998 19:50:53 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl bug? die() and DESTROY
Message-Id: <72a5et$j4$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was NOT sent to Kevin Reid
<kpreid@ibm.net>],
who wrote in article <1di8g70.c9l1he1nq3fpsN@slip166-72-108-36.ny.us.ibm.net>:
> I think I have found a bug in Perl: die() does not print out any message
> when called inside a DESTROY block.
It is a (mis)feature.
> IMHO, die() ought to print out its message in DESTROY.
IMO, too.
Ilya
------------------------------
Date: Tue, 10 Nov 1998 20:56:36 GMT
From: jbharvey@corp.home.net
Subject: Re: Perl class question
Message-Id: <8M122.786$3o4.3014583@news.rdc1.sfba.home.com>
See comments below...
xaqtnr@my-dejanews.com wrote:
> This is my first adventure into Perl classes and such. I have printed several
> online references for this and still can't get what I want. I've checked out
> 'perltoot - Tom's object-oriented tutorial for perl' and all the info found at
> www.stonehenge.com/merlyn/UnixReview/.
> My question is this... how do you get the value of a reference if it is in
> another sub-routine (not sure if my terminology is correct here?). Here is the
> code I am working with:
> package SystemVars;
> sub new{
> my $class = shift;
> my $self = { };
> bless ($self, $class);
> $self->{df} = { };
^^^^^^^^^^^^^^^^^^^^^^
Shouldn't need this.
> return $self;
> }
> sub df{
> my $self = shift;
> @data = `df`;
> shift(@data);
> while (@data){
> $line = shift(@data);
> $line =~ s/\s+/ /g;
> ($file_sys,$k_blocks,$used,$avail,$capacity,$mounted_on) = split (/
> /,$line);
> $self->{df}->{FILE_SYS} = $file_sys;
> $self->{df}->{K_BLOCKS} = $k_blocks;
> $self->{df}->{USED} = $used;
> $self->{df}->{AVAIL} = $avail;
> $self->{df}->{CAPACITY} = $capacity;
> $self->{df}->{MOUNTED_ON} = $mounted_on;
> }
> return $self;
> }
> I can get a hash reference, but no value if I do the following:
> #!/usr/bin/perl5
> use SystemVars;
> print"Content-type: text/html\n\n";
> $vars = SystemVars->new();
> $fs = $vars->df(FILE_SYS);
Why are you referring to it with ()'s? What about $vars->{df}->{FILE_SYS} ?
Also it's helpful when dealing with problems like this to use the debugger
so you can mess around with your references as well as manipulate variables/
data structures without having to run the program over and over.
j
> print"FS => $fs<br>";
> This gives me the following: FS => SystemVars=HASH(0x74048)
> What I really want if the value that is stored in $file_sys.
> What am I doing wrong here? Any help is definitely appreciated.
> Thanks in advance.
> --
> Shay
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
--
Justin B. Harvey @Home Network
@Work Software Engineer 425 Broadway
jbharvey@corp.home.net Redwood City, CA 94063
Voice: (650) 569-5692 http://www.home.net
------------------------------
Date: Tue, 10 Nov 1998 20:52:26 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl Reg Exp Hanging on NT
Message-Id: <Pine.GSO.4.02A.9811101248150.7469-100000@user2.teleport.com>
On Tue, 10 Nov 1998 RoyStephan@yahoo.com wrote:
> s/<a\s+href="(http.*?)".*?>([^<]*?)<.*?<br>(.*?)<.*?(\d\d\d?)%.*?(\d\d) .(\w\w\w) .(\d\d)//si)
Ook!
> Unfortunately there are *some* html pages which cause the regular
> expression to hang.
>
> Has anyone ever had a regular expression simply not return?
No, but some can take longer to finish than the expected lifetime of the
programmer, the hardware, or the universe. I suspect that yours is such a
pattern. See the "Hip Owls" book (Mastering Regular Expressions, by
Jeffrey Friedl) for more information on that.
But in any case, you don't want to use anything that "simple" to work with
HTML; you need a real parser. Try HTML::Parser from CPAN. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 10 Nov 1998 14:08:09 -0500
From: "Indy" <indy@NOSPAMdemobuilder.com>
Subject: Re: perl2exe
Message-Id: <72a2hd$qsf$1@nntp2.uunet.ca>
Perl2Exe can be found at www.perl2exe.com it is not the same as 'pl2exe'
which is activestate's implementation.
Indy
Marek Trabalka wrote in message <363b9df7.0@206.58.152.195>...
>Perl2Exe is also part of a package Per Development Kit
>Beta version of 1.1 is available for free at
>http://www.activestate.com
>
>Commitman wrote in message <70nk09$fk2$1@srv4-poa.nutecnet.com.br>...
>>Where may I found something like perl2exe or perl2c ???
>>
>>
>>
>
>
------------------------------
Date: Tue, 10 Nov 1998 19:31:07 GMT
From: reinoud@xs4all.nl (Reinoud van Leeuwen)
Subject: Re: Perl2exe
Message-Id: <36499458.864503@news.xs4all.nl>
On Sat, 7 Nov 1998 13:49:49 -0000, "Chris Liley" <yk08@dial.pipex.com>
wrote:
>Trying to use Perl2exe I keep getting the error message:
>
>Warning: module Carp not found
>Make sure that the perl\bin directory is in your path
>
>My path is as follows:
>PATH=C:\PERL\5.005\BIN\MSWIN32-X86-OBJECT;C:\PERL\5.005\BIN;C:\WINDOWS;C:\WI
>NDOWS\COMMAND
>
>Which I think includes the relevant perl\bin !
>
>Further the script runs fine prior to compiling so Perl knows where to find
>the modules. The modules are included via the "USE" statement.
>
>Is the directory your are in when calling perl2exe relevant ? I am calling
>it from the directory I keep the script in, should I be in the BIN directory
>?
Are you using win95? I don't know wheter this is supported.
__________________________________________________
"Nothing is as subjective as reality"
Reinoud van Leeuwen reinoud@xs4all.nl
http://www.xs4all.nl/~reinoud
__________________________________________________
------------------------------
Date: Tue, 10 Nov 1998 20:47:31 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: perlscriptoutput from a perlscript via cgi
Message-Id: <Pine.GSO.4.02A.9811101246470.7469-100000@user2.teleport.com>
On Tue, 10 Nov 1998, Seneca wrote:
> open(TEXT, "<testtext.txt");
Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 10 Nov 1998 14:55:37 -0600
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: Poll: How Did You Learn Perl?
Message-Id: <3648A849.386C7408@mindspring.com>
Sorry I missed replying to the poll. So you got no entries for the
Gecko (Learning Perl on Win32 Systems)? That was my first resource.
(Sorry, Unix-heads.)
John Porter wrote:
>
> John Porter wrote:
> >
> > So here's a poll for everyone.
> > From what resource(s) did you learn Perl?
>
> You all may recall this poll I posed a little while back.
> Well I've gone to the trouble of tallying up the results,
> and here they are. Note that the categories are not exact;
> in particular, I have attempted to guess whether the code
> people studied was from the distribution or outside sources.
> Maybe we should ignore that one.
> In fact these results are almost meaningless, because it was
> never clear what I meant by "learn[ing] Perl".
> What I was really after was some comparative usefulness of
> different resources for the very rank beginner; clearly
> all of us are still in the process of learning Perl.
>
> Many people indicated that writing code was a significant
> part of their education. I think that is universal, and
> so is not reflected here.
>
> Docs in the distribution : 37
> Programming Perl v.2 (Blue Camel) : 21
> Programming Perl v.1 (Pink Camel) : 20
> Newsgroup : 19
> Studying code in the distribution : 17
> Tutorial on the WWW : 15
> Studying code NOT in the distribution : 12
> Learning Perl v.1 (Pink Llama) : 11
> Learning Perl v.2 (Blue Llama) : 8
> Mastering Regular Expressions : 6
> Teaching or Writing about it : 4
> Advanced Perl Programming : 3
> The Perl Cookbook : 3
> Effective Perl Programming : 2
> Studying the perl source code : 2
> Learn Perl in 21 Days (Till) : 2
> Perl 5 Quick Reference : 1
> Perl 5 Interactive Course (Orwant) : 1
> Commercial class : 1
> Personal tutor : 1
> University class : 0
>
------------------------------
Date: Tue, 10 Nov 1998 19:33:12 GMT
From: supradave@earthlink.net
Subject: Problem access Sun Apache server through Windows IE4 or Netscape
Message-Id: <72a4do$vfa$1@nnrp1.dejanews.com>
In my perl script, I have a line:
print `/usr/local/bin/ldapmodify -h server -D "cn=root, o=company, c=us" -w
password -f tmp/$file > /dev/null`;
If I use a UNIX browser, this works fine. If I use a Windows browser, it
appears to execute, indicates that it executed but does not.
Are there any timing related issues with Windows browsers accessing an Apache
server? I can't seem to find anything wrong with my script because it works
on UNIX.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 10 Nov 1998 14:41:44 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: pwd without backticks?
Message-Id: <sarr9vb9vyf.fsf@camel.fastserv.com>
>>>>> "BL" == Bart Lateur <bart.mediamind@ping.be> writes:
BL> Uri Guttman wrote:
>> the correct answer to get cwd in perl is:
>>
>> use Cwd ;
>>
>> $cwd = cwd ;
BL> Too bad we need the "use Cwd". I think that cwd should have been a Perl
BL> primitive. Oh well.
the problem is that there are several different underlying calls and
algorithms that can be made to get the wd. in fact that is why it is not
a system call but a library routine on unix. read the Cwd docs and see
the other flavors. some may be aster but less accurate. the module give
you the choice while a builtin wouldn't.
the pwd program just calls the same library routine and prints the
result. the big win here is no fork.
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: 10 Nov 1998 19:55:56 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: pwd without backticks?
Message-Id: <72a5oc$rc$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Uri Guttman
<uri@fastengines.com>],
who wrote in article <sarr9vb9vyf.fsf@camel.fastserv.com>:
> the problem is that there are several different underlying calls and
> algorithms that can be made to get the wd. in fact that is why it is not
> a system call but a library routine on unix. read the Cwd docs and see
> the other flavors. some may be aster but less accurate. the module give
> you the choice while a builtin wouldn't.
>
> the pwd program just calls the same library routine and prints the
> result. the big win here is no fork.
AFAIU, on many systems you cannot find cwd without being a superuser
:-(. Thus on many systems pwd() *will* fork and do `cwd`, which is
suid. Same with Cwd::cwd().
Ilya
------------------------------
Date: Tue, 10 Nov 1998 20:16:21 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Reading binary data from HTTP body
Message-Id: <Pine.GSO.4.02A.9811101209480.7469-100000@user2.teleport.com>
On 10 Nov 1998, Ron Katz wrote:
> I am reading an HTTP response using straight PERL (no modules).
Do you also make all your own clothes in a log cabin you built with a
hand-made axe? :-) There's no special joy or honor in avoiding the use of
helpful modules.
> When the message body is binary, I am reading the headers using angle
> brackets,
Don't use the line input operator to read binary files; use read() or
sysread() instead. (It's a binary file even if part of it is text.)
> I see in the book that it is not good to combine reads and sysreads on
> the same filehandle.
Right. So pick one, and use it consistently. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 10 Nov 1998 12:45:32 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Reading binary data from HTTP body
Message-Id: <MPG.10b245c56de26b7f989867@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <Pine.GSO.4.02A.9811101209480.7469-100000@user2.teleport.com>
on Tue, 10 Nov 1998 20:16:21 GMT, Tom Phoenix <rootbeer@teleport.com>
says...
...
> Don't use the line input operator to read binary files; use read() or
> sysread() instead. (It's a binary file even if part of it is text.)
I have "binary" files where each entry ("line") comprises four bytes
that are the binary encoding of an unsigned long integer, followed by
"normal" ASCII data, followed by a newline. I read the integer using
read FILE, $int, 4;
$int = unpack 'N', $int;
and then read the rest of the entry using
$rest = <FILE>;
with suitable checks for end-of-file on each read.
This seems to work fine on both Unix and Win32 (using binmode because of
Win32, of course).
Is the ice thin here? It seems solid to me.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 10 Nov 1998 18:55:54 GMT
From: xaqtnr@my-dejanews.com
Subject: Ref: Perl class question
Message-Id: <72a27q$tlm$1@nnrp1.dejanews.com>
In my first post on this topic, I failed to be more patient and I ended up
being able to figure out what I had asked so my apologies for that. I do have
another question related to the same topic... I originally could not get
anything but a hash reference for the following code (which works now):
package SystemVars;
sub df{
my $self = shift;
my $line_ref = shift;
@data = `df`;
shift(@data);
$x = 0;
while (@data){
$line = shift(@data);
$line =~ s/\s+/ /g;
($file_sys,$k_blocks,$used,$avail,$capacity,$mounted_on) = split (/
/,$line);
$self->{df}->{FILE_SYS} = $file_sys;
$self->{df}->{K_BLOCKS} = $k_blocks;
$self->{df}->{USED} = $used;
$self->{df}->{AVAIL} = $avail;
$self->{df}->{CAPACITY} = $capacity;
$self->{df}->{MOUNTED_ON} = $mounted_on;
if ($x == $line_ref){
return $self->{df}->{$_[0]};
last;
}
$x++;
}
}
using the following to call it:
#!/usr/bin/perl5
use SystemVars;
print"Content-type: text/html\n\n";
$vars = SystemVars->new();
$fs = $vars->df(0,FILE_SYS);
print"FS => $fs<br>";
This does return a value, and even the value I want, but if I change the '0'
to a '1' to specify I want the value for the second line returned, it returns
'0' (same with '2', '3', etc).
Here is the ouput I am working with:
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/sd0s1a 98479 72691 17910 80% /
/dev/sd0s1e 49231 2992 42301 7% /home
/dev/sd0s1f 794783 503754 227447 69% /usr
/dev/sd0s1g 3036014 14940 2778193 1% /var1
/dev/sd1s1e 4106701 166666 3611499 4% /var2
procfs 4 4 0 100% /proc
Anyone have a suggestion/solution? It's probably fairly simple, but my brain
hurts from trying to get this thing working. This is my first attempt to work
with classes so it's quite a challenge. A little boost of knowledge would be
greatly appreciated.
Thanks.
--
Shay
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 10 Nov 1998 21:01:12 +0100
From: "Casema" <ours@casema.net>
Subject: Re: unable to write to MS access database...HELP
Message-Id: <72a64i$24g$1@sun4000.casema.net>
Worked!!! I kept reading over and over and simply didn't see it....
thanks,
Michel
Now, another one:
$a = "michel";
$b = "wouterse";
$sql = "INSERT INTO form (lastname, firstname) VALUES ($a, $b)";
above line wants the \' \' in the strings....is there a quick way to do
this?
thanks,
Michel
Brent Michalski wrote in message <36487661.62EF0201@technologist.com>...
>Instead of:
>> $sql = "INSERT INTO form ('lastname') VALUES ('Smith');";
>
>Try:
> $sql = "INSERT INTO form (lastname) VALUES ('Smith')";
>
>It works on my system...
>
>Good luck!
>Brent
>--
>Java? I've heard of it, it is what I drink when I am hacking Perl. -me
>$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
>$ Brent Michalski $
>$ -- Perl Evangelist -- $
>$ E-Mail: perlguy@technologist.com $
>$ Resume: http://www.inlink.com/~perlguy $
>$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
Date: Tue, 10 Nov 1998 18:32:43 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Want to learm Perl
Message-Id: <364886CB.3AE33E2B@technologist.com>
Try looking at:
http://www.perl.com
- or -
http://www.cgi-resources.com
Both have tutorials and tons of Perl code samples/programs.
You have made a wise decision with Perl :-)
Good luck!
Brent
--
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Brent Michalski $
$ -- Perl Evangelist -- $
$ E-Mail: perlguy@technologist.com $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
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 4191
**************************************