[12008] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5608 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 9 13:07:12 1999

Date: Sun, 9 May 99 10:00:13 -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           Sun, 9 May 1999     Volume: 8 Number: 5608

Today's topics:
    Re: CGI.pm <ffchopin@worldnet.att.net>
        Free Perl Web Database w/ full source code - comments e (Jeff Vannest)
    Re: Fun with lists <rick.delaney@home.com>
    Re: Fun with lists (Larry Rosler)
    Re: Fun with lists <uri@sysarch.com>
    Re: read files in Perl <dimitrio@sympatico.ca>
    Re: Sorting is too slow for finding top N keys... - UPD <gt7202e@prism.gatech.edu>
    Re: tcgrep not expanding command-line wildcards (Bbirthisel)
    Re: Telnet module and perl script to telnet to remote,  (KaledBait)
        Why does NT server return the actual script, not the pr (R. S.)
    Re: Why does NT server return the actual script, not th <ffchopin@worldnet.att.net>
    Re: Why does NT server return the actual script, not th <ffchopin@worldnet.att.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sun, 9 May 1999 00:08:59 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: CGI.pm
Message-Id: <7h323h$h4p$1@bgtnsc01.worldnet.att.net>

[posted and mailed]

jt <jim@printcom.ie> wrote in message
news:7h29j5$b75$1@nclient3-gui.server.ntli.net...
> I have installed CGI.pm into
> usr/local/lib/perl5
> while tring to run scripts which need this module
> I get an error message as follows
>
> Can't find string terminator "END_OF_AUTOLOAD" anywhere before EOF at
> /usr/local/lib/perl5/CGI.pm line 645.
>
> Can any one help

Just curious - CGI.pm comes now as part of the standard Perl distribution
(well, at least 5.004 or 5.005, and maybe earlier; someone else could answer
more definitively).  So...  Why the need to install the module in the first
place?

Jason Simms





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

Date: Sun, 09 May 1999 04:22:28 GMT
From: jefflv@usol.com (Jeff Vannest)
Subject: Free Perl Web Database w/ full source code - comments encouraged - db_Perl_Database_100.zip (0/1)
Message-Id: <37350af0.58208182@news.usol.com>

Here is a little hobby project I've been working for some time now....

This is the first time I've made it public, so I'm hoping some of you
will want to look at it and even use it if it is beneficial.  I'm not
a perl guru..but I did spend a year as a web tech, so my syntax is
normally fluent, but not polished.  (be kind  :-)

Enjoy,
Jeff Vannest
ABigWuss
jefflv@bigfoot.com

+++++++++++++++++++++++++++++++++++++++++++++++++++

The db_Perl Database is a free, single-table database for websites. It
may be used as an online Address Book, Guestbook, Library, collection
of links, or any other application requiring an interactive query from
the web.

Although I am a database applications designer by profession
(Pharmaceutical and Biotech applications on an Oracle platform), I
must admit that this little database has been my pet project for many
years now.  In fact, it was in part due to this project that I
received my first computer related job ever as a web tech several
years ago.  It is my intention to distribute these files not because
it's the greatest thing every built, but because I keenly remember
what it was like to develop a web site for $50 bucks a pop (chump
change).  I hope that this tool finds its home in many church,
non-profit and personal web sites around the world, and that it is as
useful to others as it has been to me.

The database may be configured by the webmaster in the following ways:

- All HTML files (except this one :-) may be modified by the
webmaster.   This means that if the webmaster doesn't like the look of
these pages, they may be modified to fit the look and feel of the host
site, or an entirely new design.  In addition, any HTML editor may be
used to update these pages as long as the files exist in the same
directory as the perl database scripts, and the keyword
"custom_form_results_go_here" is placed where the database output is
to be placed on the page. 

- Each HTML page (Search, Add, Change, Delete, Results, Directions)
exists separately to allow the webmaster to place ads, custom
instructions, etc. on each page as desired. 

