[10121] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3713 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 14 18:07:24 1998

Date: Mon, 14 Sep 98 15:00:17 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 14 Sep 1998     Volume: 8 Number: 3713

Today's topics:
    Re: Bug/feature limitation regarding hex numbers. <mgregory@asc.sps.mot.com>
    Re: CGI.pm's HTML shortcuts <upsetter@ziplink.net>
    Re: CGI.pm's HTML shortcuts (Michael Schout)
        Edit in place problem with ActivePerl 5.005_002 benday@c-bridge.com
        Gratuitous warning: Deep Recursion <mgregory@asc.sps.mot.com>
        Hidden Input Types and Quote Marks (Darren Hayes)
        HTTP-Proxy written in Perl - Possible? How? <arno@gmx.de>
        inetd -- detecting the client has gone showell@nxt.com
        line breaks in Perl for win32 davesnader@my-dejanews.com
    Re: MIME and SMTP (John D Groenveld)
    Re: NET::SMTP For NT, Please fix this script. (John D Groenveld)
        passing an argument to korn script nguyen.van@imvi.bls.com
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 14 Sep 1998 18:16:09 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: Bug/feature limitation regarding hex numbers.
Message-Id: <r8n283cca6.fsf@asc.sps.mot.com>

ilya@math.ohio-state.edu (Ilya Zakharevich) writes:

> [A complimentary Cc of this posting was sent to Martin Gregory 
> <mgregory@asc.sps.mot.com>],
> who wrote in article <r8ogsldc0n.fsf@asc.sps.mot.com>:
> >  $a = 0x100000000;     # 0xFFFFFFFF +1
> > 
> >  print "$a\n";
> > 
> >  $a = 4_294_967_296;   # 0xFFFFFFFF +1
> > 
> >  printf("%f %x\n", $a, $a);
> > 
> > produces this output:
> > 
> >  Integer overflow in hex number at /home/mgregory/bin/foo.pl line 1.
> >  0
> >  4294967296.000000 ffffffff
> > 
> > Given that the two representations are mentioned 'in the same breath'
> > in the documentation, and an integer bigger than 0xFFFFFFFF is
> > specifically mentioned, it caught us by suprise that this doesn't
> > work.
> 
> To see the difference, note that 4_294_967_296 is a floating point
> number, not an integer.  4_294_967_295 is a float too.  Last integer
> for Perl on 32-bit machines is 2**31-1.

I guess I confused the issue by mentioning the word integer.

I don't care if it is an int or not - I just think that the
documentation implies that hex representation is as good as decimal
for any number, yet it doesn't work that way.

> On the other hand, if one follows my reasoning that "any integer which
> may be exactly represented by a float should give expected results"
> (see perl6-porters archives), then this should be considered a bug
> indeed.  

Should I submit a bug report?

> Note that before one can actually fix it, zillions of other
> places in perl should be fixed as well...  :-(

Do you mean that there are zillions of other 'trivial' little things
of equal priority, or that there are zillions of things that would
have to be fixed before this could?

(A quick fix would be to add a note in the doc that hex => integer)

Martin.


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

Date: Mon, 14 Sep 1998 20:02:20 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: CGI.pm's HTML shortcuts
Message-Id: <gDeL1.86$7C3.964633@news.shore.net>

Dmytry Khodorkovsky <yu207526@yorku.ca> wrote:
: Look in "Teach yourself programming CGI with Perl in a week" by Erik Hermann. There are full description of cgi.pm library

<gag> Doesn't Hermann just copy the CGI.pm docs verbatim?

Besides, even if it did include such a list (which I doubt), that piece of
crap book isn't worth fifty cents, if that.

--Art

-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: 14 Sep 1998 16:31:10 -0500
From: schout@rsn.hp.com (Michael Schout)
Subject: Re: CGI.pm's HTML shortcuts
Message-Id: <6tk1uu$qo5@starchair.rsn.hp.com>

In article <35f97d47.20964770@news.enteract.com>,
Jay Bartelt <bartelt@enteract.com> wrote:
>I almost hate to ask this question, but...
>
>Somebody in my group asked me for a list of HTML shortcuts created by
>Lincoln in his CGI.pm module.  I assumed a list would be in the CGI
>doc but I don't see it.  Is there a list somewhere?  Searching CPAN

man CGI
/CREATING HTML ELEMENTS

will get you to where the discussion begins.

Basically, most of the standard tags are in there, and you use them by
calling them by their tag name.  If you want to pass arguments to the tag,
then just pass a hash reference as the first arg.  Also, if a tag is *not*
in CGI.pm, you can just create it when you pull in CGI.  For example: in
this script, ive added "<CENTER></center>", as well as "<FONT></font>".

This is described in CGI.pm under:

      Generating new HTML tags

	Since no mere mortal can keep up with Netscape and Microsoft as they
	battle it out for control of HTML, the code that generates HTML tags
	is general and extensible.  You can create new HTML tags freely just
	by referring to them on the import line:
	use CGI shortcuts,winkin,blinkin,nod;


You can just assume that the tags are there, and when you run it, if it 
complains, then you can add the tag it complains about to the import line :).

