[7864] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1490 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 17 16:07:19 1997

Date: Wed, 17 Dec 97 13:01:39 -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, 17 Dec 1997     Volume: 8 Number: 1490

Today's topics:
     Re: Newbie question.   Do you recommend moving from C? <sosman@terratron.com>
     Output redirection under NT <uwe@kwu.siemens.de>
     Re: Perl5 & win 95 (Neil Burnett)
     Re: Random access read/write possible in Perl? (Honza Pazdziora)
     Re: references to globalise locally generatied filehand <tchrist@mox.perl.com>
     Re: Substitute without exceeding a defined string lengt (Honza Pazdziora)
     Re: Teaching programing <dformosa@st.nepean.uws.edu.au>
     Re: Wacky idea: a PERL server <dsill@sws5.ctd.ornl.gov>
     What kind of machine wouldn't support FLOCK? <VikR@aol.com>
     Re: where did the newline come from? <$_=qq!fearless\@NOSPAMio.com!;y/[A-Z]//d>
     Re: Which language pays most 17457 -- C++ vs. Java? <osvaldo@visionnaire.com.br>
     Win32::ODBC  --->  "Fetch error: 911[Microsoft][ODBC Dr (Poul Kornmod)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 17 Dec 1997 10:45:07 -0500
From: "Steven Osman" <sosman@terratron.com>
Subject: Re: Newbie question.   Do you recommend moving from C?
Message-Id: <678saj$j6m@usenet43.supernews.com>

You would use the Java Activator is if you need 1000000% JDK 1.1 compliance
really, it's not something that needs to be downloaded by everyone.

Quite frankly, I'm working on a rather complex JDK 1.1 system, and I ran
into only one thing that I really, REALLY can't stand, but make do without
(it's that Netscape doesn't support multiple archives using the ARCHIVE=
parameter in the APPLET tag).

On the bright side, both Navigator AND Internet Explorer cache the jar
files, so if you do in fact have to package everything into a big fat
archive, it doesn't need to be downloaded EACH time someone hits the site.

Aside from that, unless you're using some hefty heavy-duty JDK 1.1 stuff
which most of the world won't use, you don't need to worry about compliance
from browsers, and furthermore, you can even stick to JDK 1.02 stuff and
support EVERYONE with a java-capable browser, including Mac and UNIX
clients.

Steven Osman

opthalamion wrote in message <349064EE.167EB0E7@pobox.com.unspam>...
>Jason Smith wrote:
>>
>>   The transition to
>> Java 1.1 is under way, 1.2 is just around the corner, and 2.0 is slated
for
>> sometime next year.  During this time, it will be difficult to write once
>> and run anywhere at all
>
>As mentioned elsewhere, Sun now provides a plug-in for Netscape and
>Explorer which allow those browsers to run Java code correctly:
> http://java.sun.com/products/activator
>
>Anyone using java on a webpage should provide an "install Java"
>link, IMHO, and every managed network should be upgraded ASAP.





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

Date: Wed, 17 Dec 1997 10:30:35 +0100
From: Uwe Mirk <uwe@kwu.siemens.de>
Subject: Output redirection under NT
Message-Id: <34979BBB.527BF402@kwu.siemens.de>

I have the following problem:

A simple perlscript called foo.pl prints some text

calling this script from the command line by typing foo.pl, everything
works fine
(*.pl files are correctly associated)

But now .....
i want the output in a file.
typing foo.pl > foo.out creates an e m p t y file
typing perl foo.pl > foo.out creates a file w i t h some text

I' m running NT 4 SP3 and perl 5 build 313
TIA
--
Aloha ! rust@death never sleeps !

Uwe Mirk, Webmaster Siemens AG KWU
Freyesleben Str. 1
91058 Erlangen
Voice: +49 9131 18 5885
Email: Uwe@kwu.siemens.de




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

Date: Wed, 17 Dec 1997 19:42:57 GMT
From: spectd@horus.sara.nl (Neil Burnett)
Subject: Re: Perl5 & win 95
Message-Id: <33b2bfea.2765339@news.eunet.be>

On Mon, 23 Jun 1997 16:18:02 GMT, shelle@interaccess.com (Shelle)
wrotz:

