[13692] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1102 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 17 17:05:25 1999

Date: Sun, 17 Oct 1999 14:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940194306-v9-i1102@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 17 Oct 1999     Volume: 9 Number: 1102

Today's topics:
    Re: [Q] Object-Relational DBs in Perl (Postgres, Inform <gellyfish@gellyfish.com>
    Re: [Q] Object-Relational DBs in Perl (Postgres, Inform <jll@newedgeconcept.com>
    Re: backup to change (Kragen Sitaker)
    Re: CGI.pm background graphics (AcCeSsDeNiEd)
    Re: encryption and crypt() ? <rootbeer@redcat.com>
    Re: Exact pattern match (Tad McClellan)
        Help - Can't figure this out (AcCeSsDeNiEd)
    Re: How to inquire, position and click the mouse in PER (Kragen Sitaker)
        New To Perl <mdawson106@home.com>
    Re: New To Perl <2bunnyhop@home.com>
    Re: Opinions? Efficiency & Drain of Pack/UnPack (Kragen Sitaker)
    Re: Positioning the Cursor on a terminal jwag@usa.net
    Re: qr operator the $_ <ltl@rgsun40.viasystems.com>
    Re: THANKS FOR ALL THE HELP (Matthew Bafford)
    Re: Trouble using I/O handles in recursive sub david@see.signature.uk
    Re: TUTORIAL <camerond@mail.uca.edu>
    Re: Uses of # (Damian Conway)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 17 Oct 1999 19:38:52 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: [Q] Object-Relational DBs in Perl (Postgres, Informix, etc.)
Message-Id: <7ud8kc$5fm$1@gellyfish.btinternet.com>

In comp.lang.perl.misc Wade Holst <wade@csd.uwo.ca> wrote:

Sorry for posting a reply a week later - I've had a little trouble keeping
up this week ...

<Snip stuff about Object-Relational databases>

I dont know of any Object-Relational database modules for Perl - I think
that people would be interested however if you were to start work on one.

>                                           As a side note, is Informix
> worth paying money for?  

You would probably be better off asking this elsewhere as comparisons
between databases are a little off-topic - I for one have no experience
of Postgres and a lot of Informix.  You would probably want to ask in a 
comp.databases.* group for a balanced view.  However if you've got a
budget you could easily do a lot worse.  Infact you can download Informix
SE for Linux gratis from <http://www.intraware.com>.

>                         Does the DBD::Informix module handle Postgres?
> 

No.  It will only work with Informix databases (Both IDE and SE though).
You will want to use DBD::pg to connect to Postgres.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 18 Oct 1999 10:49:02 +0200
From: Jean-Louis Leroy <jll@newedgeconcept.com>
Subject: Re: [Q] Object-Relational DBs in Perl (Postgres, Informix, etc.)
Message-Id: <m3hfjpcav5.fsf@enterprise.newedgeconcept>

> I dont know of any Object-Relational database modules for Perl - I think
> that people would be interested however if you were to start work on
> one.

Well in a related vein there's Tangram, my object-relational mapper,
available from CPAN.

DESCRIPTION
       Tangram is an object-relational mapper. It makes objects
       persist in relational databases, and provides powerful
       facilities for retrieving and filtering them.  Tangram
       fully supports object-oriented programming, including
       polymorphism, multiple inheritance and collections.  It
       does so in an orthogonal fashion, that is, it doesn't
       require your classes to implement support functions nor
       inherit from a utility class.


-- 
Jean-Louis Leroy
http://users.skynet.be/jll


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

Date: Sun, 17 Oct 1999 19:22:24 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: backup to change
Message-Id: <QlpO3.12517$E_1.696273@typ11.nn.bcandid.com>

In article <19991015080103.10734.00000206@ng-cd1.aol.com>,
Jimtaylor5 <jimtaylor5@aol.com> wrote:
>can anyone demonstrate some code that would back up a file temporarily while my
>program makes  changes to the file? And if possible to do it so the backup
>itself is not over written by the corrupt file if the program was run a second
>time?  Thanks in Advance for any help.

The way I usually like to do this is to create a second file with a
unique name in the same directory, then write the new version of the
file into the second file, then rename the second file to the original
file's name.  On Unix, this atomically replaces the original file with
the new version, so any program reading the file will see either the
old or the new version.  If your program or computer crashes, the
second file will remain, and the original will not be harmed; future
runs of the program will not overwrite or delete the second file.

On Win32, the semantics of rename are different and this doesn't quite
work.  About the best you can do is to delete the old file, then rename
the new file into place, which leaves room for a crash to leave you
with a valid new file under a weird name and no copies of the original
file.

If you have to cope with concurrent writers, this may or may not be
satisfactory, because the changes of some of the writers will be lost.
To avoid that, you need either atomic compare-and-swap (which most OSes
don't provide for files) or locking.  perldoc -f flock.

HTH.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Sun Oct 17 1999
23 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sun, 17 Oct 1999 19:54:35 GMT
From: dillon_rm@magix.com.sg (AcCeSsDeNiEd)
Subject: Re: CGI.pm background graphics
Message-Id: <380a16d2.6266576@news.magix.com.sg>


Hash: SHA1

Ok, ok I've made some mistakes and I'm sorry. 
Nobody is perfect, even when giving advice!
I'm not the only one here who has give wrong advice here.
It happens, it cannot be avoided.

Pls go ahead and mark my mistakes like Jeff Zucker did but you do not
need to be crude in your language!

I respect Jeff for highlighting my mistakes. 
It is good that he pointed out my mistakes and he had the right to do
it so that nobody would follow my bad advice. I truly wouldn't want
anyone to follow it anyway.



On Wed, 13 Oct 1999 07:12:30 -0700, lr@hpl.hp.com (Larry Rosler)
wrote:

>In article <380445b8.8549415@news.magix.com.sg> on Wed, 13 Oct 1999 
>09:57:06 GMT, AcCeSsDeNiEd <dillon_rm@magix.com.sg> says...
>> 
>> Hash: SHA1
>
>Why do you trouble us with that noise?  Would someone go to the
trouble 
>of forging your name to these errors?

Errors or not I was once impersonated and once was enough! PGP is a
good practice in NGs. It avoids unnecessary conflicts and problems.
You already have a conflict with me. It is possible for you to decide
to impersonate me. So stop bothering me with this. If you really have
nothing else better to do, pls go screw the posters who have long
signatures in their posts. Not PGP users like me.

>
>...
>
>> Change:
>> print "BACKGROUND=\"bakc.gif\""; 
>> 
>> To: 
>> print "BACKGROUND=\bakc.gif\"; 
>                    ^        ^
>A backspace and a syntax error.  Kill the backslashes also.

What backspace? Pls elaborate or is it just your newsreader seeing
something else?
I did tell the original poster that he had errors in his html code.
So I did a copy and paste, corrected one error but missed out a few
like the slashes. Again my mistake. I should have corrected all his
errors. My sincere humble apologies.


> 
>> Remember, don't use any quotes within your HTML tags.
>
>What a wonderful, empty-headed generalization!
> 
>> Btw, like Dan has pointed out, your HTML code is wrong.
>> even with quotes, the code: BACKGROUND=\"bakc.gif\"
>> it should be: BACKGROUND="\bakc.gif\" 
>                            ^        
>You seem to have a 'thing' for backspaces in HTML!
>
><SNIP> Jeopardy-style quote and PGP noise
>
>-- 
>(Just Another Larry) Rosler
>Hewlett-Packard Laboratories
>http://www.hpl.hp.com/personal/Larry_Rosler/
>lr@hpl.hp.com


Version: PGPfreeware 6.0.2i

iQA/AwUBOAm4x4bzvNYn0WpvEQJtdwCgyqJY3QE7dw+EOC6/B1XkLvIuHjIAn26N
jlt+gaweju1knbwG0EiBnNfP
=qEut
-----END PGP SIGNATURE-----


To e-mail me, remove "_rm"

PGP Key on Keyservers
Key ID: 0x27D16A6F
Fingerprint: 8B3E DEF8 216E 04BD C12E  53AC 86F3 BCD6 27D1 6A6F


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

Date: Sun, 17 Oct 1999 12:49:31 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: encryption and crypt() ?
Message-Id: <Pine.GSO.4.10.9910171157310.25558-100000@user2.teleport.com>

On Sun, 17 Oct 1999, Martin Vorlaender wrote:

> Should one just warn against such violations of the calling standard,
> or try to do something about it?

I'd say: Don't sweat it too much. I was thinking of checking only that
there are actually two args, and maybe that the salt is at least two chars
long.

> : And it should not export crypt() if the built-in is there (except
> : maybe as a special debugging option).
> 
> Done. It's regulated by $Crypt::UnixCrypt::OVERLOAD_BUILTIN (must be
> set to true if $Config{d_crypt} to get the module's crypt function),
> or by explicitely demanding the export of crypt().

Hmmmm.... I'm not sure that I like that. Maybe it's the best thing. So,
you're saying that these comments are correct?

    use Crypt::UnixCrypt;	# imports crypt() if needed

    use Crypt::UnixCrypt qw/ crypt /;	# imports always

Here's what I'm not sure about. Maybe (not likely, but maybe) we will add
another function to this module someday. Let's call it "fred". Now someone
who wants "fred" is likely to ask for qw/ fred crypt / and get the
override when they don't want it, rather than remembering to ask for
something like qw/ :standard fred /.

I think I'd prefer something like this (although maybe with a different
keyword).

    use Crypt::UnixCrypt;	# imports crypt() if needed

    use Crypt::UnixCrypt qw/ force_crypt /;	# imports always

force_crypt? override_crypt? import_crypt? I don't know what's best....

> Done, though the test suite contains just the load test and one real
> password check now. How many empiric tests would be enough?.

I'd say this should do it. Adjust the $start as needed. I can't think of
any major cases this doesn't cover, but it's easy to add them later.

    {
	my %passwords = qw{
	    baVNbYZEf7LDE	fred
	    fr7q2GbYzYnUY	fred
	    frDRU8pKCvhno	barney
	    bavBxSScsQx4c	barney
	    frnyAy5uqxI72	Fred
	    frOnUcrBFxA0.	FRED
	    loS9ozwAlfL0.	thisstringistoolong
	    on0GQrELiWzlk	onlythefirst8charsareused
	    puTVTxaAZz6sw	I've%got_punc!tu~a$tion*marks?
	    moaj75vMGk/4s	!@$%^&*()~
	};

	my $start = 1;
	for (sort keys %passwords) {
	    my $pass = $passwords{$_};
	    my $crypted = crypt $pass, $_;
	    print "# Expected $_ got $crypted ($pass)\nnot "
		if $_ ne $crypted;
	    print "ok ", $start++, "\n";
	    # Try a false salt
	    my $original = $_;
	    s/^(..)(.*)$/ $1 . reverse $2 /e;
	    $crypted = crypt $pass, $_;
	    print "# crypt is returning the salt!\nnot "
		if $_ eq $crypted;
	    print "ok ", $start++, "\n";
	}

	print "not " unless
	    crypt("fr","someverylongstring") eq
	    crypt("fr","somevery");
	print "ok ", $start++, "\n";
    }

Thanks!

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



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

Date: Sun, 17 Oct 1999 07:10:18 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Exact pattern match
Message-Id: <qqacu7.hk8.ln@magna.metronet.com>

¿€BaX€¿ (paschal1@mindspring.com) wrote:
: I'm trying to get an EXACT match for user names from a flat file,
                       ^^^^^^^^^^^

   Your use of terminology there can help to lead you to the
   wrong solution.

   You want to know if two strings are _eq_ual.

   Use regexs when you require a _pattern_.

   Use eq, index, substr, etc when you can use a constant string.


: Using this:
: ##################################################
:  @names = split(/ +/,$user);
:          foreach $aname (@names) {
:             if ($qfield =~ /\b$aname/i ) {


      if ( $qfield eq $aname ) {

   If you really need the case ignored, then normalize the case
   and use eq on the normalized representations:

      if ( lc($qfield) eq lc($aname) ) {


   If you insist on using the (much slower) regex approach,
   then anchor both ends:

      if ($qfield =~ /^$aname$/i ) {

   And maybe throw in a \Q too...
 

: I need to get only the exact match "SMITH, JOE"
                         ^^^^^^^^^^^

   You are leading yourself astray again there...     :-)


: Thanks for any help that you can provide to this humble novice


   Regexs come easily to your fingers after writing Perl for
   a while.

   Even when they are not the Right Tool For The Job.

   So you have to make a special effort to notice when you hit
   on something where regexs aren't really "best", for some
   values of best.


: Please pardon if I have duplicated a question or
: overlooked some specific documentation which would
: have answered my question.
: I sometimes tend to bump into trees while searching for the forest.


   I can tell by the knot on your forehead, heh heh.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sun, 17 Oct 1999 20:12:33 GMT
From: dillon_rm@magix.com.sg (AcCeSsDeNiEd)
Subject: Help - Can't figure this out
Message-Id: <380a2aca.11379580@news.magix.com.sg>

Hi folks. Firstly, sorry for the intrusion. I know this is not the
right place to post my question, but I have not been able to get into
comp.infosystems.www.authoring.cgi for the past 2 days. Yes, I do know
about their new regulation with first time posters and their "approve"
stuff. But I still don't see my post.

Ok, here's the problem:

I have a search script / form. 
It searches for a bunch of Company Names
This cgi script searches alphabetically.
The user is allowed to select which alphabet from A-Z he wants to
search. For e.g, if he chooses "B", he will get all the company names
starting with the alphabet "B" 

That part is ok.


Now's here's the problem: 

Besides Company Names, I have another item called "Category"
Besides searching for Company Names alphabetically, I also want to
search for "Category" alphabetically.

And for this, we want to make use of the same alphabet table A-Z. 
I'm not allowed to create a second alphabet table A-Z which will
obviously solve the problem. 

I have therefore added two Radio buttons named "Find Company Names by
using an Alphabet" & Find Category Names by using an Alphabet"

I am now stuck here, I don't have idea how to combine the two into one
(Radio and alphabet table A-Z) and sent the info to my cgi script to
be processed. The info that my script must get from the html form are
the radio button selection and the alphabet selected.

I have suggested using radio buttons also in the alphabet table
itself. That means each alphabet A-Z will have a radio button next to
it. But they said no.

I thought of writing two scripts each for the radio buttons and the
alphabet table A-Z. I'm not too sure if this is good.

Hope someone out there can help

Thanks

You can view the html code at:  
http://www.magix.com.sg/users/dillon/alpha_search.html

I've also pasted it here:


<HTML>
<HEAD><TITLE>Select Alpha by Company Name or Category</TITLE>
</HEAD>

<BODY>

<form action="/cgi-bin/alpha_search_1.pl" method="POST">

<INPUT TYPE="radio" NAME="coy_or_cat" VALUE="coy">Find Company Names
by using an Alphabet
<BR>
<INPUT TYPE="radio" NAME="coy_or_cat" VALUE="cat">Find Category Names
by using an Alphabet

<BR><BR>

      <table width='100%' border=3 cellspacing=0 cellpadding=2
bordercolor=666699>
        <tr bgcolor=ffffcc> 
          <td colspan=2> 
            <div align=center><b><A href='/cgi-bin/alpha_search_2.pl?
id=0'>#</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=A'>A</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=B'>B</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=C'>C</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=D'>D</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=E'>E</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=F'>F</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=G'>G</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=H'>H</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=I'>I</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=J'>J</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=K'>K</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=L'>L</a></b></font></div>
          </td>
        </tr>
        <tr bgcolor=ffffcc> 
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=M'>M</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=N'>N</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=O'>O</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=P'>P</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=Q'>Q</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=R'>R</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=S'>S</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=T'>T</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=U'>U</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=V'>V</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=W'>W</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=X'>X</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=Y'>Y</a></b></font></div>
          </td>
          <td> 
            <div align=center><b><A
href='/cgi-bin/alpha_search_2.pl?id=Z'>Z</a></b></font></div>
          </td>
        </tr>
      </table>
</FORM>

</BODY>
</HTML>

To e-mail me, remove "_rm"

PGP Key on Keyservers
Key ID: 0x27D16A6F
Fingerprint: 8B3E DEF8 216E 04BD C12E  53AC 86F3 BCD6 27D1 6A6F


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

Date: Sun, 17 Oct 1999 19:10:53 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: How to inquire, position and click the mouse in PERL?
Message-Id: <1bpO3.12499$E_1.694993@typ11.nn.bcandid.com>

In article <7u8kp1$5hh$1@news.hal-pc.org>, Nim Chu <nimchu@hal-pc.org> wrote:
>Perlfaq8 talks about text-based cursor which is not what I need. But
>it also mentions TK which is a graphics package for Perl. But TL only
>(may be I am wrong) manipulates the cursor only when the cursor is in
>TK's graphical windows, not when it is outside TK's window.

You are correct.  But I don't know the answer to your question. 
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Sun Oct 17 1999
23 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sun, 17 Oct 1999 20:06:43 GMT
From: "Silencer" <mdawson106@home.com>
Subject: New To Perl
Message-Id: <n%pO3.34821$K5.343532@news1.rdc1.bc.home.com>

Hey, I'm new to perl. I've been reading a lot on the language and how it
works and this sorta stuff, and now I'm ready to start making some programs.
I'm on a Win98 system and I'm planning on writing the programs for a web
page on one of those free based web page companies(Geocities/Xoom/Tripod).
But I don't know what I need to get started... do I need just 1 single file
and then upload it to my account? I know I need some sort of compiler, but
where do I get it, and how do I use it?




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

Date: Sun, 17 Oct 1999 20:25:10 GMT
From: "Craig Vincent" <2bunnyhop@home.com>
Subject: Re: New To Perl
Message-Id: <GgqO3.5888$P6.323424@news2.rdc1.on.home.com>

Geocities, Xoom and Tripod don't support CGI to its users.  Meaning besides
standard HTML and anything that can be embedded directly in that HTML are
not usable.  Hence, Perl, C, (probably PHP) etc... will not work.  You need
to find a free host that gives you a CGI-BIN (or reasonable facsimile).
There are hosts that do that....I used to use them myself until I got my own
server.

Sincerely,

Craig Vincent

Silencer <mdawson106@home.com> wrote in message
news:n%pO3.34821$K5.343532@news1.rdc1.bc.home.com...
> Hey, I'm new to perl. I've been reading a lot on the language and how it
> works and this sorta stuff, and now I'm ready to start making some
programs.
> I'm on a Win98 system and I'm planning on writing the programs for a web
> page on one of those free based web page companies(Geocities/Xoom/Tripod).
> But I don't know what I need to get started... do I need just 1 single
file
> and then upload it to my account? I know I need some sort of compiler, but
> where do I get it, and how do I use it?
>
>




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

Date: Sun, 17 Oct 1999 19:27:00 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Opinions? Efficiency & Drain of Pack/UnPack
Message-Id: <8qpO3.12524$E_1.690157@typ11.nn.bcandid.com>

In article <38072071.979AF582@home.com>, Paul D  <pdobbs@home.com> wrote:
> I've been working on a couple of nifty scripts here, and think I may
>be drawing on the use of Pack and Unpack alot, so I just want to ask;
>
> Is the use of Pack and Unpack a significant strain on a system? IE:
>Does it make a script particularly slower and in need of more system
>resources/memory to do these two functions?

pack and unpack don't need much memory or much time.  Try the Benchmark
module if you want to quantify the time, and the top command if you
want to quantify the memory.

My guess: they are much slower than defining structs in C, but probably
considerably faster than extracting substrings with substr() and
decoding them in Perl.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Sun Oct 17 1999
23 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sun, 17 Oct 1999 20:21:32 GMT
From: jwag@usa.net
Subject: Re: Positioning the Cursor on a terminal
Message-Id: <7udb46$b79$1@nnrp1.deja.com>

   [courtesy cc of this posting mailed to cited author]

In article <37e66a9f@cs.colorado.edu>,
  tchrist@mox.perl.com (Tom Christiansen) wrote:
>
> # this is expected to be @INC, and is supplied
> use Errno::Msgs;

Was this supplied?  I don't see it.

Thanks,
jwag


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


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

Date: 17 Oct 1999 19:09:08 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: qr operator the $_
Message-Id: <7ud6sk$bs6$1@rguxd.viasystems.com>

Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
:>[A complimentary Cc of this posting was sent to lt lindley 
:><lee.lindley@bigfoot.com>],
:>who wrote in article <7ud38q$ant$2@rguxd.viasystems.com>:
:>> Oops.  Spoke too soon.  :-( Maybe there is a little magic in
:>> the qr{} operator after all.  
[snip]
:>> The funny thing is that if I examine them in the debugger
:>> they look identical.

:>Try C<ref>.  ;-)

main::(x:3):    my $string_re = '(?-xism:some(?{print "too true"}))';
  DB<1>
main::(x:4):    my $compiled_re = qr'some(?{print "too true"})';

  DB<1> x $string_re
0  '(?-xism:some(?{print "too true"}))'
  DB<2> x $compiled_re
0  (?-xism:some(?{print "too true"}))
   -> undef
  DB<3> p ref $compiled_re
Regexp

So it isn't exactly a "simple" string.  It is a blessed scalar
object.

As you said though.  It is an implementation detail.  I can be
oblivious and treat qr{} like a quoting operator and it will almost
always work like I expect.

Thanks.
-- 
// Lee.Lindley   /// I used to think that being right was everything.
// @bigfoot.com  ///  Then I matured into the realization that getting
////////////////////   along was more important.  Except on usenet.


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

Date: Sun, 17 Oct 1999 19:11:54 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: THANKS FOR ALL THE HELP
Message-Id: <slrn80k6c2.319.*@dragons.duesouth.net>

On Sun, 17 Oct 1999 20:39:12 +0200, Alex Rhomberg
<rhomberg@ife.ee.ethz.ch> held some poor sysadmin at gunpoint, and typed
the following into comp.lang.perl.misc: 
: Matthew Bafford wrote:
: mb> : What happens on 1 January 2000???
: mb> 
: mb> Exactly what you want!!!
: 
: Wow!! can I write a wishlist of what I want to happen then?

Yep!!  Remember, perl DWYM.
 
: - Alex

--Matthew             
-- 
Remember, question marks and exclamation marks are on
the endangered characters list.   Please refrain from
using them excessively or where not required, lest we
loose them forever.


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

Date: Sun, 17 Oct 1999 19:55:33 GMT
From: david@see.signature.uk
Subject: Re: Trouble using I/O handles in recursive sub
Message-Id: <380b1fc9.8326381@news.globalnet.co.uk>

On 12 Oct 1999 16:22:05 +0200, bardsk@math.ntnu.no (Bård Skaflestad) wrote:

>Hi all you Perl gurus out there.  I am writing this in a hope that my
>limited knowledge of Perl may become extended and augmented.

In my case the term "guru" is inapplicable. I'm a relative newbie, about
six months into perl. Anyway, I haven't tried to analyse your problem in
detail but one thing jumped out of the screen at me which might be worth
following up. See below.
 
>
>The situation is as follows:  I have a number of LaTeX source code
>text files, which in LaTeX parlance may be described as "master"
>files.  This term is not important, and you do not have to have a
>knowledge of LaTeX to help me.  These files look more or less like
>
>   \documentclass[a4paper,12pt]{article}
>   ...
>   \begin{document}
>   ...
>   \input{foo}
>   ...
>   \include{bar}
>   ...
>   \end{document}
>
>in which the ellipsis denote any number of lines of text.  The task at
>hand is to parse the file and *insert* the contents of the files
>mentioned inside the {} construct of \input or \include.  The files to
>be inserted may themselves \include or \input other files, so a
>recursive procedure may be called for. 
>
>This is what I have tried so far:
><code>
>sub parse_file($$)
>{
>    # Parses an ASCII text file assumed to contain LaTeX source code
>    # printing its contents as well as the contents of any  \input  or
>    # \include -d  files within this.
>    #
>    # Calling sequence:
>    #
>    #   parse_file($file, $parse_level);
>    #
>    # Parameters:
>    #
>    #   $file:        Name of file to parse.
>    #   $parse_level: Integer specifying the current recursion level
>    #                 in the parse tree.  $parse_level < 10  in order
>    #                 to make a successfull parse.
>    #
>
>    my($MaxLevel, $file, $newfile, $parse_level, $line, $IOhandle);
>
>    $MaxLevel = 10;
>
>    ($file, $parse_level) = @_ if @_;
>
>    if ($parse_level >= $MaxLevel) {
>	die "parse_file(): Internal limits exceeded.  Too much", 
>	" recursion depth.  Stopped ";
>    }
>
>    if ($file ne "STDIN") {
>	open(IN, "$file") or die "Could not open $file: $!";
             ^
             |
I think this could be the problem. Isn't IN a global symbol at this point.
Therefore, when you recurse into the sub, IN still refers to the previously
opened file. Opening a filehandle that's already open closes the previous
file. Hence, when you've recursed all the way in, there's nothing more left
to do because you've closed all the files you were reading except the last
one. Solving this _may_ therefore be as simple as declaring "local *IN;" at
the top of the sub (it's a typeglob, so you can't make it a lexical).
Having localised *IN, I think you can drop the $IOhandle stuff as well and
just have <IN> in the loops below. It would be a heap more legible.


> 	$IOhandle = *IN{IO};
>    }
>    else {
>	$IOhandle = *STDIN{IO};
>    }
>
>  INPUT:    while (defined $IOhandle) {
>      $line = <$IOhandle>;
>      
>      if (defined $line) {
>	  if ($line =~ /^\\in(put|clude){(.*)}$/) {
>	      print STDERR "Parsing \\in$1 file: $2 \.\.\.\n";
>	      $newfile = join('.', "$2", "tex"); # Not flexible       
>	      parse_file("$newfile", $parse_level+1); #BUG!
>	  }
>	  else {
>	      print $line;
>	  }
>      }
>      else {
>	  print STDERR "Done parsing: $file\n";
>	  last INPUT;
>      }
>  }
>} # End of  parse_file()
></code>
>
>This *almost* work in the sense that source files are being entered
>recursively, and some of their contents are printed, but when the sub
>has finished parsing the innermost included file, all parsing is
>stopped and the stack is unwound.  I *think* this is related to my use
>of indirection in trying to refer generically to an input stream using
>the variable  $IOhandle, but I may be wrong.  It may after all be
>extremely dumb to use references; I have to admit I have not fully
>understood them, but it seemed a good idea at the time. 
>
>From various print() statements I have been able to ascertain the fact
>that the value of  $IOhandle  does not change when the sub is called
>recursively and this may be a cause of my problems. 
>
>Anyway, any and all comments or criticism is indeed very welcome.
>Thanks in advance and sorry about the long post.

Good luck. Let me know whether it worked.


+------------------------------+
|                              |
| David Chapman,               |
| Glastonbury, Somerset, UK.   |
|                              |
| <david@dapc.globalnet.co.uk> |
|                              |
+------------------------------+


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

Date: Sun, 17 Oct 1999 14:26:01 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
To: Jim <golf@tfz.net>
Subject: Re: TUTORIAL
Message-Id: <380A22C9.B4517E36@mail.uca.edu>

[ss'd to j]

Jim wrote:
> 
> Where can I get a download a perl tutorial for windows. I am a beginner with
> perl, but have other programming experience.
> 
> Jim

Go to your nearest bookstore (or www.oreilly.com) and download a copy of
"Learning Perl on Win32 Systems." It will cost you $29.95 (US), but you
will not find a better tutorial around. If your time is not worth $29.95
for the bunches of hours you will take downloading less comprehensive
tutorials (let's face it, almost nothing you can find on the net is as
extensive - and correct), then you need to find a higher paying job.

Cameron

Oh, and if someone comes back with the "Perl CD Bookshelf" remember Jim
was just looking for a tutorial.

-- 
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu


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

Date: 17 Oct 1999 20:15:48 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Uses of #
Message-Id: <7udapk$eqj$1@towncrier.cc.monash.edu.au>

Kragen Sitaker wrote:
> You want to parse Perl.  Only perl can parse Perl, my friend.

Actually, at the level the original poster wanted, it turns out that
Perl can parse Perl too. ;-)

Take a look at Text::Balanced -- in particular how the extract_quotelike,
extract_variable, and extract_codeblock subroutines conspire to do a fair
imitation of parsing Perl. It would be trivial[*] to adapt these three to
compress Perl code by extracting comments and non-quoted multiple whitespace.


Damian

[*] ...for sufficiently non-trivial values of "trivial"...


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

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


------------------------------
End of Perl-Users Digest V9 Issue 1102
**************************************


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