[14050] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1460 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 22 21:07:50 1999

Date: Mon, 22 Nov 1999 18:05:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <943322714-v9-i1460@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 22 Nov 1999     Volume: 9 Number: 1460

Today's topics:
    Re: [JOB]: Web Developer/Senior Web Developer: SGML, XM (David H. Adler)
        A Cyber-Cigar for any Expert Help with Image Buttons colorcard@my-deja.com
    Re: can i view the perl program <cassell@mail.cor.epa.gov>
    Re: Case statement syntax <rootbeer@redcat.com>
    Re: Catching STDOUT to an array <rootbeer@redcat.com>
        Clearing QUERY_STRING (Jeff Givens)
    Re: Combined class+object method? (Bart Lateur)
        Core dump in Perl_my_pclose (Peter Heimann)
    Re: Debugging from CGI (Jeff Givens)
        Embedding text content into HTML templates with Perl (J. Kenton)
    Re: Embedding text content into HTML templates with Per <cassell@mail.cor.epa.gov>
    Re: exists causes internal server errors!! <rootbeer@redcat.com>
    Re: Getting HTML tags via regular expression <gisle@aas.no>
        GMT Time hdesa22@my-deja.com
    Re: GMT Time <latsharj@my-deja.com>
    Re: GMT Time <cassell@mail.cor.epa.gov>
    Re: GMT Time <lr@hpl.hp.com>
    Re: Help w/ DBI (Abigail)
    Re: Help with TCP sockets please marius_13@my-deja.com
    Re: Help with TCP sockets please <lr@hpl.hp.com>
    Re: Help with TCP sockets please koverton@my-deja.com
    Re: Help with TCP sockets please hdesa22@my-deja.com
        Hiding password in URL <hxshxs@my-deja.com>
    Re: Hiding password in URL kov@mit.edu
    Re: How do I take all of the email addresses out of an  <lr@hpl.hp.com>
    Re: How do I take all of the email addresses out of an  <poohba@io.com>
    Re: How do I take all of the email addresses out of an  <poohba@io.com>
    Re: How do I take all of the email addresses out of an  <cassell@mail.cor.epa.gov>
    Re: How to use value in HTML form ? <rootbeer@redcat.com>
    Re: How write records to ASCII file (Abigail)
        Can Perl read gif pixels? <burton@REMOVETHIS.lucent.com>
    Re: Case Change Text UPPER CASE to Title Case? (Craig Berry)
    Re: Clearing QUERY_STRING (Abigail)
    Re: Clearing QUERY_STRING (Jeff Givens)
    Re: Clearing QUERY_STRING (Martien Verbruggen)
    Re: Clearing QUERY_STRING <flavell@mail.cern.ch>
        Commercial Open Group (COG) development <henning@travellab.com>
    Re: Core dump in Perl_my_pclose <rootbeer@redcat.com>
    Re: Embedding text content into HTML templates with Per <rootbeer@redcat.com>
    Re: GMT Time <rootbeer@redcat.com>
    Re: Help With CyberCash.... (brian d foy)
    Re: How do I take all of the email addresses out of an  (Matthew Bafford)
    Re: How do I take all of the email addresses out of an  (Sam Holden)
        How to write a uploaded file? crackbaby1@my-deja.com
    Re: How to write a uploaded file? <jeff@vpservices.com>
    Re: How to write a uploaded file? (David Efflandt)
        Mammoth Search Engine Question: GURU'S WANTED barrytrot@yahoo.com
    Re: modules <rootbeer@redcat.com>
    Re: New dialect of perl: xperl (or reinventing perl, or <nandu@cimedia.com>
    Re: OT Y2K, was Re: Problematic horizontal scrollbars (Craig Berry)
    Re: OT Y2K, was Re: Problematic horizontal scrollbars <news@elmbronze.demon.co.uk>
        Passing arguments to Perl <beckwith@hiwaay.net>
    Re: Passing arguments to Perl (Abigail)
        Perl Chat <mpolly@tathata.net>
    Re: Refining code <emschwar@rmi.net>
    Re: mailto:Idon'tThinkSo <jeff@vpservices.com>
    Re: mailto:Idon'tThinkSo <nigh_postal@my-deja.com>
        mod_perl,apache,perlauthenhandler <johnmoorhouse@netscapeonline.co.uk>
        modules <sp00fD@yahoo.com>
    Re: modules <cassell@mail.cor.epa.gov>
    Re: New dialect of perl: xperl (or reinventing perl, or (Abigail)
    Re: NT to UNIX Question <cassell@mail.cor.epa.gov>
    Re: OT Y2K, was Re: Problematic horizontal scrollbars (Mark-Jason Dominus)
    Re: OT Y2K, was Re: Problematic horizontal scrollbars <newsposter@cthulhu.demon.nl>
    Re: OT Y2K, was Re: Problematic horizontal scrollbars <dan@tuatha.sidhe.org>
    Re: OT Y2K, was Re: Problematic horizontal scrollbars <news@elmbronze.demon.co.uk>
    Re: OT Y2K, was Re: Problematic horizontal scrollbars <flavell@mail.cern.ch>
    Re: Passing a parameter does not work when it came from <lr@hpl.hp.com>
    Re: passing arrays by reference (Mark-Jason Dominus)
    Re: passing arrays by reference (Damian Conway)
        Query String 0_clock@my-deja.com
    Re: Query String <tony_curtis32@yahoo.com>
    Re: reading binary digits with oct <rootbeer@redcat.com>
        Refining code <nigh_postal@my-deja.com>
    Re: Save As box... printing an image to the screen" (Bart Lateur)
    Re: setuid Programm <rootbeer@redcat.com>
    Re: Sockets. hdesa22@my-deja.com
        Test for eval() without using eval() ?? <mkruse@rens.com>
    Re: Test for eval() without using eval() ?? (Abigail)
    Re: Test for eval() without using eval() ?? <mkruse@rens.com>
    Re: timelocal - strange result lee.lindley@bigfoot.com
    Re: timelocal - strange result (Abigail)
    Re: timelocal - strange result <lr@hpl.hp.com>
    Re: timelocal - strange result <flavell@mail.cern.ch>
    Re: timelocal - strange result <lr@hpl.hp.com>
    Re: timelocal - strange result (Abigail)
    Re: Test for eval() without using eval() ?? <emschwar@rmi.net>
    Re: Test for eval() without using eval() ?? (Abigail)
    Re: Test for eval() without using eval() ?? <rootbeer@redcat.com>
    Re: timelocal - strange result <lr@hpl.hp.com>
        Turing machine (Craig Berry)
        Undefined error message I can't get rid of. <xyf@inetnebr.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 22 Nov 1999 15:05:36 -0500
From: dha@panix.com (David H. Adler)
Subject: Re: [JOB]: Web Developer/Senior Web Developer: SGML, XML, PERL5, LINUX
Message-Id: <slrn83j8gf.6u1.dha@panix.com>

On Fri, 19 Nov 1999 12:29:44 +0000, Richard Padley
<richard@semantico.com> wrote:

>Semantico Limited
>Web Developer/Programmer

You have posted a job posting or a resume in a technical group.

Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.

Had you read and understood the Usenet user manual posted frequently
to "news.announce.newusers", you might have already known this. :)

Please do not explain your posting by saying "but I saw other job
postings here".  Just because one person jumps off a bridge, doesn't
mean everyone does.  Those postings are also in error, and I've
probably already notified them as well.

If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.

Yours for a better usenet,

dha


-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
I see people didn't read the smiley I didn't include.
      - John W. Baxter


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

Date: Mon, 22 Nov 1999 22:11:04 GMT
From: colorcard@my-deja.com
Subject: A Cyber-Cigar for any Expert Help with Image Buttons
Message-Id: <81cf1j$lfn$1@nnrp1.deja.com>

A Cyber-Cigar for anyone who can help me with this one...

I have a form which uses a CGI script (AF2.CGI) for processing
information. I MUST use images for the submit buttons and I am using
multiple submit buttons. If I use standard (non-image) submit buttons
such as
<INPUT TYPE="SUBMIT" NAME="_browser_out" VALUE="preview1.txt">
it works fine, but as soon as I use something like
<INPUT TYPE="IMAGE" SRC="pics\layout2.jpg" NAME="_browser_out"
VALUE="preview1.txt">
it no longer works because the "value" property is always ignored when
using images for buttons--but is required for the CGI to work.
Is there a way to use variable properties using <input
type="hidden"...> commands?
Or, would it be possible to submit these variables using JavaScript?
If you want to see what I'm trying to accomplish, feel free to visit
http://www.colorcard.com/cc/ to see my work-in-progress
Your help is greatly appreciated
Colorcard
http://www.colorcard.com


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


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

Date: Mon, 22 Nov 1999 14:40:17 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: can i view the perl program
Message-Id: <3839C651.521D03FE@mail.cor.epa.gov>

Praburam Conjeevaram wrote:
> 
> HI
> Do i need a CGI_BIN to view my perl program.
> CAn i upload the perl program and view on the IE

It really is not clear what you're asking here.  And that's
not being a nitpicker, because one has to express objectives
precisely in order to program well.

But let me use the PSI::ESP module and see if I can divine your
intent.  Hmmm...  Oh.  You want to see the output of your
program in a browser.

If you want to upload your program to a webserver, your server
has to be set up to recognize Perl as a legitimate scripting
language [but that is an issue to take up with your ISP].
And you may have to use a particular extension like '.pl' or
'.plx' or '.cgi' for your webserver to use the script.
And you may have to put your program in a specific directory.
But again, those are server config issues you should discuss
with your ISP.

If you want to test your programs on your own machine before
uploading them, get a free webserver, set it up on your
machine, get Perl [win32 versino at www.activestate.com] and
let it set itself up for you, configure your webserver to use
Perl, use CGI.pm, and test your own scripts at home.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Mon, 22 Nov 1999 12:35:27 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Case statement syntax
Message-Id: <Pine.GSO.4.10.9911221226270.16575-100000@user2.teleport.com>

On Mon, 22 Nov 1999, Paul wrote:

> I have a simple shell script that checks to see if a name is in a file, if
> it is it writes TRUE into another file, if not it writes FALSE.
> 
> Would someone know the syntax for converting this to perl please ?

You could see the sh2perl program at this URL. :-)

    http://www.cpan.org/authors/Randal_L_Schwartz/

But the real solution is probably to use Perl to replace the program which
is looking to find TRUE or FALSE in a file. Cheers!

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



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

Date: Mon, 22 Nov 1999 12:20:12 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Catching STDOUT to an array
Message-Id: <Pine.GSO.4.10.9911221216300.16575-100000@user2.teleport.com>

On Sun, 21 Nov 1999, Antti-Jussi Korjonen wrote:

> Is it possible to redirect STDOUT or STDERR to an array without
> having to circle it through a file?

I think you're talking about the output from a subroutine. If so, you may
be able to use the one-arg form of select() to choose a tied filehandle
for some output.

Alternatively, you may be able to set up a tied filehandle for both STDOUT
and STDERR.

As another alternative, you may be able to fork a child process to run the
subroutine. If you open a pipe() from the child and redirect the outputs
accordingly, you'll be able to simply read in whatever it outputs. This
may be the only solution if the output is coming from an external program.

Good luck with it!

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



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

Date: Mon, 22 Nov 1999 22:50:40 GMT
From: jgivensXX@adelphiaXX.netXX (Jeff Givens)
Subject: Clearing QUERY_STRING
Message-Id: <3839c7df.19655392@nntp>

I'm having a problem with when a user presses the back button and then
reload and then answers yes to reposting form data, I am getting a script
to execute again. This script adds records to a database. I would like to
have the script only execute once and was thinking along the lines of
clearing out the CGI environment of the POST data.

I'm not having any luck in doing so.

What recommendations can anyone offer?

The database has a key field that is unique; no records will have a
duplicate value for this field. I can check the database before the update
is made for a duplicate, which means the addition shouldn't be made anyway,
but am looking for something more elegant.

Persistent values? I can set a flag - how can I maintain its state?
_________________________________________________________________
JG...                                                 Jeff Givens
         mailto:jgivensXX@adelphiaXX.netXX

"My hovercraft is full of eels."


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

Date: Mon, 22 Nov 1999 22:27:27 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Combined class+object method?
Message-Id: <383bbfef.3115950@news.skynet.be>

Geze wrote:

>Here's how the method is used:
>
>my $obj=MyClass->method("something"); #Constructor, creates "$obj"
>print $obj->method; #this should print "something".
>
>So when it's used as a class-method, it should create an object which holds
>the string passed as an argument. As an object-method, it should simply
>return whatever string the object holds.

I can't see why you want two entirely functionalities to be done by the
same method. Why not "new" and "get"?