>In article <01bc7fe9$2161db20$960010ac@cbtsys1.dublin2>, "Philip Smith" <arthur_dent@rocketmail.com> wrote:
>>sorry for asking a stupid question, but maybe someone can help?
>>
>>I need to know how to change the registry settings so my server can
>>recognize perl. Does anyone have any suggestions?
>>
>>My server is Personal Web server for Windows 95.
>
>That wasn't that easy to figure out from their documentation...I had the same 
>problem.  Here's an example of what my registry looks like:
>
>*** begin sample***
>[HKEY_LOCAL_MACHINE\SOFTWARE\ActiveWare\Perl5]
>"BIN"="C:\\Perl\\bin"
>"PRIVLIB"="C:/perl/lib/"
>"HTML-DOCS"="C:\\Perl\\docs"
>"WIN95SHELL"="c:\\perl\\bin\\cmd32.exe"
>
>*** end sample***

I am confused as mine works fine with just the following:


[HKEY_LOCAL_MACHINE\SOFTWARE\ActiveWare\Perl5]
"BIN"="C:\\Perl\\bin"
"PRIVLIB"="C:\\Perl\\lib"
"HTML-DOCS"="C:\\Perl\\docs"

The double slashes are there because I have exported the Registry key.
In the Registry itself they are single forward slashes.

A problem I am having though is with Perl such as:

$string = `dir`;

which works fine on my machine at home (Registry as above), but not on
a (more modern W95) version at the office. I have even nobbled my
Cmd32.exe at home by calling it xxCmd32.exe and backticks still work.

Regards - Neil

>
>This of course assumes that you have installed your Perl program in the 
>directory C:\Perl (Change that if your installed somewhere else of course.).  
>
>Something to beware of Part I: The double slashes ("\\") do indeed seem to be 
>necessary.
>
>Something to beware of Part II: You will note that the PRIVLIB key uses the 
>slash as UNIX does ("/") rather than "\" or "\\" as used in the other keys; 
>This solved many problems for me - It may or may not work that way on your 
>machine.
>
>Something to beware of Part III: To add additional libraries paths to your 
>"PRIVLIB" key, use a semi-colon to separate the paths.  For example: 
>"PRIVLIB"="C:/perl/lib/;C:/win32app/perl-extra-libs/prod/override;C:
>/win32app/perl5/lib;C:/win32app/perl-extra-libs/prod/adhoc;C:
>/win32app/perl-extra-libs/prod/standard;"
>
>Luck!
>
>Michelle ----,-'-(@
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Michelle Feigen      ----,-'-(@      shelle@interaccess.com
>                     MEAN PEOPLE SUCK!    
>          http://homepage.interaccess.com/~shelle/
>       http://homepage.interaccess.com/~shelle/grafx/       
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



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

Date: Wed, 17 Dec 1997 15:36:42 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Random access read/write possible in Perl?
Message-Id: <adelton.882373002@aisa.fi.muni.cz>

hagani@worldnet.att.net writes:

> Is there any way to perform a RANDOM ACCESS read or write in a perl
> script?  I know how to do sequential reads/writes, but they are far
> less efficient in many cases (eg., i want to read only the last XX
> bytes of a file)....

You seek using seek, read using read and print to file using print.
Man pages perlfunc explains a lot about each of these.

Hope this helps,

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: 17 Dec 1997 17:11:19 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: references to globalise locally generatied filehandles
Message-Id: <67913n$22j$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    fischman@dfki.uni-sb.de (Matthias Fischmann) writes:
:Any hackers with experience in references out there?
:
:I just tested a small example from perldata(1), but didn't
:manage to make it run. what I need is a subroutine that get's
:a filename and returns a filehandle (actually, it is a little
:more complicated, but the problem lies here).
:
:        sub newopen {
:             my $path = shift;
:             local *FH;  # not my!
:             open (FH, $path) || return undef;
:             return \*FH;
:         }
:         $fh = newopen('/etc/passwd');

The bug is the backslash there in the return.  Although 
when I first wrote that code it worked fine, for reasons
that are less than perfectly clear, it now has to be 
return *FH instead.  The Camel and manpages have been 
corrected, but perhaps you were reading something old.

You might want to consider doing 

    use Symbol;
    $fh = gensym();

Check the manpage on the standard Symbol manpage.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


A woman needs a little more weird today than normal.  --Andrew Hume


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