- Since the HTML pages are in every sense normal HTML pages (other
than being oddly placed in the cgi-bin directory  :-), they may be
used under software like Microsoft FrontPage to apply a standardized
themes, headers and footers, etc. throughout the site. 

- The following variables may be set for automatic output into the
HTML pages by the db_Perl database engine: Company/Organization  Name,
Application Name (name of database), Webmaster Name, Webmaster E-mail.


- The database engine is fairly insulated to software and hardware
crashes, and should be accessible to multiple users without fear
conflicting file operations.  Further, since a hybrid method of data
access (part random and part sequential)  is used, if the server goes
down, or the operation times out to the browser, no critical data is
left in memory, and the data file should still remain intact.   It is
still suggested, however, to backup your data frequently. 

- The number and name of  table columns is completely configurable.
Further, user-friendly names like "First Name," may be used as a
column name instead of the "f_name" syntax required by most databases.


- The webmaster may decide whether each column is required when a
record is added/changed. 

- The webmaster may decide the maximum field size for each column. 

- The webmaster may decide whether embedded HTML is allowed within
each field. 

- The webmaster may decide whether the database prints results in
landscape (spreadsheet) or block (paragraph) format. 

- The webmaster may choose whether users are allowed to Add, Change or
Delete records from the database. 

- Any number of distinct databases may exist on the same web site as
long as each "instance" has it's own directory with all of the
distributed files.  This means that a single site may have an Address
Book, Guestbook and Movie Review Database - each of them having
different public accessibility, interactivity and design. 

- There is no physical limit to the number of records the database
could support - however a practical limit will be set by your hardware
and memory limitations. 

- Although the database engine seems quite stable, it must be stressed
that it should never be used for secure or irreplaceable data. 


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

Date: Sun, 09 May 1999 01:03:24 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Fun with lists
Message-Id: <3734DE84.E8E7E688@home.com>

[posted & mailed]

Larry Rosler wrote:
> 
> From Another Larry:  Hash slices are your friend.  (See Uri Gellman's
                                                              ^^^^^^^
> recent postings.)

Not sure if this is a private joke between you and Mr. Guttman, but for
the benefit of any looking for those recent postings,

    y/el/ut/;

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Sat, 8 May 1999 18:53:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Fun with lists
Message-Id: <MPG.119e8a8532fa6646989a16@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <3734DE84.E8E7E688@home.com> on Sun, 09 May 1999 01:03:24 
GMT, Rick Delaney <rick.delaney@home.com> says...
> Larry Rosler wrote:
> > From Another Larry:  Hash slices are your friend.  (See Uri Gellman's
>                                                               ^^^^^^^
> > recent postings.)
> 
> Not sure if this is a private joke between you and Mr. Guttman, but for
> the benefit of any looking for those recent postings,
> 
>     y/el/ut/;

Uri Geller is a famous^Wnotorious Israeli magician^Wcharlatan.  The 
insulation of my brain wiring is fraying and may need to be replaced.

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


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

Date: 09 May 1999 00:06:06 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Fun with lists
Message-Id: <x7lneysx8x.fsf@home.sysarch.com>

>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:

  LR> [Posted and a courtesy copy sent.]
  LR> In article <3734DE84.E8E7E688@home.com> on Sun, 09 May 1999 01:03:24 
  LR> GMT, Rick Delaney <rick.delaney@home.com> says...
  >> Larry Rosler wrote:
  >> > From Another Larry:  Hash slices are your friend.  (See Uri Gellman's
  >> ^^^^^^^
  >> > recent postings.)
  >> 
  >> Not sure if this is a private joke between you and Mr. Guttman, but for
  >> the benefit of any looking for those recent postings,
  >> 
  >> y/el/ut/;

  LR> Uri Geller is a famous^Wnotorious Israeli magician^Wcharlatan.  The 
  LR> insulation of my brain wiring is fraying and may need to be replaced.