>I browsed through several man-pages, but no cigar... Could anyone tell how
>this should be done (or if it's even possible?)?


I think it's mentioned in the "Advanced Perl Programming" book. 

Look at ref() for the first argument. It will return the class name if
you pass an object, but empty if called as a class method, because then
you passed a string.

This contruct is the reason why you may sometimes see:

	sub method {
		my $self = shift;
		my $package = ref($self) || $self;
		...
	}

Now, ANYWAY, $package will contain the class name.

In short:

	sub method {
		my $self = shift;
		if(ref $self) {
			.... # called as an object method
		} else {
			.... # called as a class method
		}
	}

-- 
	Bart.


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

Date: 22 Nov 1999 20:40:28 GMT
From: peter@i3.informatik.rwth-aachen.de (Peter Heimann)
Subject: Core dump in Perl_my_pclose
Message-Id: <81c9ns$7i1$1@nets3.rz.RWTH-Aachen.DE>

This code excerpt crashes the Perl interpreter with a core dump 
in Perl_my_pclose, usually the third time executing the loop body
(5.005_02 and 5.005_03 on Sun Solaris 2.6).

Is this a bug in Perl, or in my code?

# execute an external command and read its output,
# but give up if the external program needs too much time
for ($i=1; $i<8; $i++) {
    eval {
        local $SIG{ALRM} = sub { die "timeout\n" };
        alarm 2;
        # use sleep 5 to demonstrate the problem
        my $pid = open(KID, "sleep 5 |") or die("fork failed: $!\n");
        @result = <KID>;
        close(KID) or die("close failed: $!\n");
        alarm 0;
    };
    if ($@) {
        print("pipe failed: $@");
    }
    print @result;
}

-- 
Peter Heimann           peter@i3.informatik.rwth-aachen.de


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

Date: Mon, 22 Nov 1999 22:55:58 GMT
From: jgivensXX@adelphiaXX.netXX (Jeff Givens)
Subject: Re: Debugging from CGI
Message-Id: <383ac97b.20067855@nntp>

On Tue, 16 Nov 1999 16:41:56 GMT plarson@cheerful.com wrote:

>Can you please tell us in detail how you got it to work? It may have

That wasn't I that posted about the TPC debugger. I've lost the message
that was responded to my initial request so I can't tell you who to ask
directly. Maybe they will see this anyway.

Here we are, looks like it was cpierce1@ford.com (Clinton Pierce). Try
giving him a yell.
_________________________________________________________________
JG...                                                 Jeff Givens
         mailto:jgivensXX@adelphiaXX.netXX

"My hovercraft is full of eels."


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

Date: Mon, 22 Nov 1999 14:46:49 -0600
From: brewer@NOSPAM.iastate.edu (J. Kenton)
Subject: Embedding text content into HTML templates with Perl
Message-Id: <brewer-2211991446490001@mac12332.educ.iastate.edu>

I've got a ton of HTML pages to update to a different, more user-friendly,
format. In addition, a great deal of the content on certain pages needs to
be updated.I have a template which will form the basic structure for all
of these pages.

My problems are two:  Is there a way to reference a tag such that perl
will start dumping the contents of a text file at that beginning point and
stop at a designated stopping point?  That is, if I place a single <p>
(for lack of a better example) tag at the beginning point and a single
</p> at the end point, how can I get perl to dump the content I want in
between?

Second, can I use the same strategy to extract the body portion from the
old pages and automatically dump that content into the new template?

Thanks much in advance.

p.s. I have not found HTML::parser to be of much help in this regard. Is
there something about it that I am missing?


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

Date: Mon, 22 Nov 1999 14:47:48 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Embedding text content into HTML templates with Perl
Message-Id: <3839C814.46059DE9@mail.cor.epa.gov>

J. Kenton wrote:
[snip]
> My problems are two:  Is there a way to reference a tag such that perl
> will start dumping the contents of a text file at that beginning point and
> stop at a designated stopping point?  That is, if I place a single <p>
> (for lack of a better example) tag at the beginning point and a single
> </p> at the end point, how can I get perl to dump the content I want in
> between?

Put your content in a variable like $content and then you can
have a line like

<p>$content</p>

in your code to spit it all out.  Note that this sort of technique
can give you a general page to replace a larger number of pure
HTML pages.  Check out modules like HTML::Template to see more
ways.
 
> Second, can I use the same strategy to extract the body portion from the
> old pages and automatically dump that content into the new template?

Yes.. if you can snag the old content first.  And so...

> p.s. I have not found HTML::parser to be of much help in this regard. Is
> there something about it that I am missing?

Well, I hope it's not the fact that the module names are
case-sensitive, so you have to call it HTML::Parser .  You 
knew that, right?

If you're having trouble subclassing HTML::Parser to get it
to do what you want, look through the deja.com archives of this
newsgroup.  Jonathan Stowe wrote about six examples of this
over a two-week period.  [He was the designated driver.]
His examples should get you going.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Mon, 22 Nov 1999 12:45:36 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: exists causes internal server errors!!
Message-Id: <Pine.GSO.4.10.9911221245060.16575-100000@user2.teleport.com>

On Mon, 22 Nov 1999, Bill Moseley wrote:

> Maybe the 'exists' method isn't defined?

Surely you mean EXISTS. Cheers!

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



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

Date: 22 Nov 1999 21:05:56 +0100
From: Gisle Aas <gisle@aas.no>
Subject: Re: Getting HTML tags via regular expression
Message-Id: <m3yabqgul7.fsf@eik.g.aas.no>

abigail@delanet.com (Abigail) writes:

> Gisle Aas (gisle@aas.no) wrote on MMCCLXXIV September MCMXCIII in
> <URL:news:m3yabrqc6k.fsf@eik.g.aas.no>:
> $$ abigail@delanet.com (Abigail) writes:
> $$ 
> $$ > It will get most pages that use javascript to generate markup wrong.
> $$ > Which isn't uncommon at all.
> $$ > 
> $$ > 
> $$ >     <SCRIPT>
> $$ >         document.write ("<BR>");
> $$ >     </SCRIPT>
> $$ > 
> $$ > will trigger 2 calls to "start", one call to "end", and 2 calls to
> $$ > "text", while a real HTML tokenizer would see 3 tokens: the SCRIPT
> $$ > begin tag, a CDATA section (for which there isn't a call back at all
> $$ > in HTML::Parser), and the end tag for SCRIPT.
> $$ 
> $$ This problem is fixed in the new XS based HTML::Parser.  CDATA is
> $$ signaled with an extra boolean parameter to the text handler.
> 
> 
> I used CPAN.pm to install the latest HTML::Parser (2.25) just before
> writing the above posting, and it still triggered on strings looking like
> tokens inside CDATA.

The XS version is still alpha so it is not indexed by CPAN, but it
should already be stable enough as a replacement for HTML::Parser
2.25.  The latest XS version is available as:

 $CPAN/authors/id/GAAS/HTML-Parser-XS-2.99_13.tar.gz

-- 
Gisle Aas


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

Date: Mon, 22 Nov 1999 21:45:45 GMT
From: hdesa22@my-deja.com
Subject: GMT Time
Message-Id: <81cdi6$kem$1@nnrp1.deja.com>

I need time as GMT rather than the systems time.

Is there a function that I can get the GMT Time from the system date. I
can program an eloborate routine to give me this, however if there is a
function it would help.

Hilaire


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


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

Date: Mon, 22 Nov 1999 22:40:58 GMT
From: Dick Latshaw <latsharj@my-deja.com>
Subject: Re: GMT Time
Message-Id: <81cgpq$mpl$1@nnrp1.deja.com>

In article <81cdi6$kem$1@nnrp1.deja.com>,
  hdesa22@my-deja.com wrote:
> I need time as GMT rather than the systems time.
>
> Is there a function that I can get the GMT Time from the system date.

Ummm... Let's see. Perlfunc. Time related functions. gmtime - wonder if
that's what you are looking for. You would have found it much faster by
looking in the included documentation.

--
Regards,
Dick


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


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

Date: Mon, 22 Nov 1999 15:03:46 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: GMT Time
Message-Id: <3839CBD2.C6C345A2@mail.cor.epa.gov>

hdesa22@my-deja.com wrote:
> 
> I need time as GMT rather than the systems time.
> 
> Is there a function that I can get the GMT Time from the system date. 

Umm, do you by any chance mean the gmtime() function?  Type
this at a command prompt:

perldoc -f gmtime

If you need to go the other way, Time::Local [which comes with
modern Perls] has a timgm() function which will do the trick.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Mon, 22 Nov 1999 15:00:28 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: GMT Time
Message-Id: <MPG.12a36aeaa5695e1e98a256@nntp.hpl.hp.com>

In article <81cdi6$kem$1@nnrp1.deja.com> on Mon, 22 Nov 1999 21:45:45 
GMT, hdesa22@my-deja.com <hdesa22@my-deja.com> says...
> I need time as GMT rather than the systems time.
> 
> Is there a function that I can get the GMT Time from the system date. I
> can program an eloborate routine to give me this, however if there is a
> function it would help.

perldoc -f gmtime

Surprise!

Perhaps you might benefit from taking a quick look through perlfunc, to 
see whatever goodies might have been eluding you.

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


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

Date: 22 Nov 1999 14:47:36 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Help w/ DBI
Message-Id: <slrn83jb5e.m2v.abigail@alexandra.delanet.com>

Adam Levenstein (che@worker.com) wrote on MMCCLXXIV September MCMXCIII in
<URL:news:38393f39.402690722@news.psu.edu>:
\\ 
\\ #/usr/bin/perl -wT
\\ 
\\ use DBI
\\ use CGI;
\\ use strict;
\\ 
\\ Did I goof something? I think the problem is here.

The second character of the first line is wrong.



Abigail
-- 
perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 22 Nov 1999 18:59:45 GMT
From: marius_13@my-deja.com
Subject: Re: Help with TCP sockets please
Message-Id: <81c3qu$cj0$1@nnrp1.deja.com>



> CLIENT:
> =======================================
>1 socket(SOCK, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
>2 connect (SOCK, $paddr)                     or die "connect: $!";
>3    print "msg 1\n";             <--- Printed
>4    print SOCK "Hello\n";
>5    print "msg 2\n";             <--- Printed
>6    $msg = <SOCK>;
>7    print "msg 3\n";             <--- Not printed

I've been debugging by connecting to the echo server, and it seems that
the problem is with line 4.  Does anyone see a problem with that line?


Brian


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


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

Date: Mon, 22 Nov 1999 12:40:35 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Help with TCP sockets please
Message-Id: <MPG.12a34a1caf4ab38e98a253@nntp.hpl.hp.com>

In article <81c3qu$cj0$1@nnrp1.deja.com> on Mon, 22 Nov 1999 18:59:45 
GMT, marius_13@my-deja.com <marius_13@my-deja.com> says...
> 
> > CLIENT:
> > =======================================
> >1 socket(SOCK, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
> >2 connect (SOCK, $paddr)                     or die "connect: $!";
> >3    print "msg 1\n";             <--- Printed
> >4    print SOCK "Hello\n";
> >5    print "msg 2\n";             <--- Printed
> >6    $msg = <SOCK>;
> >7    print "msg 3\n";             <--- Not printed
> 
> I've been debugging by connecting to the echo server, and it seems that
> the problem is with line 4.  Does anyone see a problem with that line?

Set the socket stream to be unbuffered.

{
    my $oldfh = select SOCK;
    $| = 1;
    select $oldfh;
}

I'll spare you the one-liner version of that, which is for Perl Golf 
sadists only.

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


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

Date: Mon, 22 Nov 1999 21:46:32 GMT
From: koverton@my-deja.com
Subject: Re: Help with TCP sockets please
Message-Id: <81cdjl$kf3$1@nnrp1.deja.com>

A quick question Marius (I'm doing similar stuff right now, so maybe we
can help each other out): have you telnetted to your server's port to
see if you can communicate that way?  That's my preferred way of testing
this stuff and I find it works pretty well.

Also, I tend to use the objects this way:

$server = IO::Socket::INET->New(LocalPort => 8888, Type => SOCK_STREAM,
Proto => 'tcp', Reuse => 1, Listen => 10) || die ...

but I don't see any reason why mine should work and yours shouldn't.

-- kov


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


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

Date: Mon, 22 Nov 1999 22:12:42 GMT
From: hdesa22@my-deja.com
Subject: Re: Help with TCP sockets please
Message-Id: <81cf4m$lg7$1@nnrp1.deja.com>

This is in regard to NT.....

FYI

I chased the TCP socket rabbit for about 4 days until I finally
stumbled on this code. It works perfectly (in NT). I had to comment out
the fork parts.

Hope it helps.

-----------------------------
Client
 ------------------------------
#!./perl

$pat = 'S n C4 x8';
$inet = 2;
$echo = 7;
$smtp = 25;
$nntp = 119;
$test = 2345;

$SIG{'INT'} = 'dokill';

$this = pack($pat,$inet,0,   127,0,0,,1);
$that = pack($pat,$inet,$test,127,0,0,1);

if (socket(S,2,1,6)) { print "socket ok\n"; } else { die $!; }
if (bind(S,$this)) { print "bind ok\n"; } else { die $!; }
if (connect(S,$that)) { print "connect ok\n"; } else { die $!; }

select(S); $| = 1; select(stdout);

#if ($child = fork) {
    while (<STDIN>) {
#        print S;
select(S); $| = 1; select(stdout);
    }
    sleep 3;
    do dokill();
#}
#else {
    while (<S>) {
	print;
    }
#}

sub dokill { kill 9,$child if $child; }


--------------------------------------------
Server
--------------------------------------------
#!./perl

$pat = 'S n C4 x8';
$inet = 2;
$echo = 7;
$smtp = 25;
$nntp = 119;

$this = pack($pat,$inet,2345, 0,0,0,0);
select(NS); $| = 1; select(stdout);

if (socket(S,2,1,6)) { print "socket ok\n"; } else { die $!; }
if (bind(S,$this)) { print "bind ok\n"; } else { die $!; }
if (listen(S,5)) { print "listen ok\n"; } else { die $!; }
for (;;) {
    print "Listening again\n";
    if ($addr = accept(NS,S)) { print "accept ok\n"; } else { die $!; }

    @ary = unpack($pat,$addr);
    $, = ' ';
    print @ary; print "\n";

    while (<NS>) {
	print;
	print NS;
    }
}




HIlaire




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


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

Date: Mon, 22 Nov 1999 21:23:11 GMT
From: Howard <hxshxs@my-deja.com>
Subject: Hiding password in URL
Message-Id: <81cc7p$jdo$1@nnrp1.deja.com>

Hi, everytime I pass a parameter through gateway, that parameter will
show up in the URL in the following format.

http://www......../test.pl?name=blabla

I wonder if there is a easy way to hide the parameters in Perl/CGI?

for example, sometimes this parameter is a password...

Thanks.

Howard


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


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

Date: Mon, 22 Nov 1999 21:34:29 GMT
From: kov@mit.edu
Subject: Re: Hiding password in URL
Message-Id: <81cct5$jti$1@nnrp1.deja.com>

In article <81cc7p$jdo$1@nnrp1.deja.com>,
  Howard <hxshxs@my-deja.com> wrote:
> Hi, everytime I pass a parameter through gateway, that parameter will
> show up in the URL in the following format.
>
> http://www......../test.pl?name=blabla&password=oops
>
> I wonder if there is a easy way to hide the parameters in Perl/CGI?

If you absolutely must use GET method, I've not found a way to do it.
However, a workaround is to have test.pl issue a Redirect instead of
outputting HTML itself.  That way the test.pl URL with query_string
won't normally show up in the browser (unless your script barfs, or
things hang, take too long, um, and maybe some other stuff...). Anyway,
I've lived with it in the past.

-- kov


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


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

Date: Mon, 22 Nov 1999 13:33:01 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How do I take all of the email addresses out of an email? 2 of  2
Message-Id: <MPG.12a356671847cd2598a254@nntp.hpl.hp.com>

In article <Pine.LNX.4.10.9911221528580.1467-100000@fnord.io.com> on 
Mon, 22 Nov 1999 15:29:25 -0500, Poohba <poohba@io.com> says...
> Thank you very much for your help.  Just one more thing.  How do i keep
> out the repeats?

Use a hash.  See perlfaq4: "How can I extract just the unique elements 
of an array?"

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


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

Date: Mon, 22 Nov 1999 15:29:25 -0500
From: Poohba <poohba@io.com>
To: Tad McClellan <tadmc@metronet.com>
Subject: Re: How do I take all of the email addresses out of an email? 2 of 2
Message-Id: <Pine.LNX.4.10.9911221528580.1467-100000@fnord.io.com>

Thank you very much for your help.  Just one more thing.  How do i keep
out the repeats?

	      *		Web Page Designs	  *
	     / poohba@io.com  |  www.io.com/~poohba\
	     ---------------------------------------
	     \ For info about me send message with /
	      *      subject "send file help"     * 
		



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

Date: Mon, 22 Nov 1999 16:26:41 -0500
From: Poohba <poohba@io.com>
Subject: Re: How do I take all of the email addresses out of an email? 2 of 2 (fwd)
Message-Id: <Pine.LNX.4.10.9911221626030.27415-100000@eris.io.com>

For all of your information.  I have a lot of friends that were forwarded
a letter.  This letter however was an invalid letter.  The letter itself
consists of many email addys.  at least 205 of them.  I don't know all of
these people but close to half of them.  Before they send this letter out
to hundreds more I would like to tell them that the letter they are
sending is not a valid letter.  The company is investigating the
circulation of this letter and the letter should not continue to forward
to people.  The letter itself was kinda sad at first but when i finished
reading it i knew it couldn't b tru so i looked into it and found that i
was right.  I am just trying to get all of the addys from all of the
people that have been forwared this message b4 me and email them and tell
them to stop forwarding this letter.  That is all.  I don't want to take
the addys of every email that i recieve.




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

Date: Mon, 22 Nov 1999 14:54:44 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How do I take all of the email addresses out of an email? 2 of 2 (fwd)
Message-Id: <3839C9B4.12D63B1A@mail.cor.epa.gov>

Poohba wrote:
> For all of your information.  I have a lot of friends that were forwarded
> a letter.  This letter however was an invalid letter.  The letter itself
> consists of many email addys.  at least 205 of them.
[snip]

Okay, now that you've given a reason, you may get nicer replies
in the newsgroup.  But remember that a lot of people in the
newsgroup will automatically associate any subject like this
with spamming.  So don't expect too much.

That said, you still haven't told us anything about the format of
the headers or the email addresses which you have.  If what
you have is really a big Cc: list in a mail header, there are
modules at CPAN [www.cpan.org] which will help parse this for
you.  Just look in the Mail::* hierarchy.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Mon, 22 Nov 1999 12:40:38 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to use value in HTML form ?
Message-Id: <Pine.GSO.4.10.9911221239030.16575-100000@user2.teleport.com>

On Mon, 22 Nov 1999, Henry E. P. wrote:

> I have problem with my script.

You should fix the bug in your program.

If you'd like help in finding it, you could cut your code down to a small,
stand-alone example program. Ideally, it should use no external files and
be shorter than five or ten lines. Then you can post that here and someone
may be able to see the problem.

If you'd like to ask for help without showing anyone your source code,
call PPAL, the Psychic Perl Assistance Line at 1-900-PSYCHO. $999.99/min,
VISA/AMEX/MC/DISCOVER. Must be 18+ or have parent's permission to call.

Cheers!

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



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

Date: 22 Nov 1999 14:51:01 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: How write records to ASCII file
Message-Id: <slrn83jbbr.m2v.abigail@alexandra.delanet.com>

Al Franz (albert@netmation.com) wrote on MMCCLXXIV September MCMXCIII in
<URL:news:81b1k1$45u$1@eskinews.eskimo.com>:
,, Are there public domain perl scripts to write data and/or retrieve data
,, from ascii files?


Here's a script to retrieve data from an ASCII file, and print it
to STDOUT:

     perl -pe '' <file>

This script is hereby placed in the public domain.


Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 22 Nov 1999 18:20:22 -0500
From: Burton Kent <burton@REMOVETHIS.lucent.com>
Subject: Can Perl read gif pixels?
Message-Id: <3839CFB6.E1FE418A@REMOVETHIS.lucent.com>

I've got tree type gif diagrams with rectangular 
boxes.  To create an image map, I would like
go through each pixel to find the rectangular 
boxes.  Once I have the rectangles, I should 
easily be able to put together an html imagemap.

Any ideas?  The packages I've looked at are for
manipulation, not examining the actual gif pixels.

Burton


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

Date: Tue, 23 Nov 1999 00:02:14 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Case Change Text UPPER CASE to Title Case?
Message-Id: <s3jmc6p43ef21@corp.supernews.com>

Abigail (abigail@delanet.com) wrote:
: Craig Berry (cberry@cinenet.net) wrote on MMCCLXXIV September MCMXCIII in
: <URL:news:s3h2qspk3ef80@corp.supernews.com>:
: && Rick Trankle (rjt@dviews.com) wrote:
: && : Is there a routine for changing uppercase text between two markers to
: && : title case (Upper/Lower)?
: && : 
: && : à SOME TEXT TO CHANGE ê
: && : to this:
: && : à Some Text To Change ê
: && 
: && To do this mechanically, s/(\w+)/\u\L$1/g suffices.  Note however that
: && typically title-casing leaves some articles and prepositions in lowercase.
: 
: That doesn't really take any of the markers into account, does it?

True; I concentrated on the more interesting part of the problem (and
should have stated that explicitly.  Note also that as has been pointed
out, the simpleminded mechanical approach fails on e.g. contractions,
oddly-capitalized names like e.g. McDonald, and a plethora of other cases. 

Much like the oft-discussed HTML extraction via regex problem, how
complicated your solution needs to be depends strongly on properties of
your data, and on your a priori knowledge of that data, as well as your
tolerance for errors.

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: 22 Nov 1999 17:13:37 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Clearing QUERY_STRING
Message-Id: <slrn83jjn6.m2v.abigail@alexandra.delanet.com>

Jeff Givens (jgivensXX@adelphiaXX.netXX) wrote on MMCCLXXIV September
MCMXCIII in <URL:news:3839c7df.19655392@nntp>:
[] I'm having a problem with when a user presses the back button and then
[] reload and then answers yes to reposting form data, I am getting a script
[] to execute again. This script adds records to a database. I would like to
[] have the script only execute once and was thinking along the lines of
[] clearing out the CGI environment of the POST data.
[] 
[] I'm not having any luck in doing so.
[] 
[] What recommendations can anyone offer?

Posting in the appropriate group. You do not have a Perl problem.

[] The database has a key field that is unique; no records will have a
[] duplicate value for this field. I can check the database before the update
[] is made for a duplicate, which means the addition shouldn't be made anyway,
[] but am looking for something more elegant.
[] 
[] Persistent values? I can set a flag - how can I maintain its state?


State? State? With HTTP? There are kludges, some of them will work sometimes.
They all break eventually.



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Tue, 23 Nov 1999 01:26:49 GMT
From: jgivensXX@adelphiaXX.netXX (Jeff Givens)
Subject: Re: Clearing QUERY_STRING
Message-Id: <3839ecdc.29126025@nntp>

On 22 Nov 1999 17:13:37 -0600 abigail@delanet.com (Abigail) wrote:

>Posting in the appropriate group. You do not have a Perl problem.

Perhaps, but looking for a perl solution.

You have a problem with that?

>State? State? With HTTP? There are kludges, some of them will work sometimes.

Perl, perl. I've seen hints of "persistent variables" - Can you offer any
help as to how to do this? Alternate methods, all from the perl side of
course.
_________________________________________________________________
JG...                                                 Jeff Givens
         mailto:jgivensXX@adelphiaXX.netXX

"My hovercraft is full of eels."


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

Date: Tue, 23 Nov 1999 01:34:09 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Clearing QUERY_STRING
Message-Id: <lam_3.255$qI1.4777@nsw.nnrp.telstra.net>

On Tue, 23 Nov 1999 01:26:49 GMT,
	Jeff Givens <jgivensXX@adelphiaXX.netXX> wrote:
> On 22 Nov 1999 17:13:37 -0600 abigail@delanet.com (Abigail) wrote:
> 
> >Posting in the appropriate group. You do not have a Perl problem.
> 
> Perhaps, but looking for a perl solution.

You might be looking for a solution, and you want to write that in
Perl, but it still will not be a perl solution. It's a HTTP and CGI
problem, and the people in comp.infosystems.www.* talk about echniques
to solve your problem, ... more or less..

> You have a problem with that?

I do. Abigail most likely also does. 

> >State? State? With HTTP? There are kludges, some of them will work sometimes.
> 
> Perl, perl. I've seen hints of "persistent variables" - Can you offer any
> help as to how to do this? Alternate methods, all from the perl side of
> course.

Again, Perl is not the issue. If you had written your CGI applications
in any other language, the question would be exactly the same.
Whenever that is the case you should immediately realise that it is
_not_ a question about Perl.

Now take Abigail's advice, and scuttle over to the
comp.infosystems.www.* groups. People will be happy to help you there.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd.   | from a rich salesperson.
NSW, Australia                  | 


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

Date: Tue, 23 Nov 1999 02:36:26 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Clearing QUERY_STRING
Message-Id: <Pine.HPP.3.95a.991123023148.16314A-100000@hpplus01.cern.ch>

On Tue, 23 Nov 1999, Jeff Givens wrote:

> On 22 Nov 1999 17:13:37 -0600 abigail@delanet.com (Abigail) wrote:
> 
> >Posting in the appropriate group. You do not have a Perl problem.
> 
> Perhaps, but looking for a perl solution.

On your own evidence, this is irrelevant.

> You have a problem with that?

_You_ have a problem with that.  Until you understand where the tools
belong and how to fit them together, you're going to have a hard time
using them.

> >State? State? With HTTP? There are kludges, some of them will work sometimes.
> 
> Perl, perl. 

It would still be the same problem in principle if you were coding in
COBOL.  But you don't want to know, so you're allowing yourself no
chance to learn.

Reading Nick Kew's CGI FAQ may get you started.  Maybe.

Behaving aggressively towards the regulars around here is going to get
you plonked.  Suit yourself: usenet is very democratic like that.



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

Date: Tue, 23 Nov 1999 01:06:40 GMT
From: Henning Strandin <henning@travellab.com>
Subject: Commercial Open Group (COG) development
Message-Id: <81cpat$t26$1@nnrp1.deja.com>

Hi,

I'm the technical manager at TravelLab, an e-commerce startup that owns
one of the three largest Scandinavian online travel agencies. I'm also
its only programmer, and I'm desperate for help with developing the
products we have planned and that will give us a secure lead in the
Scandinavian, and eventually, european Internet travel industry.

If this sounds like a sales pitch, it's because in a way it is. I have
been forced to be creative in finding new personnel, and since I come
from an open source background, that's where I've been looking for
answers. I would be extremely greatful for any feedback on the following
idea:

TravelLab is willing to release "contracts" for jobs that we need to
have done. Each such contract would include detailed technical
specifications for one independent software module, a deadline, and what
we are willing to pay to have it done. The pay will be in company stock.
Stock is cheap now, but will probably increase to about 400-600% within
a year. We have a monthly turn-over of about $360000 US today, with a
monthly increase of about 30%, so we are definitely on the move.

Pay will be calculated from an hourly fee and an aproximation of the
number of hours it would take a reasonably skilled programmer to finish
the task. We don't care how long you spend, what your credentials are or
whether you've ever programmed before. When the deadline arrives we
evaluate any contributions and pay one or several people, depending on
how we use the code.

We need perl programmers most of all. Our systems run on Linux, use
Apache and we plan to be using MySQL soon. I'm taking a leap with this,
and I'm extremely interested in any reactions you might have to a scheme
like this.

Best Regards

Henning Strandin
CTO, TravelLab AB


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


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

Date: Mon, 22 Nov 1999 16:02:00 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Core dump in Perl_my_pclose
Message-Id: <Pine.GSO.4.10.9911221547550.16575-100000@user2.teleport.com>

On 22 Nov 1999, Peter Heimann wrote:

> This code excerpt crashes the Perl interpreter with a core dump 
> in Perl_my_pclose, usually the third time executing the loop body
> (5.005_02 and 5.005_03 on Sun Solaris 2.6).
> 
> Is this a bug in Perl, or in my code?

It's either Perl or your system's library routines. I'm guessing the
latter, but I can't be certain.

> for ($i=1; $i<8; $i++) {

That should probably be a foreach loop. But it's not _wrong_ wrong.

>     eval {
>         local $SIG{ALRM} = sub { die "timeout\n" };
>         alarm 2;
>         # use sleep 5 to demonstrate the problem
>         my $pid = open(KID, "sleep 5 |") or die("fork failed: $!\n");

Moving the alarm line to after the open seems to fix the problem. On my
system, fork(2) is documented to clear pending alarms, so that shouldn't
be the problem - but changing the order fixes it anyway! Or seems to....

>         @result = <KID>;

Note that that's the global @result. Not that that's the problem.

Cheers!

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



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

Date: Mon, 22 Nov 1999 16:04:50 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Embedding text content into HTML templates with Perl
Message-Id: <Pine.GSO.4.10.9911221603070.16575-100000@user2.teleport.com>

On Mon, 22 Nov 1999, J. Kenton wrote:

> if I place a single <p> (for lack of a better example) tag at the
> beginning point and a single </p> at the end point, how can I get perl
> to dump the content I want in between?

It sounds as if you want to use HTML::Parser, from CPAN.

> Second, can I use the same strategy to extract the body portion from the
> old pages and automatically dump that content into the new template?

It sounds as if you want to use HTML::Parser again.

> p.s. I have not found HTML::parser to be of much help in this regard.
> Is there something about it that I am missing?

Seems likely to me. Have you subclassed it?

Cheers!

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



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

Date: Mon, 22 Nov 1999 16:34:34 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: GMT Time
Message-Id: <Pine.GSO.4.10.9911221633260.16575-100000@user2.teleport.com>

On Mon, 22 Nov 1999 hdesa22@my-deja.com wrote:

> Is there a function that I can get the GMT Time from the system date.

Perhaps you should look at the perlfunc manpage. Searching for GMT (case
insensitive) might be helpful. Cheers!

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



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

Date: Mon, 22 Nov 1999 20:16:12 -0500
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Help With CyberCash....
Message-Id: <brian-2211992016120001@sri.dialup.access.net>

In article <383d8aeb.20119181@news.iinc.com>, null@effierover.com (Effie Rover) wrote:

>Sorry to jump in below, but I missed the original post. I have had
>experience dealing with the Cybercash API and also modifying their
>libraries. It's all written in or can be interfaced to with Perl. IMX,
>it's a royal pain. 


i'm still considering re-writing it for them.  their several modules
actually reduce to about 50 lines of Perl. it's not the worst stuff
i've ever dealt with and they have lots of docs on the process. it
probably is a royal pain in absolute terms and i just deal with stuff
that's a lot crappier ;)

-- 
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ 
  <URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>



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

Date: Tue, 23 Nov 1999 00:22:50 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: How do I take all of the email addresses out of an email? 2 of 2 (fwd)
Message-Id: <slrn83ji3i.2u9.*@dragons.duesouth.net>

On Mon, 22 Nov 1999 16:26:41 -0500, Poohba <poohba@io.com> held some
poor sysadmin at gunpoint, and typed the following into
comp.lang.perl.misc: 
: For all of your information.  I have a lot of friends that were forwarded
: a letter.  This letter however was an invalid letter.  The letter itself
: consists of many email addys.  at least 205 of them.

I assume you mean a message like:

To: Your address, e11, e12, e13, e14, e15
From: your friend
Subject: [FWD: [FWD: READ THIS]]

-- BEGIN FORWARDED --
To: e7, e8, e9, e10, etc.
From: another friend
Subject: [FWD: READ THIS]

**** BEGIN FORWARDED MESSAGE BELOW THIS LINE ****
To: e1, e2, e3, e4, e5, e6, etc.
From: the original culprit

>>>>> >>>> >>>> >>> SOME THIN
G
>>>>> >>>> >>>> >>> THAT YOU R
EALLY WISH HA
>>>>> >>>> >>>> >>> DN'T BEEN S
ENT TO YOU.
**** END FORWARDED MESSAGE HERE ****
-- END FORWARDED --

[snip 20 line signature]

Of course, this is mildly watered down.

If that's the case, then a simple regular expression such as \w@\w.\w
will probably catch enough of them for you.

Experience shows most of these type messages come from and are sent to
AOLers, and most other people who would get one already know it's a
buncha bull.

Or, like me, they just /dev/null anything with FWD in the subject more
than once. :-)

HTH,

--Matthew


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

Date: 23 Nov 1999 00:12:27 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: How do I take all of the email addresses out of an email? 2 of 2
Message-Id: <slrn83jn00.l4e.sholden@pgrad.cs.usyd.edu.au>

On Mon, 22 Nov 1999 15:29:25 -0500, Poohba <poohba@io.com> wrote:
>Thank you very much for your help.  Just one more thing.  How do i keep
>out the repeats?

You read the FAQ that comes with perl. 

-- 
Sam

Can you sum up plan 9 in layman's terms? It does everything Unix does
only less reliably.
	--Ken Thompson


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

Date: Mon, 22 Nov 1999 23:22:20 GMT
From: crackbaby1@my-deja.com
Subject: How to write a uploaded file?
Message-Id: <81cj77$ohk$1@nnrp1.deja.com>

Here is my problem:
I need to have users upload images to my server, then I need to write
the images into a directory...

$file_name = "c:\d.gif"; # a file a use needs to upload

$slide_dir = '/html/...' # the directory to place the files
 (opendir OUTFILESS, $slide_dir) or die "Can't open directory $!\n";
   while (<$file_name>) {
          print OUTFILESS $_;
   }
 (closedir OUTFILESS) or die "Can't close directory $!\n";

Any ideas?


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


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

Date: 23 Nov 1999 00:51:04 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How to write a uploaded file?
Message-Id: <3839E4A6.94E4A886@vpservices.com>

crackbaby1@my-deja.com wrote:
> 
> $file_name = "c:\d.gif"; # a file a use needs to upload
> 
> $slide_dir = '/html/...' # the directory to place the files
>  (opendir OUTFILESS, $slide_dir) or die "Can't open directory $!\n";
>    while (<$file_name>) {
>           print OUTFILESS $_;
>    }
>  (closedir OUTFILESS) or die "Can't close directory $!\n";

Use CGI.pm.  Read the part about uploading binary files in its
documentation.  A .gif file is not a text file so it can't be uploaded
like a text file.  Well actually it can, but it won't do much good in
that format.

-- 
Jeff


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

Date: 23 Nov 1999 01:59:52 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: How to write a uploaded file?
Message-Id: <slrn83jt8r.mp.efflandt@efflandt.xnet.com>

On Mon, 22 Nov 1999 23:22:20 GMT, crackbaby1@my-deja.com
<crackbaby1@my-deja.com> wrote:
>Here is my problem:
>I need to have users upload images to my server, then I need to write
>the images into a directory...

In a shell or DOS window of a system with Perl type: perldoc CGI

You should probably also check your path on the webserver.  Your web root
may be /html in FTP, but it is likely to be longer on the web.  You might
be able to tell from a simple Perl CGI script that prints a Content-type
header and $0 (zero), or you could try: print `pwd`; (those are backticks,
not quotes). 

PS: cgi questions should be posted to a cgi newsgroup

-- 
David Efflandt   efflandt@xnet.com   http://www.xnet.com/~efflandt/
http://www.de-srv.com/   http://cgi-help.virtualave.net/
http://thunder.prohosting.com/~cv-elgin/


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

Date: Tue, 23 Nov 1999 01:25:03 GMT
From: barrytrot@yahoo.com
Subject: Mammoth Search Engine Question: GURU'S WANTED
Message-Id: <81cqdb$tra$1@nnrp1.deja.com>

I am trying to design a search engine using

perl and mysql.

I created a table in mysql:

words (pageid bigint(20) NOT NULL, word varchar(40) NOT NULL)

with an index on pageid and an index on word.

From there I have my perl code run the following select statement:

select count(pageid), pageid from words where word="first" or
word="second" or word="third" group by pageid order by 1 desc limit 200;

(The reason for the count(pageid) is to give the user the most relevent
result first.)

This works fine and returns nearly instantaneous results if the non-
limited number of rows returned is less than 1000.  However, I have 50
million total keywords and many words match up with 200k+ records.

In these cases, the query can take several minutes (EVEN FROM WITHIN
MYSQL DIRECTLY, and even if I have only 1 condition rather than or'ing
3.).

How do yahoo, et al do it?

Any super-guru's out there who can help point me in the right
direction, I would appreciate it.

Thanks in advance.


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


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

Date: Mon, 22 Nov 1999 16:31:22 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: modules
Message-Id: <Pine.GSO.4.10.9911221628460.16575-100000@user2.teleport.com>

On Mon, 22 Nov 1999, sp00fD wrote:

> the names seem to be transfered into the calling program's namespace,
> but not the values:

> @EXPORT = qw(%thisvar %thatvar $this $etc);
> my %thisvar = ("foo" => 5,

There you have it. The exported variables are globals (as they have to be,
to be accessible from different files). But %thisvar is a my() variable,
which means it is accessible by name only from within its scope. Declare
your exportable vars via 'use vars' instead of my().

Cheers!

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




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

Date: 22 Nov 1999 17:59:50 -0500
From: Nandu Shah <nandu@cimedia.com>
Subject: Re: New dialect of perl: xperl (or reinventing perl, or perl-izing jpython)
Message-Id: <m3zow63zfd.fsf@budgie.cimedia.com>

abigail@delanet.com (Abigail) writes:

> I still cannot take a random module from CPAN, study no more than
> its interface, subclass it, and be garanteed it works. I would still
> have to study the internals to make sure it works; and if it doesn't
> use a myriad of tricks, but just "normal OO" (that is, objects as a
> hashref), any update of the module could break my subclass, even if
> it isn't changing the interface.

Isn't this an indictment of the module writers to some extent?  At
what point does the rigor you want clash with Perl's spirit of
flexibility, make-easy-problems-easy-and-hard-problems-possible, etc?

I program in Perl primarily because it's fun, but also because of the
lack of enforced restrictions.  If I wanted what you want, I think I
too would find Java attractive, as well as Smalltalk and Eiffel.

Nandu


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

Date: Tue, 23 Nov 1999 00:08:46 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: OT Y2K, was Re: Problematic horizontal scrollbars
Message-Id: <s3jmoend3ef14@corp.supernews.com>

Daniel R. Tobias (dan@softdisk.com) wrote:
: Yep... I've run into this exact bug with several Perl scripts (both
: outside commercial ones and ones created by other programmers inhouse
: where I work), and had to fix it.  It can also crop up in other
: languages like Java, JavaScript, C, and C++, which also use a datestamp
: routine that returns "year-1900", and has often been mistaken for
: "returns 2-digit year" by careless programmers (leading to routines that
: might send you straight to the year 2100 when 2000 hits and that field
: returns "100").

A mere century off?  Hardly worth mentioning, given that the far more
common form of this bug sends us over 17 millennia into the future. 

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: Tue, 23 Nov 1999 01:31:59 +0000
From: Dave Eastabrook <news@elmbronze.demon.co.uk>
Subject: Re: OT Y2K, was Re: Problematic horizontal scrollbars
Message-Id: <efOA7LAP6eO4EwKj@elmbronze.demon.co.uk>

on Mon, 22 Nov 1999 Jonathan Stowe <gellyfish@gellyfish.com> wrote
>In comp.lang.perl.misc Alan J. Flavell <flavell@mail.cern.ch> wrote:
>> 
>> I know this was "only" your sig, but IMNSHO this needs refuting.
>> 
>> On Sun, 21 Nov 1999, Dave Eastabrook wrote:
>> 
>>> Did you know there was a problem with Perl and JavaScript?   Well,
>>> http://www.elmbronze.co.uk/year2000/perlprob.htm is a tiny taster.
>> 
>> There is _NO_ Y2K problem with Perl.  Its behaviour is clearly
>> documented for anyone who cares to RTFM, and it is entirely consistent.
>> 
>> There are *big* problems with badly-written Perl scripts, of which their
>> Y2K muddle is probably only a tiny part.
>> 
>
>I am amused that this page cites two of my clpm articles ... Interestingly
>both of which go to some lengths to make the point that the misuse of
>(localtime)[5] is a symptom of wider bad programming practice that can
>be found in the bulk of Matt Wrights  output ...

Exactly why, if you remember from a couple of months ago, I did cite
your two articles, the URLs for which you yourself supplied me with, and
which you were aware of, contrary to the implication of your posting.
See deja.com or whatever it's called these days.

I'm well aware of this NGs antipathy for Jocelyn Amon and can understand
why, as she does have a very low regard for programmers.  Much the same
as you (generically) have a low regard for "consultants".  I'm also
perfectly aware that it is the use of the language, not the language
itself that causes (most) problems - as opposed in fact to older
releases of PL/1 and Cobol (and even dear old IBM assembler) which
themselves or in run-time libraries did have built in Y2k problems.  

It's why I sought to put together a brief but balanced page, which,
note, is in a "section" (sub-directory) of subject year2000, not Perl.

However, there is a big difference;  because of the proliferation of
web-sites, the rapid advance of e-commerce, and the rapidly increasing
floods of semi-clueless web authors, and thus due to the *current* usage
of such badly written scripts, there are going to be innocent customers
of ignorant (as opposed to merely arrogant) web-authors who are going to
have problems.  And I personally do *not* find that amusing.  Do you?

My original posting had nothing to do with Perl, it was my Sig which
caused your Alan Flavell to move this to this NG - one which I only
occasionally lurk in.   Unlike him I do not have the arrogance or
ignorance - or sheer bad manners - to xpost this thread to where perhaps
it truly belongs - comp.software.year-2000, as I have too high a regard
for the saving of bandwidth with unnecessary flames, NG wars, and other
self-serving nonsense, and do not have the arrogance to force him, or
others, to subscribe to a high-posting level NG or take time out of busy
schedules to select individual threads or postings via whatever means.
Note that csy2k has an even higher flame temperature than this one.

Good luck to you all, but try learning a little humility and humanity.
Or you'll stop learning at all (BTDTGTTS *and* the gaps on the CV).

I will stay around long enough to read your responses as I am generally
a polite person, but I will contribute no more to the thread on this NG.

:Dave
-- 
Dave Eastabrook;
Top Level Domains: http://www.elmbronze.co.uk/internet/TLDname.htm


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

Date: Mon, 22 Nov 1999 17:32:25 -0600
From: "Randy Beckwith" <beckwith@hiwaay.net>
Subject: Passing arguments to Perl
Message-Id: <eok_3.37636$YI2.1897658@typ11.nn.bcandid.com>

I'm working on porting some perl scripts from UNIX to NT. Basically, I have
some web pages that call perl scripts to generate other web pages.
Everything works fine on UNIX but I'm having trouble with the simplest
things on NT. This is what my HTML line looks like for both operating
systems:

<b><a href="/cgi-bin/aar/graph_segments.pl?GRAPHNAME=sup-CL1-4ID"
target="frm_rthalf">4ID</a></b><br><br>

Of course, the HTML file contains more info than that but that's the
pertinent line. It is calling the graph_segments perl script with,
hopefully, a graph name for an argument. The problem I'm having on NT is the
arguments don't seem to be getting into the script. One of the first things
that I do in the script is open a log file and dump some debugging stuff to
it, like this:

open( LOG_FILE, ">graph_seg.log" ) || &dieUC( "Can't open
graph_seg.log\n" );
print LOG_FILE "\n\nAt start of graph_segments.pl\n";
print LOG_FILE "ARGV[0]: <$ARGV[0]>\nARGV[1]: <$ARGV[1]>\n";

My output in the log file looks like this:

At start of graph_segments.pl
ARGV[0]: <>
ARGV[1]: <>

For some reason, my argument of 'GRAPHNAME=sup-CL1-4ID' isn't getting into
the perl script. Any ideas?

Thanks in advance.

Randy Beckwith





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

Date: 22 Nov 1999 18:02:09 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Passing arguments to Perl
Message-Id: <slrn83jmi6.m2v.abigail@alexandra.delanet.com>

Randy Beckwith (beckwith@hiwaay.net) wrote on MMCCLXXIV September
MCMXCIII in <URL:news:eok_3.37636$YI2.1897658@typ11.nn.bcandid.com>:
__ I'm working on porting some perl scripts from UNIX to NT. Basically, I have
__ some web pages that call perl scripts to generate other web pages.
__ Everything works fine on UNIX but I'm having trouble with the simplest
__ things on NT. This is what my HTML line looks like for both operating
__ systems:
__ 
__ <b><a href="/cgi-bin/aar/graph_segments.pl?GRAPHNAME=sup-CL1-4ID"
__ target="frm_rthalf">4ID</a></b><br><br>
__ 
__ Of course, the HTML file contains more info than that but that's the
__ pertinent line. It is calling the graph_segments perl script with,
__ hopefully, a graph name for an argument. The problem I'm having on NT is the
__ arguments don't seem to be getting into the script. One of the first things
__ that I do in the script is open a log file and dump some debugging stuff to
__ it, like this:
__ 
__ open( LOG_FILE, ">graph_seg.log" ) || &dieUC( "Can't open
__ graph_seg.log\n" );
__ print LOG_FILE "\n\nAt start of graph_segments.pl\n";
__ print LOG_FILE "ARGV[0]: <$ARGV[0]>\nARGV[1]: <$ARGV[1]>\n";
__ 
__ For some reason, my argument of 'GRAPHNAME=sup-CL1-4ID' isn't getting into
__ the perl script. Any ideas?


The way ?GRAPHNAME=sup-CL1-4ID gets being made available for the script
isn't a Perl issue. It's up to the server. If the code fragment "works"
on your Unix box, the web server there isn't using CGI, but something
else. Your NT server might be using CGI. Or something else. How should
we know?

Ask in a more appropriate group, as it has absolutely nothing to do with Perl.



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 22 Nov 1999 17:43:49 -0800
From: Matthew Polly <mpolly@tathata.net>
Subject: Perl Chat
Message-Id: <3839F155.A28CA65F@tathata.net>

Does anyone know of a Chat Room for primarily (if not specifically) Perl
Programmers?



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

Date: 22 Nov 1999 16:19:32 -0700
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Refining code
Message-Id: <xkf7ljaxgfv.fsf@valdemar.col.hp.com>

nigh_postal <nigh_postal@my-deja.com> writes:
> However, this causes some problems in that the ${$fields[$i]} returns a
> global variable.

Not exactly.  It is what we call a "symbolic reference", and is a Bad
Thing(tm).  See a recent post in the "Is $$variable allowed like in PHP ?" 
thread by Mark-Jason Dominus for a series of good reasons why.

>  Now I can certainly work around this problem, but it
> seems to me that the very need to do so is indicative of a design
> flaw.  If anybody has any ideas as to what I could do to make this
> system better, or if I should scrap this system and go with a
> completely different one, please post your suggestion(s).

Fortunately for you, this question is asked frequently.  In fact, I'm
thinking it's asked often enough to become a FAQ.  In any event, you can
look at the perlref manpage for ways, to avoid it, and also check out 
<URL:http://www.plover.com/~mjd/perl/varvarname.html>.

Short answer: Use a hash instead of the global namespace, and return a
reference to that hash.

-=Eric
-- 
"Cutting the space budget really restores my faith in humanity.  It
eliminates dreams, goals, and ideals and lets us get straight to the
business of hate, debauchery, and self-annihilation."
                -- Johnny Hart


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

Date: 22 Nov 1999 19:16:32 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: mailto:Idon'tThinkSo
Message-Id: <3839963C.69B7E67B@vpservices.com>

styxx wrote:

>  WebMaster</a></font></a><font color="red">WebMaster</a>

You have a few too many </a>'s in there.

-- 
Jeff


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

Date: Mon, 22 Nov 1999 20:49:42 GMT
From: nigh_postal <nigh_postal@my-deja.com>
Subject: Re: mailto:Idon'tThinkSo
Message-Id: <81ca93$hnr$1@nnrp1.deja.com>


> #!/usr/local/bin/perl
> $time=localtime(time);
> $input=$ENV{'QUERY_STRING'};
> ($url,$email,$userName,$password,$varify,$text)= split/&/,$input;
> ($url1,$url)=split/=/,$url;($email1,$email)=split/=/,$email;
> ($userName1,$userName)=split/=/,$userName;
> ($password1,$password)=split/=/,$password;
> ($varify1,$varify)=split/=/,$varify;($text1,$text)=split/=/,$text;
> $text=~s/\+/ /ig ;
>
> open (GROUPINFO,">>groupInfo.txt") or print "Can't open : $!";
> print GROUPINFO "$userName $password $email\n $text\n\n";
> close (GROUPINFO);
> print<<__END__;
> Content-type: text/html\n\n
>
> <html><head><title>test time</title></head>
> <body bgColor="#001500" text="#0088FF" ><font face='arial'>
> <BLOCKQUOTE>
> Thank you $userName for participating.<br>
> Your password is $password<br>
> You have described your site as:<br> $text<p>
> Your user name and password may come in handy in the future.<br>
> You will be receiving an email.<br>
> Please attach a small graphic that may be used to link to your
site.<br>
> Check back to see how your site is displayed.<br>
> Your Suggestions within the email are Welcome<br>
> <a href="mailto:abroder@worldwidewing.com"><font
color="red">WebMaster</a>
> </font></a>
> <font color="red">WebMaster</a>
> </font>
> </BLOCKQUOTE>
> </font>
> </body>
> </html>
> __END__
>

As far as I can tell, your problem is that you have three </a> tags
with only one <a href>:
------------------------------------------------------
<a href="mailto:abroder@worldwidewing.com">
<font color="red">WebMaster</a>
</font></a>
<font color="red">WebMaster</a></font>
------------------------------------------------------
This is all messed up.  I'm guessing you are going for something like
this:

<a href="mailto:abroder@worldwidewing.com"><font
color="red">WebMaster</font></a>

You need to end the <font> tag before you end the <a href>.  Also, I'm
not sure what all of that extra stuff was there for.  But this should
fix the link.

-Cody


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


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

Date: Mon, 22 Nov 1999 21:35:04 +0000
From: johnmoorhouse <johnmoorhouse@netscapeonline.co.uk>
Subject: mod_perl,apache,perlauthenhandler
Message-Id: <3839B707.9EB0A5B1@netscapeonline.co.uk>

I am trying to create my own PerlAuthenHandler

http.conf

Perlmodule Myauthenticate
<location /perl>
PerlAuthenHandler Myauthenticate::Authen
AuthName realm
AuthType Basic
 Require valid-user
 </location>


Now my Myauthenticate::Authen seems to run fine returning OK at the end.

The problem, arises when I hit refresh, or use another script in that
directory it re-authenticates  ( I realise the code can be written to do
minimal work on second go ).  can anyone confirm that this is the
expected behavour.  I would have thought that apache would know that it
has already authenticated that session and therefore would only run the
authentication once??



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

Date: Mon, 22 Nov 1999 21:43:21 GMT
From: sp00fD <sp00fD@yahoo.com>
Subject: modules
Message-Id: <81cddo$kc8$1@nnrp1.deja.com>

I'm trying to create a real simple module to hold variables.  I've
looked at the perlmod manpage with no luck.  This is what I've tried,
the names seem to be transfered into the calling program's namespace,
but not the values:

package myvars;
use strict;
use Exporter;
use vars qw(@ISA @EXPORT);
@ISA = qw (Exporter);
@EXPORT = qw(%thisvar %thatvar $this $etc);
my %thisvar = ("foo" => 5,
               .....

my %thatvar = (....
 ...

and within another program I try

use myvars;
print $thisvar{foo};

and I get an undefined value error.
How do I get my values brought in, and how much of the EXPORT,
Exporter, ISA stuff is necessary for me to do this?

Thanks


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


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

Date: Mon, 22 Nov 1999 15:00:50 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: modules
Message-Id: <3839CB22.67C25A6D@mail.cor.epa.gov>

sp00fD wrote:
> 
> I'm trying to create a real simple module to hold variables.  I've
> looked at the perlmod manpage with no luck.  This is what I've tried,
> the names seem to be transfered into the calling program's namespace,
> but not the values:
> 
> package myvars;
> use strict;
> use Exporter;
> use vars qw(@ISA @EXPORT);
> @ISA = qw (Exporter);
> @EXPORT = qw(%thisvar %thatvar $this $etc);
> my %thisvar = ("foo" => 5,
>                .....
> 
> my %thatvar = (....
> ...
> 
> and within another program I try
> 
> use myvars;
> print $thisvar{foo};
> 
> and I get an undefined value error.
> How do I get my values brought in, and how much of the EXPORT,
> Exporter, ISA stuff is necessary for me to do this?

It's the my() you have in the module.  my() lexically scopes
your variable so it cannot be seen outside the scope.  Take
those my()s off the front of those variable definitions.
Instead, read about the strict pragma to see better ways of
handling this.  Like:

use vars qw(%thisvar %thatvar $this $etc);

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 22 Nov 1999 14:17:31 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: New dialect of perl: xperl (or reinventing perl, or perl-izing jpython)
Message-Id: <slrn83j9cr.m2v.abigail@alexandra.delanet.com>

excalibor@my-deja.com (excalibor@my-deja.com) wrote on MMCCLXXIV
September MCMXCIII in <URL:news:81c10s$ain$1@nnrp1.deja.com>:
{} In article <slrn83g07d.m2v.abigail@alexandra.delanet.com>,
{}   abigail@delanet.com wrote:
{} > Conrad Schneiker (schneiker@jump.net) wrote on MMCCLXXIII September
{} > MCMXCIII in <URL:news:818od1$34p$1@news.jump.net>:
{} > \\ Has anyone (in recent times) given any serious thought to what a
{} new
{} > \\ dialect/species of perl ought to look like if (full) backwards
{} compatibility
{} > \\ were not required?
{} >
{} > Two things: first class filehandles, and usuable OO.
{} 
{} I am curious: regarding OO, what do you consider usable OO? I am a
{} recent happy(? :-) user of your OO::Closures module (I am actually
{} thinking about some improvements I'd comment with you privately if I
{} can put some shape into them) and I may see where you are aiming, but
{} not too far...

This is Perl:

    {  use strict;
       my @array;
       sub foo {push @array => shift}
    }

No punctuation bloat, noone accidentely using @array, and the compiler
flagging you when you type @arrya.

This is anti-Perl:

    {  package something;

       sub new {
           bless {array => []} => shift;
       }
           
       sub foo {
           my $self = shift;
           push @{$self -> {array}} => shift;
       }
    }

Punctuation bloat (8 (!!) punctuation chars to access an array), no
lexical scoped 'array', and if you type 'arrya', it's not even a run
time error. You can use all the -w and use stricts you want, all you
get is mysterious behaviour. Sure, sure, sure, you can put in extra
checks. But that's something I want from the *language*, after all,
that's what "use strict" is doing for me for non-OO. Not to mention that
you have to do lots of repeated work yourself: building the objects [1],
and extracting yourself from @_.

Perl OO violates the basic reason OO exists: implementation hiding.

And yes, am I aware that after 5+ years we got hacks like %FIELDS,
base.pm, pseudo-hashes, and Tom and Damian have collected assorted tricks
in man pages and books. But tricks are nothing more than tricks. I still
cannot take a random module from CPAN, study no more than its interface,
subclass it, and be garanteed it works. I would still have to study the
internals to make sure it works; and if it doesn't use a myriad of tricks,
but just "normal OO" (that is, objects as a hashref), any update of the
module could break my subclass, even if it isn't changing the interface.

Perl OO is nothing more than a mockup thrown together to make Perl look
modern language. It's a facade, making Java look like an attractive
language. Perl is a toy language, and as long as it has this form of
OO, it'll remain a toy language.

I guess that when Perl 5 was designed, it was an interesting exercise
to do the minimalist approach: Perl objects are just syntactical sugar
for ADTs with weak binding. But I think it was the wrong decision.

{} I actually would rather have a pvm ready to digest perl-bytecoded
{} programs (eg. CGI scripts would start/generally work, (much?) faster

There's already mod_perl that more or less does this.

{} without the hassle of compiling them to native C, as this would create
{} lots of trouble with some proprietary platform that don't follow
{} standards). In some ways, perl is both, but being able to do so in two
{} separeate steps (creating, dunno, .plc files) could be cool in some
{} cases (not all, btw)

But that only eliminates the compiling stage, which is only worthwhile
for programs with a relatively very short runtime which are run often.

{} > Furthermore, Perl is considered to be "slow", and it often is compared
{} > to C (depending on the program).
{} 
{} I don't think Perl it's slow... considering the hassle you'd have doing
{} things in C (which, after all, are already done... it's most of Perl :)

Make a list of 50 different tasks. Write efficient C and Perl programs in it.
Benchmark them. I'll be there will be a few tasks for which Perl programs
get a run time in the same magnitude as C. Others will be way faster in C.

I am aware of the hassle you'd have doing things in C, that's why I use
Perl. I'm also aware speed *is* often an issue, and for many people it's
an important issue. The speed factor is something working against Perl.

{} I don't think regex stuff or things that don't involve complex
{} structures like hashes, &c... (that can be implemented just for the
{} problem in C and will go much faster than the general purpose,
{} can-eat-anything Perl hashes)...
{} 
{} I think part of the 'slowness' of perl can be due to the previous
{} compiling step... in those cases a pure bytecode interpreter would
{} probably offer better psychological response (and, besides, the code
{} could be really optimized...)

No, I don't think so. The compiler is pretty fast, and it's a penalty
you pay only once; at startup. The main source of why Perl is "slow"
is the fact it's using kind of a virtual machine. A tree of opcodes,
and an opcode dispatcher. Mind you, I'm not saying it's a bad thing,
or that I'm not willing to pay the price. But there are a lot of people
that aren't willing to pay the price. And Java is slow for the same
reason as well, it's also a virtual machine. Now, having one virtual
machine implementing another virtual machine isn't very worthwile, the
negatives add up ("slow" + "slow" == "slower"), while the positives don't
(you can do the 'write once, run everywhere' only once).


I don't think there's much point in discussing what could be changed to
Perl. It'll never happen. Just look what a proposal for a single new
operator does to the people in p5p. The sun will be a cold lump of iron
before you see a significant language change in Perl.


[1]  And please, don't come with the argument that's more flexible.
     That's just crap. If there just were 'object instance variables',
     there wouldn't *be* any need to group them in Perl structure,
     eliminating the need to offer the subclasser a potential headache.


Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 22 Nov 1999 14:34:30 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: NT to UNIX Question
Message-Id: <3839C4F6.5844F0F@mail.cor.epa.gov>

Zachar wrote:
> 
> Hi!

Howdy!

> I need to know the follofing thing:
> 
> If I develop a product under NT (Perl for NT, Sybase for NT and
> SybaseDBI for NT) do I need to make any significant changes before I can
> use the Perl code under UNIX?

Assuming you use the DBI and DBD::Sybase modules, your DBMS
code ought to be quite portable.  Read the perlport pages and
you'll see the main issues you need to deal with.  Use the
unix notation for directories and paths [slashes and backslashes].
Don't use any Win32::* modules unless you have to, because they
won't port to another operating system without some work.
Don't use system() when you can use Perl's builtins and modules.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Mon, 22 Nov 1999 19:19:52 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: OT Y2K, was Re: Problematic horizontal scrollbars
Message-Id: <81c4vl$g29$1@monet.op.net>

In article <Pine.HPP.3.95a.991121211629.23568I-100000@hpplus01.cern.ch>,
Alan J. Flavell <flavell@mail.cern.ch> wrote:
>There is _NO_ Y2K problem with Perl.  Its behaviour is clearly
>documented for anyone who cares to RTFM, and it is entirely consistent.

Maybe this is a good time to mention that I am running a contest to
see who can best predict the number of incorrect bug reports about
`localtime()' that will be sent to the perl5-porters mailing list next
year.

http://www.plover.com/~mjd/perl/y2k/y2k.cgi


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

Date: 22 Nov 1999 19:28:40 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: OT Y2K, was Re: Problematic horizontal scrollbars
Message-Id: <81c5h8$r2$1@internal-news.uu.net>

Mark-Jason Dominus <mjd@op.net> wrote:

> Maybe this is a good time to mention that I am running a contest to
> see who can best predict the number of incorrect bug reports about
> `localtime()' that will be sent to the perl5-porters mailing list next
> year.

  I assume that people that don't read localtime documentation
also haven't found the address for the perl5-porters mailing list.

the contest is only open to registered PAUSE users ...

Erik



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

Date: Mon, 22 Nov 1999 20:49:07 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: OT Y2K, was Re: Problematic horizontal scrollbars
Message-Id: <7%h_3.5983$Pj3.10488@news.rdc1.ct.home.com>

Erik van Roode <newsposter@cthulhu.demon.nl> wrote:
> Mark-Jason Dominus <mjd@op.net> wrote:

>> Maybe this is a good time to mention that I am running a contest to
>> see who can best predict the number of incorrect bug reports about
>> `localtime()' that will be sent to the perl5-porters mailing list next
>> year.

>   I assume that people that don't read localtime documentation
> also haven't found the address for the perl5-porters mailing list.

But they have found perlbug@perl.org, which they use. Often. :(

					Dan


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

Date: Mon, 22 Nov 1999 21:09:26 +0000
From: Dave Eastabrook <news@elmbronze.demon.co.uk>
Subject: Re: OT Y2K, was Re: Problematic horizontal scrollbars
Message-Id: <jKcfeHAGEbO4Ewcc@elmbronze.demon.co.uk>

on Sun, 21 Nov 1999 Alan J. Flavell <flavell@mail.cern.ch> wrote
>
>I know this was "only" your sig, but IMNSHO this needs refuting.

Wow.  Isn't condemning a web-page on the basis of a URL something like
complaining to John Buchan that his book "The Thirty-Nine Steps"
discriminates against the disabled?  If you'd read the page, you'd see
that your [diplomatically snipped] comments were slightly misplaced.

Here's the URL again:  

<URL:http://www.elmbronze.co.uk/year2000/perlprob.htm>


>xpost and f'ups set, sigh.

Reinstated and reset, sigh :(   My actual posting, sigh, had absolutely
nothing to do with Perl, and if you *had* taken the trouble to read the
page before letting the clutch off the fingers, you'd see that your
jiggering about with the newsgroups lines was singularly inappropriate
and, indeed, an insult to the good folk of clpm who I'm sure, especially
by now, would rather be seen in the altogether now than write a script
which was non-y2k-compliant.  I apologise to them on your behalf.

Here's a different Sig to masticate on - it might improve your humour!

:Dave
-- 
Ain't Y2k hilarious - http://www.elmbronze.co.uk/year2000/humour/
A sense of one's own self-importance should never get in the way
of having a side-splitting belly-aching gob-smacking ROTFPYLASYS.


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

Date: Mon, 22 Nov 1999 23:33:13 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: OT Y2K, was Re: Problematic horizontal scrollbars
Message-Id: <Pine.HPP.3.95a.991122232147.172G-100000@hpplus01.cern.ch>

On Mon, 22 Nov 1999, Dave Eastabrook wrote:

> Wow.  Isn't condemning a web-page on the basis of a URL 

Who says I condemned your web page?  It was the slogan in your sig that
was wrong.  As the other contributors to this thread showed by their
followups that they had understood, the web page itself told a different
story, confirming my criticism.

> Here's the URL again:

And here's your misleading Y2K statement again:

| Dave Eastabrook;  still telling you to "GET your Y2k mess SORTED"!
| Did you know there was a problem with Perl and JavaScript?   

There _is_ no Y2K problem "with Perl". 

[xpost and f'up to on-topic group]



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

Date: Mon, 22 Nov 1999 12:30:50 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Passing a parameter does not work when it came from a list.
Message-Id: <MPG.12a347d289b432f298a252@nntp.hpl.hp.com>

[Please don't quote the message you are responding to *after* your 
response; and don't quote the whole thing, just what you are responding 
to.]

In article <81bsve$h3p$1@nnrp02.primenet.com> on Mon, 22 Nov 1999 
12:07:55 -0500, Steve Poulsen <dont.email@post.responses> says...
> Ok, I did the couple of things suggested earlier and although good
> practices, they did not help.  I then did the following just before the
> rename (which prints out the ascii values).  However if I set the $to to
> exactly what prints out (double-checking the ascii) I get the same ascii,
> but it then renames properly.  If I use the string replaced version, it
> prints out the same ASCII but halts at the rename (no error code because
> this is CGI).

That is no excuse for not getting a diagnostic.  Use

    use CGI::Carp qw(fatalsToBrowser);

Another way is to look at the error message in the server log, if you 
have access to it.

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


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

Date: Mon, 22 Nov 1999 19:08:25 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: passing arrays by reference
Message-Id: <81c4a7$fs2$1@monet.op.net>


Here's a third approach:

my @array = qw (0 1 2 3 4 5 6);

modify (@array);
print "@array\n";

sub modify {
  $_[1] = 9999999;
}



In perl, parameters are always passed by reference.


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

Date: 22 Nov 1999 19:34:44 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: passing arrays by reference
Message-Id: <81c5sk$r2$1@towncrier.cc.monash.edu.au>

mjd@op.net (Mark-Jason Dominus) writes:

>Here's a third approach:

>my @array = qw (0 1 2 3 4 5 6);

>modify (@array);
>print "@array\n";

>sub modify {
>  $_[1] = 9999999;
>}


But be careful: within &modify the individual elements $_[0], $_[1], etc.
are the same as $array[0], $array[1], and so forth. *However*, the complete
array @_ isn't the same as @array!

For example:

sub modify {
  push @_, 1;		# no effect on @array
  shift @_;		# no effect on @array
  splice @_, 2, 3, 4;	# no effect on @array
}

Damian


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

Date: Mon, 22 Nov 1999 22:07:29 GMT
From: 0_clock@my-deja.com
Subject: Query String
Message-Id: <81ceqs$lc4$1@nnrp1.deja.com>

I would like to know what is the best way to
write an "if" using the Query String

I saw this at many places but it doesn't work.

if ($ENV{'QUERY_STRING'} =~ /something/i) {
	&something;
	exit;
}



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


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

Date: 22 Nov 1999 22:24:29 +0000
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Query String
Message-Id: <wkyabqrwpu.fsf@yahoo.com>

0_clock@my-deja.com writes:

> I would like to know what is the best way to
> write an "if" using the Query String
> 
> I saw this at many places but it doesn't work.
> 
> if ($ENV{'QUERY_STRING'} =~ /something/i) {
> 	&something;
> 	exit;
> }


use the CGI module to sort out the query string for
you.  Then you can extract the bit of it you're
really looking for, e.g.

  use CGI qw(:standard);

  my $rodent = param('mouse');

  if (rodent eq 'Mickey') {
    &something;
    exit;
  }


Documentation of course in: perldoc CGI

hth
tony


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

Date: Mon, 22 Nov 1999 12:11:53 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: reading binary digits with oct
Message-Id: <Pine.GSO.4.10.9911221205070.16575-100000@user2.teleport.com>

On 21 Nov 1999, David Foster wrote:

> >> print oct("0b10101");  # that's a zero-b, though I tried Oh-b as well

> >Does that character do anything useful when you output it on your system?
> 
> The comment doesn't have special characters, but rather a bad attempt
> to specify the letter 'O' vs the number.  I'm guessing that's what 
> you're referring to here, though I could be wrong.

It seems that both of us were ambiguous. :-)  I meant the character
oct("0b10101"), actually. For my own testing, I used this command.

    perl -lwe 'print map chr oct, "0b1001111", "0b1101011",' \
	-e '"0b1100001", "0b1111001"'

This outputs a seemingly-blank line on versions of perl without 0b-binary
support. Of course, it's not really blank. Cheers!

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



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

Date: Mon, 22 Nov 1999 21:24:53 GMT
From: nigh_postal <nigh_postal@my-deja.com>
Subject: Refining code
Message-Id: <81ccav$jei$1@nnrp1.deja.com>

I am a software developer who writes maintenance programs for web-sites
entirely in perl.  I was hired for the job with no previous experience
in perl and was given virtually no training.  I have been working with
perl for a little over a year now, and of course at this point I know
my way around perl pretty well.  But due to the nature of my job, I
haven't had a whole lot of time to really go over and re-work the code
to be more efficient.  Of course I'm not going to just post my cgi's up
to the newsgroup.  Neither you nor my employer would appreciate my
doing so.  What I was wondering was if anybody could help me with a
specific area of my code.  There is a particular method that I use to
retrieve information from perl dbm's that I believe could be done more
efficiently.  I have posted a sample piece of code below to illustrate
that method.  All suggestions are welcome.

Note:  I realize that dbm's are a poor choice for a database, but for
now that is what I have to work with.

# Defines database fields
@fields = (
    TITLE, DAY, MONTH, YEAR, CONTACT, PHONE, BYLINE, HEADING, BODY1,
    BODY2, BODY3, BODY4, HIDE, TIMESTAMP
);

# Reading from a database $DBNAME
dbmopen(%DB, $DBNAME, 0664);
foreach $dbkey (keys %DB)
{
    @data = split(/\|/, $DB{$dbkey});
    for ( $i=0;$fields[$i];$i++)
    {
        ${$fields[$i]} = $data[$i];
    }
}
dbmclose(%DB);

This way I don't need to know the structure of the current database, I
just need to define @fields at the beginning of the call to the cgi
(definition would change based on the parameters sent to the script).
However, this causes some problems in that the ${$fields[$i]} returns a
global variable.  Now I can certainly work around this problem, but it
seems to me that the very need to do so is indicative of a design
flaw.  If anybody has any ideas as to what I could do to make this
system better, or if I should scrap this system and go with a
completely different one, please post your suggestion(s).

Thanks in advance,
-Cody


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


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

Date: Mon, 22 Nov 1999 20:40:50 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Save As box... printing an image to the screen"
Message-Id: <383aa81a.878854@news.skynet.be>

Freddy wrote:

>it sounds like you're using the script as the image itself..
>ie. img src="/cgi-bin/imagescript.pl"

Make it 

	<img src="/cgi-bin/imagescript.pl/yourfilenamehere.png">

and the browser will pick that appended stuff as the filename.

-- 
	Bart.


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

Date: Mon, 22 Nov 1999 12:56:35 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: setuid Programm
Message-Id: <Pine.GSO.4.10.9911221250080.16575-100000@user2.teleport.com>

On Mon, 22 Nov 1999, Michael Scheferhoff wrote:

> But I wrote a little perl programm which works fine:
> 
> #!/usr/bin/perl -wT
> 
> print "This is a test with UID: $<\n";
> $<=119;
> print "After changing the UID: $<\n";
> 
> I can run this program as every user, I don't have to be root.

Sure you can. But if any program can change the UID at any time, you
should change to UID 0 and install an OS which doesn't let any program
change the UID at any time.

> If I want to implement this in a CGI script, this does not work.

On some systems, user nobody (UID -1) isn't allowed to change UID, since a
UID of -1 means "retain current uid" to the system calls. On such systems,
it may be a good idea to use -2 to mean user nobody. This change should
not be done without careful consideration.

Cheers!

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



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

Date: Mon, 22 Nov 1999 22:24:49 GMT
From: hdesa22@my-deja.com
Subject: Re: Sockets.
Message-Id: <81cfrc$m6n$1@nnrp1.deja.com>

From my understanding of sockets is that it is a communication between
two entities. The application and the NT workstation can talk on a
socket. You cannot "eves drop" on that very socket, unless you actually
"sniff" the packets.



In article <81bqg2$55s$1@nnrp1.deja.com>,
  plee22@my-deja.com wrote:
> I am tryig to connect to a socket on an NT workstation that is in use
> by abother application.  I wish to see the transfers between the
client
> and server on port 5010. simply logger.
>
> I do not know how to attached my socket object to the already opened
> socket for listening.  Any ides on how this is done?
>
> Thanks,
> Pete
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


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


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

Date: Mon, 22 Nov 1999 15:21:08 -0600
From: "Matt Kruse" <mkruse@rens.com>
Subject: Test for eval() without using eval() ??
Message-Id: <81cbsa$i02$1@ffx2nh3.news.uu.net>

Some web servers disable eval() in perl scripts, for whatever reason.

My question is... how can I test whether or not eval() exists, without using
eval() to trap any errors?





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

Date: 22 Nov 1999 16:41:29 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Test for eval() without using eval() ??
Message-Id: <slrn83jhqv.m2v.abigail@alexandra.delanet.com>

Matt Kruse (mkruse@rens.com) wrote on MMCCLXXIV September MCMXCIII in
<URL:news:81cbsa$i02$1@ffx2nh3.news.uu.net>:
?? Some web servers disable eval() in perl scripts, for whatever reason.
?? 
?? My question is... how can I test whether or not eval() exists, without using
?? eval() to trap any errors?


perl -le 'print "Nope" if `perl -e "eval()" 2>&1` =~ /Undefined/';



Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 22 Nov 1999 17:06:00 -0600
From: "Matt Kruse" <mkruse@rens.com>
Subject: Re: Test for eval() without using eval() ??
Message-Id: <81ci0u$ndl$1@ffx2nh3.news.uu.net>

This is not a workable solution from within a perl script, unfortunately.
(and it doesn't work from NT, either)

I would like a way to do this without spawning a new perl process and
trapping the output, if it exists.




Abigail <abigail@delanet.com> wrote in message
news:slrn83jhqv.m2v.abigail@alexandra.delanet.com...
> Matt Kruse (mkruse@rens.com) wrote on MMCCLXXIV September MCMXCIII in
> <URL:news:81cbsa$i02$1@ffx2nh3.news.uu.net>:
> ?? Some web servers disable eval() in perl scripts, for whatever reason.
> ??
> ?? My question is... how can I test whether or not eval() exists, without
using
> ?? eval() to trap any errors?
>
>
> perl -le 'print "Nope" if `perl -e "eval()" 2>&1` =~ /Undefined/';
>
>
>
> Abigail
> --
>
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)(
(.)
> (.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of
Hanoi
>
>
>   -----------== Posted via Newsfeeds.Com, Uncensored Usenet News
==----------
>    http://www.newsfeeds.com       The Largest Usenet Servers in the World!
> ------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers
==-----




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

Date: 22 Nov 1999 19:59:19 GMT
From: lee.lindley@bigfoot.com
Subject: Re: timelocal - strange result
Message-Id: <81c7an$n0f$1@rguxd.viasystems.com>

Sergei Gnezdov <sergeiga@hotpop.com> wrote:
:>>The assumption that every day has 86400 seconds, that's what's wrong.
:>>On certain places, twice a year, a day doesn't have 86400 seconds,
:>>but 3600 more, or less.
:>Ok.  Assumption that every day has 86400 seconds is a bad idea.  How can it 
:>be done better?

:>Or, may be a better question: how can I generate sequence of days in epoch 
:>seconds?

Think about it at lunch time.

-- 
// 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: 22 Nov 1999 14:24:21 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: timelocal - strange result
Message-Id: <slrn83j9pr.m2v.abigail@alexandra.delanet.com>

Sergei Gnezdov (sergeiga@hotpop.com) wrote on MMCCLXXIV September
MCMXCIII in <URL:news:8E5696864sergeigahotpopcom@news.mindspring.com>:
__ >The assumption that every day has 86400 seconds, that's what's wrong.
__ >On certain places, twice a year, a day doesn't have 86400 seconds,
__ >but 3600 more, or less.
__ Ok.  Assumption that every day has 86400 seconds is a bad idea.  How can it 
__ be done better?
__ 
__ Or, may be a better question: how can I generate sequence of days in epoch 
__ seconds?


That's a strange question. It sounds like "How can I generate a sequence
of miles in feet".

If you want to get seconds since the epoch given a data and time, use
Time::Local. If you want to get a sequence of days, use Date::Calc.

(Note that you could also adapt your original program, and make use of
 the fact that although not every day is 86400 seconds long, no day is
 shorter than 43200, or longer than 129600 seconds, nor will 2 shorter
 (longer) days be there without a longer (shorter) in between, and start
 counting at noon instead of midnight).



Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 22 Nov 1999 12:26:39 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: timelocal - strange result
Message-Id: <MPG.12a346dcd9aa5fc598a251@nntp.hpl.hp.com>

In article <8E5696864sergeigahotpopcom@news.mindspring.com> on 22 Nov 
1999 18:44:09 GMT, Sergei Gnezdov <sergeiga@hotpop.com> says...
> >The assumption that every day has 86400 seconds, that's what's wrong.
> >On certain places, twice a year, a day doesn't have 86400 seconds,
> >but 3600 more, or less.
> Ok.  Assumption that every day has 86400 seconds is a bad idea.  How can it 
> be done better?
> 
> Or, may be a better question: how can I generate sequence of days in epoch 
> seconds?

Use gmtime(),  not localtime().

gmtime() should really be named UTCtime(), which takes no account of 
local summer-time shifts.

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


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

Date: Mon, 22 Nov 1999 21:49:35 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: timelocal - strange result
Message-Id: <Pine.HPP.3.95a.991122213928.172F-100000@hpplus01.cern.ch>

On Mon, 22 Nov 1999, Larry Rosler wrote:

> gmtime() should really be named UTCtime(),

Depends whether you prefer political correctness over historical
precedent ;-)

> which takes no account of local summer-time shifts.

Neither does GMT.  

(I don't know whether you intended to imply that GMT shifts to UTC+1 in
summer, but if you did, then I assure you that it doesn't.)

ttfn



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

Date: Mon, 22 Nov 1999 13:49:22 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: timelocal - strange result
Message-Id: <MPG.12a35a3bcfddc29798a255@nntp.hpl.hp.com>

In article <Pine.HPP.3.95a.991122213928.172F-100000@hpplus01.cern.ch> on 
Mon, 22 Nov 1999 21:49:35 +0100, Alan J. Flavell <flavell@mail.cern.ch> 
says...
> On Mon, 22 Nov 1999, Larry Rosler wrote:
> 
> > gmtime() should really be named UTCtime(),
> 
> Depends whether you prefer political correctness over historical
> precedent ;-)
> 
> > which takes no account of local summer-time shifts.
> 
> Neither does GMT.  
> 
> (I don't know whether you intended to imply that GMT shifts to UTC+1 in
> summer, but if you did, then I assure you that it doesn't.)

True.  The name of the local time changes to BST, and GMT stays what it 
was.  Here, when PST becomes PDT, PST is not used -- hence functionally 
non-existent -- until the return shift.  But I guess the politically 
incorrect still use the name GMT when referring to (approximate) 
astronomical time or atomic time (TAI) through the summer, when they 
ought to use the name UTC.  :-)

> ttfn

Ah, I deciphered that.  How veddy, veddy English!

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


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

Date: 22 Nov 1999 16:34:08 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: timelocal - strange result
Message-Id: <slrn83jhd5.m2v.abigail@alexandra.delanet.com>

Larry Rosler (lr@hpl.hp.com) wrote on MMCCLXXIV September MCMXCIII in
<URL:news:MPG.12a35a3bcfddc29798a255@nntp.hpl.hp.com>:
!! 
!! True.  The name of the local time changes to BST, and GMT stays what it 
!! was.  Here, when PST becomes PDT, PST is not used -- hence functionally 
!! non-existent -- until the return shift.  But I guess the politically 
!! incorrect still use the name GMT when referring to (approximate) 
!! astronomical time or atomic time (TAI) through the summer, when they 
!! ought to use the name UTC.  :-)


Actually, they won't be referring to TAI. Is is now off by UTC by
about half a minute.

UTC has leap seconds, TAI doesn't. Oh, and TAI doesn't relate to any
astronomical events, just vibrating atoms.



Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
                       -> define ("foldoc", "perl")) [0] -> print'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 22 Nov 1999 16:54:00 -0700
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Test for eval() without using eval() ??
Message-Id: <xkfso1yw09z.fsf@valdemar.col.hp.com>

You know, if you'd just put your replies after what you're replying to,
it'd make a lot more sense.  I've taken the libery of reordering the
replies so that a human being can understand them.

"Matt Kruse" <mkruse@rens.com> writes:
> Abigail <abigail@delanet.com> wrote in message
> news:slrn83jhqv.m2v.abigail@alexandra.delanet.com...
> > perl -le 'print "Nope" if `perl -e "eval()" 2>&1` =~ /Undefined/';
>
> This is not a workable solution from within a perl script, unfortunately.

Sure it is-- ever hear of backticks, or system()?

> (and it doesn't work from NT, either)

Sure it does-- I just did it.  You just have to read the FAQ, and quote
appropriately.

> I would like a way to do this without spawning a new perl process and
> trapping the output, if it exists.

You Can't Get There From Here.

-=Eric
-- 
"Cutting the space budget really restores my faith in humanity.  It
eliminates dreams, goals, and ideals and lets us get straight to the
business of hate, debauchery, and self-annihilation."
                -- Johnny Hart


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

Date: 22 Nov 1999 17:56:22 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Test for eval() without using eval() ??
Message-Id: <slrn83jm7c.m2v.abigail@alexandra.delanet.com>

Matt Kruse (mkruse@rens.com) wrote on MMCCLXXIV September MCMXCIII in
<URL:news:81ci0u$ndl$1@ffx2nh3.news.uu.net>:

DO NOT POST IN REVERSE ORDER AND DO NOT QUOTE THE ENTIRE ARTICLE,
INCLUDING SIGNATURE, MORON.

|| Abigail <abigail@delanet.com> wrote in message
|| news:slrn83jhqv.m2v.abigail@alexandra.delanet.com...
|| >
|| > perl -le 'print "Nope" if `perl -e "eval()" 2>&1` =~ /Undefined/';

|| This is not a workable solution from within a perl script, unfortunately.

Sure it is.

    #!/opt/perl/bin/perl -w

    use strict;

    print "Nope\n" if `perl -e "eval()" 2>&1` =~ /Undefined/;

    __END__

|| (and it doesn't work from NT, either)

Eh? Why not? Just install a Bourne shell look-alike for NT. There
are toolkits with most major shell utilities for NT. I've developed
complicated shell scripts on Solaris that were harder to port to HP-UX
than to NT.  (In fact, the port to NT didn't require more than replacing
the occurances of /tmp.)

[And before you complain "my provider doesn't have such a shell",
 that's to frigging bad. If you choose a provider that gives you NT,
 but without a decent shell, and a crippled Perl, that's your problem,
 not ours. Pick a better provider.]

|| I would like a way to do this without spawning a new perl process and
|| trapping the output, if it exists.

Well, aren't you getting a bit picky? You don't want to use eval, you
don't want to spawn processes... what's next, you want to do it without
using vowels?



Abigail
-- 
$_ = "\x3C\x3C\x45\x4F\x54\n" and s/<<EOT/<<EOT/ee and print;
"Just another Perl Hacker"
EOT


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 22 Nov 1999 16:24:48 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Test for eval() without using eval() ??
Message-Id: <Pine.GSO.4.10.9911221606320.16575-100000@user2.teleport.com>

On Mon, 22 Nov 1999, Matt Kruse wrote:

> Some web servers disable eval() in perl scripts, for whatever reason.

That's amazing. I didn't know that that was possible, in general. However
do they do it? Via Safe, perhaps? Hmmm....

And why should they do it? If a program is made more secure by disabling
eval, it should be even more secure by disabling print and open. :-)

Seriously, if you can't trust the programmer to use eval correctly, how
can you trust her to use the rest of perl correctly? I don't see the
wisdom here.

> My question is... how can I test whether or not eval() exists, without
> using eval() to trap any errors?

Well, if only eval STRING is disabled, you could use eval BLOCK. But if
neither eval is available, maybe this subroutine will do something useful.
Notice that it intentionally breaks a normally vital rule.

    sub eval_avail ($) {
	# Pass the name of the perl interpreter to be checked.
	# Returns true if that perl seems to allow eval.
	my $perl = shift;
	my $rc = system $perl, '-e',
	    'BEGIN { open STDERR, ">/dev/null" } eval "exit"';
	!$rc;
    }

    print eval_avail($^X) ? "It works!\n" : "No eval.\n";

Of course, you may need to call this from a BEGIN block if you will need
to abort your own compilation before compiling an eval call....

Good luck with it!

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



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

Date: Mon, 22 Nov 1999 16:23:24 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: timelocal - strange result
Message-Id: <MPG.12a37e553b0da2b598a257@nntp.hpl.hp.com>

In article <slrn83jhd5.m2v.abigail@alexandra.delanet.com> on 22 Nov 1999 
16:34:08 -0600, Abigail <abigail@delanet.com> says...
> Larry Rosler (lr@hpl.hp.com) wrote on MMCCLXXIV September MCMXCIII in
> <URL:news:MPG.12a35a3bcfddc29798a255@nntp.hpl.hp.com>:
> !! 
> !! True.  The name of the local time changes to BST, and GMT stays what it 
> !! was.  Here, when PST becomes PDT, PST is not used -- hence functionally 
> !! non-existent -- until the return shift.  But I guess the politically 
> !! incorrect still use the name GMT when referring to (approximate)
                                                         ^^^^^^^^^^^
                                                         ||||||||||| 
> !! astronomical time or atomic time (TAI) through the summer, when they 
                       ^^
                       ||
> !! ought to use the name UTC.  :-)
> 
> Actually, they won't be referring to TAI. Is is now off by UTC by
> about half a minute.

Ergo, 'approximate'!

> UTC has leap seconds, TAI doesn't. Oh, and TAI doesn't relate to any
> astronomical events, just vibrating atoms.

Ergo, 'or'!

Just a bit more off-topic:  Every system is expected to set its internal 
clock to the current UTC time, so that the offsets caused by accumulated 
leap seconds apply back towards the Epoch, not to the current time.

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


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

Date: Tue, 23 Nov 1999 01:27:11 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Turing machine
Message-Id: <s3jrbfpu3ef11@corp.supernews.com>

Inspired by an offhand and facetious comment on a thread I can't presently
recall, I have implemented a Turing machine in Perl.  Once Perl is in turn
ported to this machine, all computable algorithms will be, ah, computable. 
The program ended up being a bit long to post here (wow, I feel like
Fermat), so you can see the source at

  http://www.cinenet.net/users/cberry/turing

and a pair of example input state-machine files at

  http://www.cinenet.net/users/cberry/simple3
  http://www.cinenet.net/users/cberry/busy5

simple3 is a simple 3-state machine which writes then erases a single 1
mark before halting.  busy5 is a five-state "busy beaver" which writes
more than 4000 1s to the tape before halting, having executed more than
48 million steps to get there.  Beware, it takes about half an hour to run
busy5 to completion on my fastish PII.

Enjoy!

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: Mon, 22 Nov 1999 19:13:44 -0600
From: ktb <xyf@inetnebr.com>
Subject: Undefined error message I can't get rid of.
Message-Id: <3839EA48.F59EEC07@inetnebr.com>

Hi, I've been working on this little part of a search script and can't
get around an error message.

The relevant part of the code is below.  What I'm trying to do is make
the program able to catch user error.  The "if" statement works fine. 
If someone entered a space at the beginning of a word it will exit to
the subroutine YESORNO.  The second part keeps someone from entering
just a return (when that happens without the "elsif" below the program
cycles through the whole text file it is searching, which is large).  So
this part of the code works but I get the following error when a match
is successful:


###
Use of uninitialized value at ./DB2.pl line 26, <STDIN> chunk 1 (#1)
    
    (W) An undefined value was used as if it were already defined.  It
was
    interpreted as a "" or a 0, but maybe it was a mistake.  To suppress
this
    warning assign an initial value to your variables.
###


How do I assign an initial value to this?  I tried assigning "1" to
$SearchString and that didn't work.  I don't understand this at all.
thanks,
kent



________________________________________________________________________
<snip>

print "Enter string to search: ";
chomp($SearchString = <STDIN>);

if($SearchString =~ /^\s/) { # Makes sure you don't add a space.
    print "Sorry you must enter a character.\n";

YESORNO ();
          
} elsif($SearchString eq /^\r/) { #Give error if only hit return.

    print "You must enter a word.\n";

YESORNO ();

} 

<snip>
________________________________________________________________________


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

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


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