[9336] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2931 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 22 08:10:20 1998

Date: Mon, 22 Jun 98 05:00:59 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 22 Jun 1998     Volume: 8 Number: 2931

Today's topics:
        case-insensitivity <"qtxjoki"@vg.ao,.ericsson.se>
    Re: Checking returns from system calls (Was: Please HEL (M.J.T. Guy)
        crypt how does it work? Important? <d96-nco@nada.kth.se>
        crypt! How does it work? <d96-nco@nada.kth.se>
    Re: Dbi Informix driver <zkessin@lhr-sys.dhl.com>
        Finding a string within a string <azman@bnex.com>
    Re: Finding a string within a string <rootbeer@teleport.com>
    Re: first language <dformosa@st.nepean.uws.edu.au>
    Re: first language ("Mark Morgan Lloyd ")
    Re: first language raw@cs.wisc.edu
    Re: first language (Lawrence Kirby)
    Re: first language (TNap)
    Re: Flames.... (Chip Salzenberg)
    Re: Flames.... birgitt@my-dejanews.com
        How to find last modified date of a file? <richard@see.my.sig>
    Re: How to find last modified date of a file? (Bob Trieger)
    Re: Key exists <aqumsieh@matrox.com>
        perl script error rasyidi@aitpg.Adorna-RMIT.edu.my
    Re: perl script error (T. Ames)
    Re: perl script error <rootbeer@teleport.com>
        Problem  with Perl for 32 C extention's  building <Dmitry_Brusilovsky@Scitex.com>
    Re: problems with flock (Brian L. Matthews)
    Re: problems with flock (M.J.T. Guy)
    Re: Question(s) about lexically scoped variables under  <aqumsieh@matrox.com>
        Script to get all IP addesses in Router-Network <michael.beckers@okay.net>
        Sending mail in Perl (xholf03)
    Re: Sending mail in Perl <rootbeer@teleport.com>
    Re: String Puzzle. <tjurik_NoSpam_@li.net>
    Re: Working With Hash <aqumsieh@matrox.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 22 Jun 1998 10:11:00 +0200
From: Jonas Kihlsten <"qtxjoki"@vg.ao,.ericsson.se>
Subject: case-insensitivity
Message-Id: <6ml3h9$3lk$1@info.aom.ericsson.se>

Does anyone know how to ignore case-sensivity when scaning through a
textfile?

Jonas Kihlsten
qtxjoki@vg.aom.ericsson.se
http://holistic.home.ml.org



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

Date: 22 Jun 1998 07:56:31 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Checking returns from system calls (Was: Please HELP convert a SIMPLE 2 Line DOS Batch File!!)
Message-Id: <6ml2nf$jo3$1@pegasus.csx.cam.ac.uk>

Larry Rosler <lr@hpl.hp.com> wrote:
>WIBNI (Wouldn't It Be Nice If) Perl had a cheap robust mechanism for 
>handling software exceptions, so that all the clutter caused by chacking 
>of Perl functions that invoke system calls (like 'open' -- "always check 
>your open()") could be handled centrally.  But I don't find SIGSOFT or 
>catch/try in the documentation.  And 'eval BLOCK' doesn't catch this kind 
>of exception.  Sigh...

Perl 5.005 will include the Fatal.pm module, whose spec starts

     Fatal provides a way to conveniently replace functions which
     normally return a false value when they fail with
     equivalents which halt execution if they are not successful.
     This lets you use these functions without having to test
     their return values explicitly on each call.   Errors are
     reported via die, so you can trap them using $SIG{__DIE__}
     if you wish to take some action before the program exits.


Mike Guy


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

Date: Mon, 22 Jun 1998 10:12:03 +0200
From: Niklas Collin <d96-nco@nada.kth.se>
Subject: crypt how does it work? Important?
Message-Id: <Pine.GSO.3.95.980622100659.11780A-100000@alv.nada.kth.se>

This perl statement is true when the user has but in the correct
password. User is an Xbase object and $dbf3_field_passwd is a string 
containing the name of a field in a database where the correct
encrypted password is stored.

$user->get_field($dbf3_field_passwd) eq 
crypt($htblsn,$user->get_field($dbf3_field_passwd))

How does crypt work? I don't understand the parameters it takes. The
above statement is taken from a script created by my predecessor.

Regards, Niklas.
-------------------------------------------------------------------------------
Love is like the ozone-layer. You don't miss it until it's gone.

Niklas Collin
Ugglevdgen 32A
13144 Nacka

Tel: 08-7164543
Email: d96-nco@nada.kth.se



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

Date: Mon, 22 Jun 1998 10:19:55 +0200
From: Niklas Collin <d96-nco@nada.kth.se>
Subject: crypt! How does it work?
Message-Id: <Pine.GSO.3.95.980622101835.11780B-100000@alv.nada.kth.se>

Hello, i saw how crypt works. I just wonder why my excolleague would
use the encrypted passwd from the database as an encryption key?

Regards, Niklas.

-------------------------------------------------------------------------------
Love is like the ozone-layer. You don't miss it until it's gone.

Niklas Collin
Ugglevdgen 32A
13144 Nacka

Tel: 08-7164543
Email: d96-nco@nada.kth.se



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

Date: 22 Jun 1998 08:25:50 +0100
From: Zachary Kessin <zkessin@lhr-sys.dhl.com>
Subject: Re: Dbi Informix driver
Message-Id: <m3hg1d28zl.fsf@pc-hhu-52.lhr-sys.dhl.com>


Andrew Lovell <andy@studioware.pt> writes:

> Has anyone tried the Dbi Informix driver, if so what was it like?
> stable? fast? slow?
> 
> Thanks
> Andy Lovell

Its ok, a pain to get working under hp-ux (but a lot of things are
realy) and does not handle any of the IUS specific stuff.

--Zach Kessin


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

Date: Sun, 21 Jun 1998 17:03:20 +0800
From: Azman Shariff <azman@bnex.com>
Subject: Finding a string within a string
Message-Id: <358CCC58.A46DE2E4@bnex.com>

this is gonna be a trivial question to most of you but just forgive my
stupidity.. :)

1)I have a file called search.index
2) it contains all the webpages on mysite with each page on each line in
the form
 $header:$topic:$idno