when he was in his 15 minutes, i was asked many times if we were related
(???) or something. i would respond, "he bends spoons, i bend minds!"
why would having the same israeli first name and last initial make some
connection in people's feeble brains?

back to perl!

tom c. also did some nice work on 'adding' hashes. there is a major
decision if you want the old hash or new hash to override the keys.

search for hpush IIR on p5p or on misc for the sub he wrote. he used a
tight loop since he was checking for override behavior and he didn't
want to unravel the hashes with a list context or with keys/values.

here are some hash 'additions':

# list unravel

%h3 = (%h1, %h2)	# %h2 overrides h1

%h3 = (%h2, %h1)	# %h1 overrides h2

# slice override

%h3 = %h1 ;
@h3{ keys %h2 } = values %h2 ; # %h2 overrides h1. don't know which is faster.

# hash append using slice

@h1{ keys %h2 } = values %h2 ; # %h2 overrides h1.

# hash append with no override (can't do slices here)

!exists $h1{ $key } && $h1{ $key } = $val while ( $key, $val ) = each %h2 ;

# same as above but using ||= (fails with old key eq '' or '0')

$h1{ $key } ||= $val while ( $key, $val ) = each %h2 ;


the cookbook has some of this and other hash stuff so read more there.

see you all when i get back from mexico on the 18th.

uri


-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Sun, 09 May 1999 00:59:47 GMT
From: Dimitri Ostapenko <dimitrio@sympatico.ca>
Subject: Re: read files in Perl
Message-Id: <3734A61D.83D57FD7@sympatico.ca>

Roberto wrote:

> Hi,
> how can I read a file from another url using Perl script?
> Thank you very much
>
>
> -------------------------------------------
>   roberto azzimonti
>   mailto:roberto@mysacramento.com
>   http://www.mysacramento.com/azzimonti
> -------------------------------------------

See examples in www.perlnow.com

Dimitri




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

Date: Sat, 8 May 1999 21:41:08 -0400
From: "andy barfoot" <gt7202e@prism.gatech.edu>
Subject: Re: Sorting is too slow for finding top N keys... - UPDATE
Message-Id: <7h2p4u$pkh$1@news-int.gatech.edu>


Michel Dalle wrote in message <7h260m$t07$1@xenon.inbe.net>...
>In article <7h24na$sfp$1@xenon.inbe.net>, michel.dalle@usa.net (Michel
Dalle) wrote:
>>Hi,
>>
>>I've had a funny experience with using sort. Can anyone tell
>>me why perl sorts so slowly sometimes, depending on the
>>values to be sorted ?
>>
>I forgot to mention my third test :
>
>3) forget about the sort in Perl, and build my own :


This is a good idea, because the sort  time is proportional
to n log n.  That is, if it takes s seconds to sort n elements,
it'll take at least
    s * (1000n log 1000n) / n log n
seconds to sort 1000n elements.  We can build our own
and get s*1000 instead.  Plus, we can avoid copying
huge temporary lists.