Here is a quick example:

use CGI qw(center font);                  # adds <CENTER> and <FONT>

my $q = new CGI;

print 
    $q->center( 
        $q->font( {SIZE=>'-1', FACE=>'Ariel'},
            "This is some text",
            $q->br(),                      # <BR> is standard
            "This is some more text"
        )
    );





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

Date: Mon, 14 Sep 1998 20:55:27 GMT
From: benday@c-bridge.com
Subject: Edit in place problem with ActivePerl 5.005_002
Message-Id: <6tjvrv$p4o$1@nnrp1.dejanews.com>

I've used the following command a billion times but never with ActivePerl
for NT.

perl -p -i.bak -e "s/foo/bar/g;" *.htm


It says "Can't open *.htm: Invalid argument"

I'm baffled.

Does anyone what what I'm doing wrong?

Thanks in advance,
-Ben Day
benday@c-bridge.com

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 14 Sep 1998 22:26:27 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Gratuitous warning: Deep Recursion
Message-Id: <r8lnnmdf9g.fsf@asc.sps.mot.com>


I am getting this 'deep recursion' warning message, about which
perldiag tells me:

     Deep recursion on subroutine "%s"
         (W) This subroutine has called itself (directly or
         indirectly) 100 times more than it has returned.  This
         writing strange benchmark programs, in which case it
         indicates something else.

Isn't it my business how deeply I recurse?  Does this message ever
really help anyone, or does it only hinder people like me who happen
to have a job that calls for deep recursion and now have to grapple
with whether to take out -w or placate users about these warning
messages?

Thanks,

Martin.


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

Date: Mon, 14 Sep 1998 13:11:03 -0700
From: darrenh@efn.org (Darren Hayes)
Subject: Hidden Input Types and Quote Marks
Message-Id: <35ff784e.13447935@news.efn.org>

Hello,

The answer for the following question is probably in a FAQ 
somewhere but I have yet to find it...

On a CGI based HTML form I have a "TextArea" field which allows 
the client fill in anything they want. For example:

<TEXTAREA NAME="Submission_Summary" ROWS=3 COLS=48 
WRAP></TEXTAREA>

Everything works great except when I pass the contents of this 
field to another HTML form using a hidden input type.

When I enter the following text into the form field:

Testing: I am entering a quote mark right now " If you see the quote
mark
the script passed muster...

then submit the form (where the cgi scripts renders a second form 
dynamically which passes the values in the first form) I see in the 
resulting dynamic HTML:

<INPUT TYPE = "hidden" NAME = "Submission_Summary" 
           VALUE = "Testing: I am entering a quote mark right now ">

As you can see the data is truncated at the first quote mark.

Any easy solution? Thanks for any ideas.

Darren




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

Date: Mon, 14 Sep 1998 22:44:05 +0200
From: "A. Beckmann" <arno@gmx.de>
Subject: HTTP-Proxy written in Perl - Possible? How?
Message-Id: <35FD8015.FF96B459@gmx.de>

I need an own HTTP Proxy in some different Unix
machines. Is it easily possible with Perl?

Only as a gateway, without buffering.
HTTP contents, CGI POST data and password requests
should be simply redirected.

I've some experience in Perl programming, but only
V4.X, so no OOP.

Is such a proxy hard to code or does a ready working
solution yet exist? 
Hmm, just linking two sockets with each other won't
be enough, cause of needed fork()?