Date: Wed, 17 Dec 1997 12:18:58 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Substitute without exceeding a defined string length
Message-Id: <adelton.882361138@aisa.fi.muni.cz>

Dirk Kassner <kassner@intershop.de> writes:

> Salute
> 
> I want to quote some sql wildcards in a string for a sql query:
> 
>     my ($SqlParameter) = 'Roedel_Doedel%';
> 
>     $SqlParameter =~ s/([_%\^\[\]])/[$1]/g;  # results in
> 'Roedel[_]Doedel[%]'
> 
> But the result of this substitution should not exceed a defined length,
> that means, I want do all possible replacement and interrupt if the
> length is reached
> (to leave more wildcards unquoted):
> 
>     1 while (length($SqlParameter) < $LENGTH and s/([_%\^\[\]])/[$1]/); 
>     # don't work but make clearer what I mean may be
>     # (because the chars are still in the string and would be replaced
> again and again)
> 
> The resulting string than could look like: 'Roedel[_]Doedel%' if the
> last wildcard
> couldn't be substituted.

How about

my ($SqlParameter) = 'Roedel_Doedel%';
$SqlParameter =~ s/([_%\^\[\]])/length $` > 8 ? $1 : "[$1]"/ge;
print "$SqlParameter\n";
__END__

Hope this is what you need,

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: 17 Dec 1997 11:55:53 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Teaching programing
Message-Id: <882359752.228177@cabal>

In <m37m95l0rh.fsf@windlord.Stanford.EDU> Russ Allbery <rra@stanford.edu> writes:

>? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au> writes:

>> The persence of a garbige collector [...] aid the new
>> learner.  

>I'll agree with most of that, but the presence of a garbage collector
>tends to make programmers lazy about memory issues (since they don't have
>to think about them).

While this is true,  I don't see why I should have to do something that
the computer could do just as well.  In fact in meany cases better then
what the programmer could.

>As long as you intend to stick with programming
>languages with GC, that's fine, but it makes for drastic culture shock
>when you start trying to use C.

Of cause you can learn how to do memoury manigment when it becomes
neccery.  But because of the lack of a GC my C will always be more buggy
then more mature languges.

[...]

>I knew LISP, sed, some awk, C, C++, and a few other things before I ever
>learned Perl, and found that prior experience valuable in choosing what
>dialect of Perl I wanted to speak for a particular problem.)

Is it just me or are most perlers are quite polyliguial.  Thay seem to
have a great number of langugers under there belt.


--
Please excuse my spelling as I suffer from agraphia see the url in my header. 
Never trust a country with more peaple then sheep. I do not reply to mungged 
Support NoCeM http://www.cm.org/                   addresses.  
I'm sorry but I just don't consider 'because its yucky' a convincing argument


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

Date: 17 Dec 1997 13:09:05 -0500
From: Dave Sill <dsill@sws5.ctd.ornl.gov>
Subject: Re: Wacky idea: a PERL server
Message-Id: <wx0n2hzkfjy.fsf@sws5.ctd.ornl.gov>

Tom Christiansen <tchrist@mox.perl.com> writes:

> $ man perlembed

Hmm, didn't know about that. Pretty cool. Not as transparent as a
server but more practical.

-- 
Dave Sill <dsill@sws5.ctd.ornl.gov>        <URL:http://web.infoave.net/~dsill>
Lockheed Martin Energy Research   Oak Ridge National Lab   Workstation Support
Take the qmail Challenge. See <URL:http://web.infoave.net/~dsill/qmail.html>


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

Date: Wed, 17 Dec 1997 10:44:02 -0800
From: Vik Rubenfeld <VikR@aol.com>
Subject: What kind of machine wouldn't support FLOCK?
Message-Id: <34981D71.7474A6BF@aol.com>

The camel book says "Invoking flock will produce a fatal error if used on a
machine that doesn't implement flock(2) or emulate it through someother
locking mechanism." What kind of machine wouldn't implement or emulate flock?
And, how common is it for a machine not to support flock? Thanks very much in
advance to
all for any info.

- Vik


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

Date: Tue, 16 Dec 1997 13:22:13 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/[A-Z]//d>
Subject: Re: where did the newline come from?
Message-Id: <676rkm$pam@news.microsoft.com>


oberon wrote in message <3496EE62.3D9CCCDA@nospam.erols.com>...
>I've got a script, with the following code fragment in it:
>
>$num_date = <STDIN>;
>($num_month = $num_date) =~ s/^(\d+) \d{4}/$1/;
>


<snip>

> yeah, this whole problem goes away if I
>chomp $num_month.

You just answered your own question!

When you get $num_date from STDIN it has an appended newline. So, in the
regex above, substituting the regex items for what's actually going on, you
might see

s/4 1997/4/

Since your string started life as 4 1997\n, we haven't done anything with
that \n so it's still there. The solution? Chomp it. If you want to see this
happen, redo your script thusly:

$num_date = <STDIN>;
print $num_date,"<<< \$num_date\n";
$num_month = $num_date;
print $num_month,"<<< \$num_month\n";
$num_month =~ s/(^\d+) \d{4}/$1/;
print $num_month,"<<< \$num_month\n";
chomp($num_month);
print $num_month,"<<< \$num_month\n";

You'll notice that on every line except the last there is a newline (evident
by the <<< being on the next line).

Hope this helps!

-- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl







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

Date: Tue, 16 Dec 1997 22:12:54 -0200
From: "Osvaldo Pinali Doederlein" <osvaldo@visionnaire.com.br>
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <3497b363.0@news.netpar.com.br>

Hi Alicia,

Alicia Carla Longstreet wrote in message <3494B7DA.5463@ici.net>...
>> >1. Actual programs must be written in it.
>> >2. Lots of libraries must be written for it.
>> >3. Most computer architectures must have a compatible version of it.
>> >4. Source code must be easily understable (by good coders).
>> >5. Lots of programmers must know the language in deep.
>> >6. The syntax must be simple. The semantics must be well defined.

Wow, another ten-commandments list.

>Number 5, there are a lot of programmers who know C inside and out,
>probabaly more than any other language (possibly excepting COBOL and
>FORTRAN).  I can name a dozen or more on this forum alone.
>C is quite understandable to anyone who knows it.


If you read twenty lines of any C code, you will understand it, no matter
how badly/well written.  Now, try to figure out some complex algorithm, or
an entire application. When you look at some piece of C code, you read
something like "*ptr++ = foo()" then you literarily interpret it as "call
funcion f, store some scalar result in the address pointed by ptr and let
ptr point to the next position of whatever the buffer". I don't call this
"understantding" anything at all. You need to read lots of context and
rebuild your mental interpretation of the code (just like a several-pass
compiler) in order to finally obtain a high-level, "real" idea of the code.

The problem with C is not its brackets or terseness or even absence of OO;
the problem is expressiveness.  of course you can write ling-long,
descriptive variable names (complete with hungarian garbage so you can fake
types in a language which requires types but doesn't really implement them)
and LOTS of comments; but then the reader will interpret your documentation,
not your code.

[]s,
Osvaldo




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

Date: Wed, 17 Dec 1997 08:51:32 GMT
From: pbk@rdsas.com (Poul Kornmod)
Subject: Win32::ODBC  --->  "Fetch error: 911[Microsoft][ODBC Driver Manager] Driver does not support this function10"
Message-Id: <349790f0.5493803@news.dknet.dk>

Dear All,

Just installed the Win32::ODBC module and tested the functionality
with success all over (using the test.pl) Then I tried to configure a
connection to my server database on a remote UNIX box. I'm able to
connect to the database - and further I am also able to retrieve the
fieldname from the table. But when it comes to retrieving data from
the table it fails.

Whenever I try to fetch data from the database I get the following
message:

"Fetch error: 911[Microsoft][ODBC Driver Manager] Driver does not
support this function10"

I use the following piece of code:

$O->Sql("SELECT * FROM ff_type");
$O->FetchRow() || die qq(Fetch error: ), $O->Error(), qq(\n);
printf("%s\n",$O->Data('columbus'));

Do any of you have suggestions/ideas to what may cause this problem? I
have no problem using the Openlink ODBC driver from MS Access97 to the
database server!

I have the following setup :
- Win95
- Openlink ODBC Version 1.15.1219, file=oplodb32.dll, date=5. jan 97
- Informix 7 server

Thanks in advance and co-operation.

Best regards

Poul Kornmod  -  pbk@rdsas.com



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

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

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

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