>
>@topn = ();
>$count = 0;
>while (($key,$val) = each %hash) {
>        if ($count <= $n) {
>   ....
>        }
>        else {
>                if ($val > $hash{$topn[0]}) {
>                        pop(@topn);
>                        unshift(@topn,$key);
>                }

Imagine the hash had the keys 0..1,000,000, and
the values were the same as the keys. Also, pretend
    each %hash
was giving us the keys in ascending order.  Then,
    ($val > $hash{$topn[0]})
would always be true and we'd end up with
the last $n+1 elements, not the least $n of
the elements.


Try this..

@top = ();
while (($key,$val) = each %h) {
     push @top,$key;
     if (20 == @top) {
          @top = sort {h{$a}<=>$h{$b}} @top;
          while (($key,$val) = each %h) {
                @top = sort {h{$a}<=>$h{$b}} $key,@top[1..$#top]
                      unless $val > $h{$top[-1]};
          }
          last;
     }
}

The while loops are nested, rather than
put one after another, so that a list with
exactly 20 elements is handled.

Note the second 'each' doesn't 'reset the
bookmark' in %h used by the first 'each'.
We consider each element once.

Of course, i didn't check my code, either.
:P


--
    andy barfoot, JAPH



>
>Michel.
>




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

Date: 9 May 1999 01:55:43 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: tcgrep not expanding command-line wildcards
Message-Id: <19990508215543.20540.00000167@ng57.aol.com>

Hi Eric:

>   Thanks for letting me know about this. I was surprised to think that
>any version of Perl running on a Win32 system WOULDN'T automatically
>support ambiguous filespecs (or "filename globbing" as they say now).
>Given that the installation program knows its running under Windows, and
>not under (say) bash or tcsh, I would think it ought to add the glob
>expansion automatically.

Actually, quite a few Windows users run under replacement shells
including bash and 4DOS. The default braindead versions aren't
even compatible with each other between all Windows varients.
You end up with real "ambiguous filespecs" instead of "wildcard
file selection".

-bill


Making computers work in Manufacturing for over 25 years (inquiries welcome)


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

Date: Sun, 09 May 1999 04:32:41 GMT
From: smith157@marshall.edu (KaledBait)
Subject: Re: Telnet module and perl script to telnet to remote, perform commands and log output
Message-Id: <37350f5e.6394290@news.fuse.net>

On Sat, 08 May 1999 23:35:02 GMT, smith157@marshall.edu (KaledBait)
wrote:

Ok you can ignore all the previous posts :-)

Now I've got to a new problem....

I can do commands one of two ways on a remote server....

1)

@lines = $telnet->print('ls -l -a');
print @lines;

which produces:

1

or 2)

print $telnet->cmd('ls -l -a');

which produces

mrspoon

Neither of those is the directory listing....mrspoon happens to be the
username I am using for this program....

Cna anyone help me view output coming from my remote server ?

Cheers,

KaledBait - smith157ATmarshall.edu


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

Date: Sun, 09 May 1999 02:12:12 GMT
From: rstacy@nf.sympatico.ca (R. S.)
Subject: Why does NT server return the actual script, not the print items.
Message-Id: <3734ef5a.114521820@news1.sympatico.ca>

I am attempting to have a perl script return anything to a browser but
all I can get is the actual script itself. The .pl is associated with
the perl.exe on the server and works when executed on the server but
when I execute the script from a browser I get a copy of the script
itself. 



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

Date: Sat, 8 May 1999 23:55:18 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: Why does NT server return the actual script, not the print items.
Message-Id: <7h319n$d34$1@bgtnsc01.worldnet.att.net>

> I am attempting to have a perl script return anything to a browser but
> all I can get is the actual script itself. The .pl is associated with
> the perl.exe on the server and works when executed on the server but
> when I execute the script from a browser I get a copy of the script
> itself.

Your problem is that the web server itself is unaware that it needs to "run"
your scripts with perl.exe.  Since you have not included any information
that is in any way helpful (OS, server type, etc.), all I can say is read
the documentation that came with your server, as well as the docs included
with Perl on making it work with a web server.  This is NOT, however, a true
Perl question, as the fault is with your server software...

Jason Simms




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

Date: Sun, 9 May 1999 00:00:02 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: Why does NT server return the actual script, not the print items.
Message-Id: <7h31ik$egs$1@bgtnsc01.worldnet.att.net>

> Your problem is that the web server itself is unaware that it needs to
> "run" your scripts with perl.exe.  Since you have not included any
> information that is in any way helpful (OS, server type, etc.), all I can
> say is read

Forgot your ref to NT in the subject line...  Of course, NT could be most of
your problrm in the first place (sort of joking).  Anyway, my advice still
stands - though if you are using ActiveState Perl, then it should associate
itself with you CGI / Web scripts for you during installation (at least, it
asks you if you wish to do so).

Jason Simms





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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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