Thanks for your help.

CU Arno


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

Date: Mon, 14 Sep 1998 21:10:40 GMT
From: showell@nxt.com
Subject: inetd -- detecting the client has gone
Message-Id: <6tk0og$qr9$1@nnrp1.dejanews.com>

I have a Perl program on Solaris that is invoked from inetd.  I cannot find a
clean way to quickly detect that the client has gone away.

The Perl program gets a small request from a WIN32 client at startup, and
thereafter, it sends data every 45 seconds or so to the client.  When the
user hits the stop button on the client, the client does a
shutdown(s,SD_BOTH), which I can see clearly in the debugger.  When I write
to STDOUT from the Perl program, though, I don't get errors for a while. 
What's the quickest way to detect a broken connection in a Perl inetd
program?

If I catch SIGPIPE, I don't catch it till pretty late.	I've tried select,
and it doesn't seem to show errors.  The way I detect the lost connection now
is by checking the return code from syswrite -- I expect it to match the
length I attempted to write (overly strict in other words).  I don't fail
until a while after the GUI has stopped the connection.

I apologize for being off topic, but it seems like a Perl guru would have
handled something like this, but I couldn't find much in DejaNews.

Thanks,

Steve Howell


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Mon, 14 Sep 1998 20:30:56 GMT
From: davesnader@my-dejanews.com
Subject: line breaks in Perl for win32
Message-Id: <6tjue0$mot$1@nnrp1.dejanews.com>

It seems that whenever I print a line feed character in perl for win32 it
automatically puts a carriage return in front of it no matter how I do it. 
For example: print OUTFILE sprintf ("%c", 10); print OUTFILE "\x0A"; print
OUTFILE pack("h1", A); all print '0D0A' to OUTFILE.  Does anyone know of a
way I can just print the line break character in a way that will work with
UNIX and NT?  I'm trying to write some portable code to create a specific
type of file.

Thanks,
Dave

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 14 Sep 1998 16:35:26 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: MIME and SMTP
Message-Id: <6tjume$4e3$1@tholian.cse.psu.edu>

You are confusing SMTP headers and message headers.
http://info.internet.isi.edu:80/in-notes/rfc/files/rfc821.txt
http://info.internet.isi.edu:80/in-notes/rfc/files/rfc822.txt

$smtp = Net::SMTP->new('relay');
$smtp->mail("nobody\@client");
$smtp->to("security\@microsoft.com");
$smtp->data();
$smtp->datasend("X-I-invented-this-message-header: hello world\n");
$smtp->datasend("Subject: buffer overflows in IE\n");

John
groenveld@acm.org


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

Date: 14 Sep 1998 16:43:30 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: NET::SMTP For NT, Please fix this script.
Message-Id: <6tjv5i$4ga$1@tholian.cse.psu.edu>

Use Dejanews, you'll find several messages for NT versions of sendmail.
Net::SMTP is available via CPAN.
I'm not sure if the CPAN module is available for NT, but under UNIX it
returns
cpan> m Net::SMTP
Module id = Net::SMTP
    DESCRIPTION  Interface to Simple Mail Transfer Protocol
    CPAN_USERID  GBARR (Graham Barr <gbarr@pobox.com>)
    CPAN_VERSION 2.10
    CPAN_FILE    GBARR/libnet-1.0605.tar.gz
    DSLI_STATUS  adpf (alpha,developer,perl,functions)
    MANPAGE      Net::SMTP - Simple Mail Transfer Protocol Client
    INST_FILE    /opt/perl/lib/site_perl/Net/SMTP.pm
    INST_VERSION 2.10

John
groenveld@acm.org


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

Date: Mon, 14 Sep 1998 21:31:38 GMT
From: nguyen.van@imvi.bls.com
Subject: passing an argument to korn script
Message-Id: <6tk1vq$sre$1@nnrp1.dejanews.com>

I have a perl script which call another korn script which uses the perl
script's $ARGV as the korn script's as well. I was not so sure how to do it
but tried as following. However, this doesn't seem working for me.

$DATE = <$ARGV>;
$DATE = shift;
`browser_crno.ksh $DATE > $DOCS_DIR/browser_crno.html`;

any thing else needs to be added.

Thanks
Van

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 3713
**************************************

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