3) i need to do a search function
4) the search fucntion will look at ever line ... extract the $header
and compare it to the $searchstring
and if it matches, I wan to print it out to the users.

the prob only lies wih he comparing part...... i used this (i don't know
if it really works)

if (grep (/$searchstring/,$header){
   print "$header";
}

please advice

Azman Shariff
portal@pacific.net.sg
azman@bnex.com



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

Date: Mon, 22 Jun 1998 09:34:23 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Finding a string within a string
Message-Id: <Pine.GSO.3.96.980622023121.6310D-100000@user2.teleport.com>

On Sun, 21 Jun 1998, Azman Shariff wrote:

> if (grep (/$searchstring/,$header){

If $searchstring is a pattern, you probably want a pattern match instead
of grep(); if it's a (plain old text) string, you probably want index(). 
Hope this helps! 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 22 Jun 1998 08:40:10 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: first language
Message-Id: <898504810.703215@cabal>

In <pudge-1906981314440001@dynamic162.ply.adelphia.net> pudge@pobox.com (Chris Nandor) writes:

>In article <8c7m2dbgim.fsf@gadget.cscaper.com>, Randal Schwartz
><merlyn@stonehenge.com> wrote:

[...]

># There's no excuse for not knowing Pascal and Smalltalk given the free
># implementations out there.

>I dunno, the only real language I know is Perl, and I am happy.

I wouldn't touch a monolinguial programer with a brage pole.  By learning
new languges you get a new perspective on the univers that improves your
programing ability.  IMHO A cultured programer would have under there belt

A Languge of chouse, Knowlige of C, Knowlige of a functional languge
(Commen Lisp or Scheam), Knowlige of an OOP languge that is not C++,
Knowlige of a least 2 other languges, and the knowlige of an obscure
little know languge that its not raly used anywhere.

Also given a set of turing compleat tools a cultured programmer should be
able to use them.  Even if most peaple wouldn't consider them a progerming
languge.



--
I'm a perl programer; if you need perl programing, hire me. 
Please excuse my spelling as I suffer from agraphia; see the url. Support NoCeM
http://www.cit.nepean.uws.edu.au/~dformosa/Spelling.html  http://www.cm.org/ 
I'm sorry but I just don't consider 'because its yucky' a convincing argument


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

Date: 22 Jun 1998 10:58:40 +0100
From: mark_tbu@cix.co.uk ("Mark Morgan Lloyd ")
Subject: Re: first language
Message-Id: <6ml9sg$ieh$1@plutonium.compulink.co.uk>

In article <MPG.ff5e8a7393af52f9896b1@nntp.hpl.hp.com>, lr@hpl.hp.com 
(Larry Rosler) wrote:

> In article <6mhdpq$c4n@news.service.uci.edu>, John Beppu 
> <beppu@rigel.oac.uci.edu> says...
> ...
> >     I am of the opinion that the best way to become familiar with
> >     pointers is to learn an assembly language of the architecture
> >     you use most often.

A way that I've used when explaining such things is to introduce a pointer 
as something which is returned by a (not necessarily genuine) operating 
system when it wants to refer to an internal structure. The worst possible 
way of introducing pointers is muddled in with dynamically-allocated 
memory and structures such as trees and lists, i.e. the way most books do 
it :-)

I learnt FORTRAN first (on punched cards)-: followed by about three years 
in which I did nothing but assembler... later BASIC then Pascal (etc.) but 
I've never done anything in anger in C or C++.

Mark Morgan Lloyd
mark_tbu@cix.co.uk

[Opinions above are the author's, not those of his employers or 
colleagues]


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

Date: Mon, 22 Jun 1998 10:50:23 GMT
From: raw@cs.wisc.edu
Subject: Re: first language
Message-Id: <6mlctf$vam$1@nnrp1.dejanews.com>

In article <6mkgnr$38m$1@monet.op.net>,
  mjd@op.net (Mark-Jason Dominus) wrote:
>
> In article <6mf1o8$nc4$1@monet.op.net>,
>   mjd@op.net (Mark-Jason Dominus) wrote:
> >> Consider a language that supports both call-by-value and
> >> call-by-reference semantics, say Pascal.  You will have to explain
> >> to the students why one and not the other must be used in a case
> >> like this, and the explanation will be nearly identical to the
> >> explanation of why scanf arguments are preceded by & in C.  So
> >> pedagogically, there is very little difference between these two
> >> things.
>
> In article <6mka4n$n1j$1@nnrp1.dejanews.com>,  <raw@cs.wisc.edu> wrote:
> >This is wrong.
> >
> >In Pascal, read and write have the same syntax (except for optional
> >formatting in write).  Call by value and call by reference are
> >distinguished when defining a function or procedure, not when calling
> >it.  Since C does not have call by reference, it must simulate it
> >with explicit pointers; and this is relevant for calls of standard
> >functions like scanf, which look very different from printf.
>
> I must be missing something fundamental here.  You begin with `this is
> wrong', and then you say a bunch of things that I think are evidently
> true.
>
> The contradiction is not apparent to me, and I am not sure what your
> point is.  If you are refuting me, could you say what it is you are
> refuting?

Pedagogically, there is a vast difference between simulating call by
reference with pointers and having actual call by reference.  As should
be readily apparent, I am contradicting the statement that immediately
preceded "This is wrong.".

"The case like this" was concerned with an early stage of learning: in C,
you must either supply non-standard input routines (which must at
some point be unlearned) or use scanf (with an explanation of pointers
in order to understand &, or with no explanation at all).  The best option
is to explain the pointers, since pointers are so fundamental to C.  By
contrast, the complexities in Pascal can generally be ignored at this
level.

With Pascal, you can use readln and writeln with symmetry because
call by reference is actually available.  With C, you must treat the
simulated call by reference parameters and arguments differently: in
the function prototype, when calling the function and when referring
to the arguments.  In particular, no syntactic difference will be noted
by the students in calling readln or writeln; pointers are in any event
much harder to understand than procedures that change the variables
supplied as arguments.

We can continue the discussion by e-mail if this is still unclear.

--
MJSR

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Mon, 22 Jun 98 11:19:24 GMT
From: fred@genesis.demon.co.uk (Lawrence Kirby)
Subject: Re: first language
Message-Id: <898514364snz@genesis.demon.co.uk>

In article <6mj3a3$ank$1@csnews.cs.colorado.edu>
           tchrist@mox.perl.com "Tom Christiansen" writes:

> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, sylvainp@microtec.net writes:
>:I was too thinking physical memory too much and it
>:made pointer arithmetic hard to grasp. I had a very hard time
>:understanding why adding 1 to a pointer would not just increment it by
>:one byte. 
>
>Because the precursors of C dealt only in words, not types of
>varying sizes.  

I think more fundamentally you would end up with a very odd language if
pointer arithmetic did work in bytes. I think the decision would be the same
for any language high level language that supports pointer arithmetic,
even for a language with no historical baggage.

-- 
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------



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

Date: 22 Jun 1998 07:36:04 EDT
From: Tomnap@cris.com (TNap)
Subject: Re: first language
Message-Id: <6mlfj4$95s@examiner.concentric.net>

In article <6mhevk$jrp$1@news01.li.net>, T Jurik <tjurik_NoSpam_@li.net> wrote:
>
>>right away to get much useful work done anyway.  But Perl references can
>>wait till much later, while C pointers cannot.
>>
>>Don't teach C to beginners!
>
>I agree here -- only insofar as using C++, Smalltalk, Scheme, or Java rather
>than C.  One should try to teach 'beginners' as many languages as possible.
>Using the right tool (language) for a particular problem/job is a
>significant help in creating a solution.
>
>Tim J

    You hit it right on the head.  I've been programming since the 1950s
and have used quite a few  tools over the years.  So many of the newer
employees are "one trick ponies" and fail to see the utility of a variety
of tools.  Getting back to the newsgroup, perl is one tool that, once learned
speeds up getting jobs out the door, which is what they pay us for.  Aesthetics
be damned but some tools are just better than others for writing cleanly.  

--
Cheers, Tom Napolitano               |
        tomnap@concentric.net        |



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

Date: Mon, 22 Jun 1998 09:11:19 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Flames....
Message-Id: <6ml76i$7bh$1@cyprus.atlantic.net>

According to ames0009@tc.umn.edu:
>On Sun, 21 Jun 1998 17:00:00 GMT, chip@mail.atlantic.net (Chip
>Salzenberg) wrote:
>>According to ames0009@tc.umn.edu:
>>>Your response also displays the "I'm so smart--you're so stupid"
>>>attitude ...
>>
>>Why should a demand that petitioners exert some effort be interpreted
>>as a put-down?

You never answered that, Todd.  "Smart/stupid" is a straw man.

>>Why should it be too much to expect that a person wanting to learn
>>about a *programming*language* know how to grep?!
>
>That's the whole point. Your talking about people who are trying to
>learn what "grep" is

No, that's just plain wrong.  Knowing how to search text files on a given
platform is such a basic skill that anyone who doesn't know how to do it,
doesn't think they have to know it, yet demands help from volunteers, is
just not ready (emotionally and socially, or perhaps educationally) for
the rigors of programming in Perl or any other language.

You might as well include in the FAQ a note about finding one's thumb
so as to conveniently press the space bar.  Feh.

>I'll really go out on a limb here and say that there was a time when
>you didn't know what "grep" (or any other command) was.

It wasn't the job of the resident BASIC expert to tell me.
-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Mon, 22 Jun 1998 11:48:15 GMT
From: birgitt@my-dejanews.com
Subject: Re: Flames....
Message-Id: <6mlg9v$2kh$1@nnrp1.dejanews.com>

In article <Pine.GSO.3.96.980621184842.6898F-100000@user2.teleport.com>,
  Tom Phoenix <rootbeer@teleport.com> wrote:
>
> On Sun, 21 Jun 1998 birgitt@my-dejanews.com wrote:
>
> [ 2 1/2 screens of quoted text were here. Please don't quote messages in
> there entirety when you could cut down or summarize instead. ]
>
> >         1. Post the
> >            FAQ! ANSWERS TO YOUR QUESTIONS ! READ FIRST!
> >           *daily* even *twice daily*. And I would include as many
> >            detailed pointers as you can.
>
> If someone isn't reading what's already out there, why would additional
> postings make a difference?

Because you can't conclude from the fact that the first time poster
who hasn't read what is already out there, *will* not read
what is out there, you can only conclude he hasn't read the material
when you *expect* him *having read* the material.

It is a matter of timing quite often.

Drawing from my own experience and taking the answers a novice
usenet reader in general and of c.l.p.m, novice potential programming
student and potential novice Perl apprentice is getting here, namely:

                 "Study the documentation" and
                 "You need to be a programmer to do what you want to do",

means nothing less than to read and *study*  through thousands of pages
of documentation, at least five books and if you are serious quite more.
(See thread: First language).

I know exactly what I *have* to read, that doesn't mean that
I can read it, *when* you want me to read the material.

I personally took the consequence and don't ask Perl language
related beginners questions here beforehand. When I have done what
you ask for, most probably I will not have typical beginner's question
anymore.

Flames make you aware of the problem, explicit frequent postings
will too and may be much faster and more convincing (especially of
my no 2 and no 3 examples), I believe. In combination with not
responding or posting canned replies which make your position
clear, I think, the problem can be handled.

Birgitt Funk



-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Mon, 22 Jun 1998 10:01:33 +0100
From: "Richard G. Coleman" <richard@see.my.sig>
Subject: How to find last modified date of a file?
Message-Id: <sMAWDHAt1hj1EwBc@alchemedia.co.uk>

Hi

Can anyone help with a Perl problem I have.

How do I extract the last modified date / time of a file eg a data file
and print it on an html page.

Thanks in advance

Richard
-- 
             Richard G. Coleman  |  richard@alchemedia.co.uk
     Alchemedia Interactive Ltd  |  http://www.alchem.demon.co.uk/
     -------------------------------------------------------------
  


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

Date: Mon, 22 Jun 1998 11:40:36 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: How to find last modified date of a file?
Message-Id: <6mlfv5$vnq$1@strato.ultra.net>

"Richard G. Coleman" <richard@see.my.sig> wrote:
> How do I extract the last modified date / time of a file eg a data file
-> and print it on an html page.

perldoc -f stat
perldoc -f print

HTH

Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-286-0591
  and let the jerk that answers know that his
  toll free number was sent as spam. "


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

Date: Sun, 21 Jun 1998 12:04:03 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Key exists
Message-Id: <358D2EF3.D99E60A8@matrox.com>

lhiller@compupartner-edm.com wrote:
> 
> Hi everyone,
> 
> How can I check if a has has a particular key defined?
> 

if (exists $hash{$key}) {
	# whatever
}

> Thanks,
> Jordan Hiller
> 


-- 
Ala Qumsieh		|  No .. not just another
ASIC Design Engineer	|  Perl Hacker!!!!!
Matrox Graphics Inc.	|
Montreal, Quebec	|  (Not yet!)


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

Date: Mon, 22 Jun 1998 07:05:27 GMT
From: rasyidi@aitpg.Adorna-RMIT.edu.my
Subject: perl script error
Message-Id: <6mkvnn$i3a$1@nnrp1.dejanews.com>

Hai...

I'm still new in perl programming.

can someone help me to checked my script for inquiry form.

below in my script:
#!/usr/bin/perl
require "cgi-lib.pl";     #I download from internet (cgi-lib.pl)
&ReadParse;
open (MAIL, "|mail rasyidi@aitpg.Adorna-RMIT.edu.my");
print MAIL <<"EOT";
Here is the information that was sent:

Name :                $in{"name"}    #Name :<input name="name">
Address :             $in{"address"}
City :                $in{"city"}
State :               $in{"state"}
Country :             $in{"country"}
Zip :                 $in{"zip"}
Telephone :           $in{"phone"}
E-mail :              $in{"email"}
Question :            $in{"comments"} #Question :<textarea name="comments">
EOT
close (MAIL);

print "Content-type: text/html\n\n";

<HTML><HEAD>
<TITLE>Thank you</TITLE>
</HEAD>
<BODY>
<H1>Thank you $in{"name"}.</H1>
<H2>The form's information was successfully sent to us.</H2>
</BODY></HTML>

When I tried to call this script, I got an Internel server error.
When I look at /var/log/httpd/error_log it show me:
syntax error at /home/httpd/cgi-bin/email.pl line 21 near "BODY>"
Bareword found where operator expected at /home/httpd/cgi-bin/email.pl line
22 near "H1>"
       (Missing operator before thank?)
Execution at /home/httpd/cgi-bin/email.pl aborted due to compialtons errors.
Premature en of script headers

can you help me to checked my script or
can you give an example script for inquiry form using perl script.

Thank you.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Mon, 22 Jun 1998 07:47:23 GMT
From: ames0009@tc.umn.edu (T. Ames)
Subject: Re: perl script error
Message-Id: <358e09ba.14330245@news.tc.umn.edu>

On Mon, 22 Jun 1998 07:05:27 GMT, rasyidi@aitpg.Adorna-RMIT.edu.my
wrote:

>Hai...
>
>I'm still new in perl programming.
>
>can someone help me to checked my script for inquiry form.
>

In general, you should not post an entire script and ask someone to
fix it - you really won't get much help that way.  If you want to
learn Perl there are many excellent resources available.  Start with
the FAQ's.

Here is a CGI/Perl FAQ that should help:

http://www.eprotect.com/stas/TULARC/webmaster/myfaq.html
or
http://language.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html

If, on the other hand, you do not wish to learn Perl but only want
someone to configure a script for you, you might try a CGI newsgroup
or contact the person who originally wrote the script.

Hope that helps,

T. Ames





>>>>>>>>>>>>>>>>>>>
Todd C. Ames
ames0009@tc.umn.edu
University of Minnesota


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

Date: Mon, 22 Jun 1998 09:25:15 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: perl script error
Message-Id: <Pine.GSO.3.96.980622022427.6310B-100000@user2.teleport.com>

On Mon, 22 Jun 1998 rasyidi@aitpg.Adorna-RMIT.edu.my wrote:

> open (MAIL, "|mail rasyidi@aitpg.Adorna-RMIT.edu.my");

When you try running this program, perl will give you a helpful diagnostic
message. Heed it. Hope this helps! 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 22 Jun 1998 05:37:00 GMT
From: "Dmitry Brusilovsky" <Dmitry_Brusilovsky@Scitex.com>
Subject: Problem  with Perl for 32 C extention's  building
Message-Id: <01bd9d9f$788f2590$3f0f0a82@dima>

I do not success to build my Win 32 Perl extention, written on C/C++.
When I try to build it, compillation is OK,  but on stage of linking I
receive
list of unresolved  external symbols:

 _Perl_markstack_ptr
 _Perl_sv_2pv
 _Perl_na
 _Perl_croak
 _Perl_stack_sp
 _Perl_stack_base
 _Perl_sv_yes
_Perl_newXS

I built perl300.dll and included perl300.lib to list of library files in my
project's setting,
but something is missed.

Could anyone help me?


Dmitry Brusilovsky

 


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

Date: 21 Jun 1998 23:24:34 -0700
From: blm@halcyon.com (Brian L. Matthews)
Subject: Re: problems with flock
Message-Id: <6mktb2$pu8$1@halcyon.com>

I wrote:
|> Why not? Yes, if you're just going to immediately close a file, it's not
|> *necessary* to unlock the file first, but it doesn't really hurt

Tom number one wrote:
|Not so; there are hidden buffering issues to consider. You should release
|the lock only if you understand everything about what's going on behind
|the scenes. Hope this helps!

Tom number two wrote:
|Gosh, I know that *I'd* like to make sure my data gets to
|the file prior to unlocking it.

In perlfunc under flock we find:

		"To avoid the possibility of mis-coordination, Perl flushes
		 FILEHANDLE before (un)locking it."

So, is this not what happens? And if not, why not?

Brian


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

Date: 22 Jun 1998 08:22:35 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: problems with flock
Message-Id: <6ml48b$kmg$1@pegasus.csx.cam.ac.uk>

Brian L. Matthews <blm@halcyon.com> wrote:
>
>In perlfunc under flock we find:
>
>		"To avoid the possibility of mis-coordination, Perl flushes
>		 FILEHANDLE before (un)locking it."
>
>So, is this not what happens? And if not, why not?

In older Perls (before 5.004) this flush did not happen.

In general, issuing an explicit unlock is a sign that the programmer
does not understand the issues involved.


Mike Guy


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

Date: Sun, 21 Jun 1998 12:17:20 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Question(s) about lexically scoped variables under 'use strict'
Message-Id: <358D3210.58AC8F23@matrox.com>

Stephan Carydakis wrote:
> 
> Hello All,
> 
> As I am new to Perl, I've been writting scripts(mostly for CGI) without
> the pragma 'use strict'. Many people have recommended to always use
> strict and I have decide to never again write scripts without it(and
> -w).

That's the way to a long, healthy programming life.
> 
> So, I have begun writting my first script under use strict. I have only
> a few lines of code, infact just 1 sub, which parses input, pretty
> standard.
> 
> Every variable in this sub(and the whole script!) produces an error,
> "global symbol '%s' requires explicit package name" which I have read up
> on. It seems that I have to either qualify every variable with an
> explicit package name, or declare every variable with 'my'.
> 
> Is there something I'm missing here?. Can I gather that under strict
> that all variables need to be either predeclared with my, or qualified
> with a package name? This seems a bit 'odd'(for want of a better word)
> to me?
> 
> Could someone elaborate on this?
> _______________________________________________________________
> Stephan Carydakis  steph@hotkey.net.au
> 
> P.S. just a tit-bit. 'pragma' is a greek word meaning 'thing'
> _______________________________________________________________

Well, you could read the documentation on "use strict". This
documentation comes with every standard version of Perl, and is probably
residing somewhere on your harddrive.
If you "use strict", you are actually using all three currently
available restrictions,

"vars", "subs" and "refs".

Straight from perldoc strict:

     strict vars
           This generates a compile-time error if you access a
           variable that wasn't localized via my() or wasn't
           fully qualified.  Because this is to avoid variable
           suicide problems and subtle dynamic scoping issues, a
           merely local() variable isn't good enough.  See the my
           entry in the perlfunc manpage and the local entry in
           the perlfunc manpage.
 
               use strict 'vars';
               $X::foo = 1;         # ok, fully qualified
               my $foo = 10;        # ok, my() var
               local $foo = 9;      # blows up
 
           The local() generated a compile-time error because you
           just touched a global name without fully qualifying
           it.


-- 
Ala Qumsieh		|  No .. not just another
ASIC Design Engineer	|  Perl Hacker!!!!!
Matrox Graphics Inc.	|
Montreal, Quebec	|  (Not yet!)


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

Date: Mon, 22 Jun 1998 12:06:48 +0200
From: Michael Beckers <michael.beckers@okay.net>
Subject: Script to get all IP addesses in Router-Network
Message-Id: <358E2CB8.3BB6@okay.net>

Hi all,

1. I am an absolut beginner in Perl.
2. I am looking for a script which can tell me which IP-Addresses    are
avaiable in a small Router-Network.

Thank you for your help and please be patiant with me ;)

Best Regards, Michael Beckers


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

Date: 22 Jun 1998 09:23:13 GMT
From: xholf03@vse.cz (xholf03)
Subject: Sending mail in Perl
Message-Id: <6ml7q1$kll@vse470.vse.cz>

Hello,
week ago i've started to learn perl ... (so i don't know anything)
I've got problem with sending mail. Please, could you tell me what's wrong 
with this?

#!/usr/bin/perl -w
$from = 'xholf03@sorry.vse.cz';
$to = 'xholf03@vse.cz';

open (Mail, "/usr/bin/sendmail");
print Mail "To: $to\n";
print Mail "From: $from\n";
print Mail "Subject: send\n";
print Mail ".\n";
close (Mail);

Thanks much.
filip



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

Date: Mon, 22 Jun 1998 10:48:35 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Sending mail in Perl
Message-Id: <Pine.GSO.3.96.980622034726.6310G-100000@user2.teleport.com>

On 22 Jun 1998, xholf03 wrote:

> I've got problem with sending mail. Please, could you tell me what's wrong 
> with this?

I don't see any problem with the perl code; maybe your trouble is with
sendmail. If you're using the proper commands to run another program from
perl, but the other program doesn't cooperate, then it's the other
program's fault. If you're not using the proper commands, then it's your
fault. If you aren't sure about the proper commands, you should read the
program's documentation. If you've read it and you're still not sure, you
should ask in a newsgroup about the program. 

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sat, 20 Jun 1998 21:30:00 -0400
From: "T Jurik" <tjurik_NoSpam_@li.net>
Subject: Re: String Puzzle.
Message-Id: <6mhnml$r27$1@news01.li.net>


John Campos wrote in message <358AA1A7.33D30B31@pitt.edu>...
>Anyone,
>
>I'm currently revising a perl script that reads an html document into a
>variable and then split it up into 31k increments and then record each
>piece to my database.  For example if the length of the document is 70k,
>I would have 3 pieces (1st piece = 31k, 2nd piece = 31k, 3rd piece =
>8k).  Making sure that each piece does not exceed 31k in length.
>
>Problem:  I have to make sure that before I create a piece that I do not
>split up a particular
>                tag over two records.  It has to be whole.  The tag is
><a .....> .... </a>
>
>I suspect I would create a loop that would append a piece at a time to a
>variable until I reach my 31k limit and than save that last piece to the
>database.  And then pick up where I left off and continue through the
>rest of the document.


You could do this.  There are a few problems to keep in mind:
1. Make sure that you handle recursion of the tags correctly.
2. What your parser thinks is the ending sequence of a tag (if you write it
incorrectly) may actually be the tag token but it could be prefaced by a
comment token.
3. You may read a whole block of code that is >31K that can't be split.
(Unlikely, but one never knows what the code will be used for in the future,
or if you reduce the block size.)  Keep this in mind, but it may be low
risk.

My first reaction is to question the requirement of not allowing tag
splitting.  Perhaps if the consumer of these chunks of code was modified,
then the decomposition would be really simple.

>
>So when I find the first "<a" I would immediately look for the "a>" and
>save it to a varible.
>after each append I guess I would check the length and continue through
>if < 31k?

See comments 1 and 2 above.

>I am new to the perl language.  Can anyone help me along with some of
>the ways I would do this in perl.

>
>Thank you in advance for you help
>
>Ps. If you need more information, I will gladly provide it.
>




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

Date: Sun, 21 Jun 1998 12:12:33 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Working With Hash
Message-Id: <358D30F1.E371DE2B@matrox.com>

Luckys wrote:
> 
> I'm working with hash in reference with a DBM file and have been able to
> successfuly read and write associative arrays to it.  I can't, however,
> edit already existing arrays within it (edit the value portion of it).
> Everytime I try to edit the value portion of the pair it adds a new pair
> to the DBM file.  Is there a way to edit the value of the already
> existing pair without having to delete or undef it?  If not, what would
> be the best method of removing both the key and value for an already
> defined pair?

You should be able to do anything you want with your hash. You didn't
tell us how you attempted to modify it though. Maybe your approach is
wrong. 
Assume that for a certain $key in %hash corresponds to $value1:

$hash{$key} = $value1;

if you want to modify $value1 to $value2, you simply re-assign to the
hash:

$hash{$key} = $value2;

That should do it. But, anyway, if you want to delete a key-value pair
from a hash you simply use:

delete $hash{$key};

Before you go on with your Perl life, I suggest you get used to reading
some documentation. This would save you some time, and you might stumble
upon all sorts of useful things in the process.

-- 
Ala Qumsieh		|  No .. not just another
ASIC Design Engineer	|  Perl Hacker!!!!!
Matrox Graphics Inc.	|
Montreal, Quebec	|  (Not yet!)


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

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

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