[7296] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 921 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 25 21:18:34 1997

Date: Mon, 25 Aug 97 18:01:44 -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, 25 Aug 1997     Volume: 8 Number: 921

Today's topics:
     Perl Questions <serginho@mail.serve.com>
     Re: Perl Questions (Daniel E. Macks)
     Problem with perl script (Steve)
     Re: Problem with perl script (Daniel E. Macks)
     ReadParse <nick@wireedm.com>
     Re: Regex Matchin Problem <rootbeer@teleport.com>
     Send question for Perl Gurus (Michael Q. Le)
     Swish search engine <boblally@gte.net>
     Re: Swish search engine <boblally@gte.net>
     Tough Excel/Oleaut question... <loren_j_brown@ccm.jf.intel.com>
     Re: Web PG Generator (Lydia S. Y. Scharon)
     Re: Web PG Generator (Daniel E. Macks)
     When to use "use strict" <david_ransier@intercept.com>
     Re: When to use "use strict" (Josh Purinton)
     Re: When to use "use strict" (Michael Schuerig)
     Re: Where can I get Perl for Windows NT or Windows 95 (Chip Salzenberg)
     Re: XS (converting perl array to char**..) (Ken Fox)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 25 Aug 1997 19:11:47 GMT
From: "Sergio Stateri Jr" <serginho@mail.serve.com>
Subject: Perl Questions
Message-Id: <01bcb18b$31265ee0$ca75e7c8@AFXTD_202.Autofax>

Hi ! I think that I'll ask a FAQ, but I didn't find how to do this in Perl
Faq...I'm sorry...

How can I delete a line from a text file ?

How can I change a line from a text file ? (rewrite)

Thanks in advance and, one more time, sorry...

Regards,

-- 
--------------------------------------------------------------
Sergio Stateri Jr (Serginho)
Sao Paulo (SP) Brazil
e-mail : serginho@mail.serve.com
--------------------------------------------------------------


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

Date: 25 Aug 1997 22:06:26 GMT
From: dmacks@sas.upenn.edu (Daniel E. Macks)
Subject: Re: Perl Questions
Message-Id: <5tsvl2$rk7$1@netnews.upenn.edu>

Sergio Stateri Jr (serginho@mail.serve.com) said:
: Hi ! I think that I'll ask a FAQ, but I didn't find how to do this in Perl
: Faq...I'm sorry...

If it's a FAQ, then it's *probably* in the FAQs somewhere, but lessee...

: How can I delete a line from a text file ?
: 
: How can I change a line from a text file ? (rewrite)

Yup. perlfaq5 (Files and Formats): "How do I change one line in a
file/delete a line in a file/insert a line in the middle of a
file/append to the beginning of a file?"

dan

-- 
Daniel Macks
dmacks@a.chem.upenn.edu
dmacks@netspace.org
http://www.netspace.org/~dmacks



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

Date: Mon, 25 Aug 1997 23:02:56 GMT
From: syarbrou@ais.net (Steve)
Subject: Problem with perl script
Message-Id: <34030f10.27862976@news.ais.net>

Whenever I run this perl script, I receive the following error:

Can't find string terminator "EOM" anywhere before EOF at search.cgi
line 330.

Here is the code in question.  Can anyone see what's wrong?  Basically
this is information that is stored to be used later rather than a
bunch of print tags.

# The HTML for the top of the search results page.  
# Edit between the lines containing "EOM":^M
^M
$Header = <<EOM;^M
<HTML>^M
<HEAD>^M
<TITLE>Search Results</TITLE>^M
</HEAD>^M
<BODY BGCOLOR="#FFFFFF">^M
<H2><TT>Xavatoria Search Results</TT></H2>^M
EOM^M

Thanks.

Steve# The HTML for the top of the search results page.  Ours is
pretty ^M
# generic and should work if you aren't too creative.  Edit between ^M
# the lines containing "EOM":^M
^M
$Header = <<EOM;^M
<HTML>^M
<HEAD>^M
<TITLE>Search Results</TITLE>^M
</HEAD>^M
<BODY BGCOLOR="#FFFFFF">^M
<H2><TT>Xavatoria Search Results</TT></H2>^M
EOM^M

Thanks.

Steve


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

Date: 25 Aug 1997 23:13:19 GMT
From: dmacks@sas.upenn.edu (Daniel E. Macks)
Subject: Re: Problem with perl script
Message-Id: <5tt3if$l9s$2@netnews.upenn.edu>

Steve (syarbrou@ais.net) said:
: Whenever I run this perl script, I receive the following error:
: 
: Can't find string terminator "EOM" anywhere before EOF at search.cgi
: line 330.
: 
: Here is the code in question.  Can anyone see what's wrong?  Basically
: this is information that is stored to be used later rather than a
: bunch of print tags.
: 
: # The HTML for the top of the search results page.  
: # Edit between the lines containing "EOM":^M
: ^M
: $Header = <<EOM;^M
: <HTML>^M
: <HEAD>^M
: <TITLE>Search Results</TITLE>^M
: </HEAD>^M
: <BODY BGCOLOR="#FFFFFF">^M
: <H2><TT>Xavatoria Search Results</TT></H2>^M
: EOM^M

"EOM" ne "EOM\r", so << marches on, probably sucking up the entire
script. Most likely because because someone somewhere sometime using
some retarded Microsoft FTP client screwed up when crossing the
MS/normalworld barrier, the DOS-style end-of-line chars are still
there. Make sure to FTP your text files in text/ASCII mode, not binary
mode.

dan
-- 
Daniel Macks
dmacks@a.chem.upenn.edu
dmacks@netspace.org
http://www.netspace.org/~dmacks



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

Date: Mon, 25 Aug 1997 16:01:56 -0700
From: John Grimm <nick@wireedm.com>
Subject: ReadParse
Message-Id: <34020EE4.5189@wireedm.com>

How can I have CGI-LIB ReadParse put the info in another associative
array?


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

Date: Mon, 25 Aug 1997 16:24:20 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: andrew@ugh.net.au
Subject: Re: Regex Matchin Problem
Message-Id: <Pine.GSO.3.96.970825162035.24449A-100000@julie.teleport.com>

On Mon, 25 Aug 1997 andrew@ugh.net.au wrote:

> I was wondering why
> 
> 	if ($fred =~ m/^220/) {
> 
> never matches when $fred contains something like:
> 
> 220 corinna.its.utas.edu.au ESMTP Sendmail 8.8.5/8.8.4-utas-ff; etc
>                					     new line here ^^^^

    $ perl -w
    $fred = "220 corinna.its.utas.edu.au ESMTP Sendmail 8.8.5/8.8.4-utas-ff;\n";
    print "Matches!\n" if $fred =~ m/^220/;
    <Ctrl-D>
    Matches!

> Must be something I am missing...

Must be... :-)  Could you have meant to put the m on the other end of the
pattern? :-) 

	/^220/m			# Maybe this?

If I've misunderstood, could you make up a small test case, similar to the
above, which shows the problem? Hope this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 25 Aug 1997 21:05:54 GMT
From: lem@ece.ucdavis.edu (Michael Q. Le)
Subject: Send question for Perl Gurus
Message-Id: <5tss3i$1kt$1@mark.ucdavis.edu>

Hello,

I have a perl socket question for any of you gurus out there.
What is the perl equivalent for the following:

C code:

    #define QW_REQUEST_PREFIX '\377', '\377', '\377', '\377'

    struct {
        char prefix[4];
        char command[16];
    } serverstatus = { REQUEST_PREFIX, 's', 't', 'a', 't', 'u', 's', '\n',
            0, 0, 0, 0, 0, 0, 0};

    send( server, (const char *)&serverstatus, sizeof(qwserverstatus), 0);

I want to send a packet to a server but how do I create the equivalent
data structure as in the above C source code which is sent to the server.

Thanks for any help,

-- 
--------------------------------------------------------------------
 Michael Q. Le                      Office: (916) 752-6347
 Solid State Circuits Research Lab  Fax:    (916) 752-8428
 Dept. of Electrical Engineering    University of California, Davis

 Powered by Debian GNU/Linux
   http://junior.ece.ucdavis.edu    lem@junior.ece.ucdavis.edu
--------------------------------------------------------------------


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

Date: 25 Aug 1997 19:19:21 GMT
From: "Bob lally" <boblally@gte.net>
Subject: Swish search engine
Message-Id: <5tslrp$nrs$1@gte1.gte.net>

 Hi:

I downloaded the swish  and wwwwais software and have swish running through
a telnet connection.  I can not seem to swish to work properly through
wwwwais.

Has anyone installed this and have it working?  I am using the 1.5 version.

Thanks.

Bob





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

Date: 25 Aug 1997 19:43:30 GMT
From: "Bob lally" <boblally@gte.net>
Subject: Re: Swish search engine
Message-Id: <5tsn92$ir7$1@gte1.gte.net>

 OOPS:  version 2.5.

Sorry.

Bob

Bob lally wrote in article <5tslrp$nrs$1@gte1.gte.net>...

> Hi:
>
>I downloaded the swish  and wwwwais software and have swish running through
>a telnet connection.  I can not seem to swish to work properly through
>wwwwais.
>
>Has anyone installed this and have it working?  I am using the 1.5 version.
>
>Thanks.
>
>Bob
>
>
>




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

Date: 25 Aug 1997 21:43:56 GMT
From: "Loren Brown" <loren_j_brown@ccm.jf.intel.com>
Subject: Tough Excel/Oleaut question...
Message-Id: <01bcb19f$e6d70960$699f8686@pentii.jf.intel.com>


Greetings Gurus,

I have a perl script as follows:

==================================
use OLE;
$ExcelApp = CreateObject OLE "excel.application" || die "Unable to create
Excel Object: \n";

$ExcelApp->{'Visible'} = 1;
$ExcelApp->Workbooks->Add();

# Set two values
$ExcelApp->Cells(1,1)->{Value} = "1";
$ExcelApp->Cells(2,1)->{Value} = "2";

# Prepare to do an AutoFill
$sourcerange = $ExcelApp->Sheets("Sheet1")->Range("A1:A2");
$fillrange = $ExcelApp->Sheets("Sheet1")->Range("A1:A20");

# ***** HERE IS THE PROBLEM >>>> nothing happens WHY!!!!!????
$sourcerange->AutoFill($fillrange);

=================================

For some reason, the $fillrange variable isn't being passed or received
correctly and hence, AutoFill doesn't work.

This is a smaller version of a larger problem I have getting Excel charts
to work.

I would appreciate any help on this problem or pointers to example
perl scripts using MS-Excel.

Thanks * 1,000,000

Loren...


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

Date: 25 Aug 1997 15:47:24 -0500
From: lss2@clarion.cec.wustl.edu (Lydia S. Y. Scharon)
Subject: Re: Web PG Generator
Message-Id: <5tsr0s$drt@clarion.cec.wustl.edu>

You Wrote:

>Has anyone built or run accross a CGI/PERL Instant Web Page Generator?
>Please let me know of any or anyone who can create one.

Last year for an employee's incentive program, we wrote an automatic home
page generator which provided three modes of building a home page - using
templates, building blocks, or straight html, depending on the user's
skill level.  All user interaction was through a web interface.  If you
would like more information please email me at lydia@protospace.com.

Lydia Scharon
ProtoSpace Corporation


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

Date: 25 Aug 1997 21:08:25 GMT
From: dmacks@sas.upenn.edu (Daniel E. Macks)
Subject: Re: Web PG Generator
Message-Id: <5tss89$u6v$1@netnews.upenn.edu>

Jeff Hinds (jhinds@nospamidir.net) said:
: Has anyone built or run accross a CGI/PERL Instant Web Page Generator?
: Please let me know of any or anyone who can create one.

I'm a bit uncertain what exatly you want it to do. If you gave more
details, you might get a more relevant answer, but here's a pretty
simplistic one...

#!/usr/bin/perl

open(HTML,">test.html") or die("Could not open test.html ($!)\n");
print HTML <<'EOHTML';
<html>
<!-- include your HTML page here -->
</html>
EOHTML


-- 
Daniel Macks
dmacks@a.chem.upenn.edu
dmacks@netspace.org
http://www.netspace.org/~dmacks



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

Date: 25 Aug 1997 19:02:00 GMT
From: "David Ransier" <david_ransier@intercept.com>
Subject: When to use "use strict"
Message-Id: <01bcb189$cd0983c0$714b62c7@itibit>

I've been writing some pretty large Perl programs and I'm definitely still
learning about Perl.

This weeks question is about "use strict".  I'm trying to add "some polish"
to my programs and "use strict" seems like a good cleanup mechanism.

My problem is, when "use strict refs" is enabled, I need to fully qualify
my variable names with Package identifiers. I've never seen any programs
that others have written using fully qualified variables. 

I'd like to hear some opinions from others. For programs I intend to send
to customers, should I use "use strict"? Should I use Package identifiers
and fully qualify variable names? Other than "-w", are there other
important switches I should be using to add polish to my Perl programming
style?

Thanks for any help,
David R


------------------------------------------------------------------------
     _/_/_/  _/_/_/_/_/  _/_/_/  David M. Ransier
      _/        _/        _/           Senior Consultant
     _/        _/        _/            Intercept Technology Inc.
    _/        _/        _/             David_Ransier@Intercept.com
   _/        _/        _/              503-692-0111  www.intercept.com
_/_/_/      _/      _/_/_/          503-691-9535 (NEW fax number)
                                         404-352-0111 ( ITI World-Wide
Headquarters )



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

Date: 25 Aug 1997 13:36:56 -0700
From: joshp@silmaril.com (Josh Purinton)
Subject: Re: When to use "use strict"
Message-Id: <5tsqd8$qjr$1@shell3.ba.best.com>

[ posted and mailed ]

The one and only David Ransier <david_ransier@intercept.com> writes:

> My problem is, when "use strict refs" is enabled, I need to fully
> qualify my variable names with Package identifiers.

Declare variables global to a package with 'use vars', e.g.

	package MyPackage;
	use vars qw/$foo @bar %baz/;

This makes $foo, @bar, and %baz global to MyPackage.  (I wish the
documentation for 'strict' mentioned this.) While inside MyPackage, you can
now refer to them without the MyPackage:: prefix.  'perldoc vars' for
more information.  Good examples of 'use vars' are in File::Copy.pm
and CPAN.pm.

> I'd like to hear some opinions from others.  For programs I intend
> to send to customers, should I use "use strict"?

Using strict shortens development and maintenance time.  Randal
Schwartz suggests using strict on all programs that are longer than
5-10 lines.

> Should I use Package identifiers and fully qualify variable names?

Either that or use the 'vars' module described above.

> Other than "-w", are there other important switches I should be
> using to add polish to my Perl programming style?

Use the -T switch to make setuid scripts more secure by turning on
taint checks.  'man perlsec' for more information.

--Josh




-- 
Josh Purinton <joshp@silmaril.com>
Of course the US Constitution isn't perfect; but it's alot better
than what we have now.  -- Eric Sheppard (ce1zzes@prism.gatech.edu)


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

Date: Tue, 26 Aug 1997 00:47:06 +0200
From: uzs90z@uni-bonn.de (Michael Schuerig)
Subject: Re: When to use "use strict"
Message-Id: <19970826004706219506@rhrz-isdn3-p4.rhrz.uni-bonn.de>

Josh Purinton <joshp@silmaril.com> wrote:

> Declare variables global to a package with 'use vars', e.g.
> 
>   package MyPackage;
>   use vars qw/$foo @bar %baz/;

Is there a difference or advantage to writing it as

    pacackge MyPackage;
    my $foo;
    my @bar;
    my %baz;


Michael

--
Michael Schuerig                        Although condemned by moralist,
mailto:uzs90z@uni-bonn.de           lying can have high survival-value.
http://www.uni-bonn.de/~uzs90z/                    -Richard L. Gregory


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

Date: 25 Aug 1997 23:30:28 GMT
From: chip@rio.atlantic.net (Chip Salzenberg)
Subject: Re: Where can I get Perl for Windows NT or Windows 95
Message-Id: <5tt4ik$c3h$1@news1.atlantic.net>

According to mpatel@indev.demon.co.uk:
> Is there a Windows NT/95 version of Perl? If so where can
> I get a version from.

  www.perl.com/CPAN/authors/id/GSAR

Grab the newest big zip file.
-- 
Chip Salzenberg          - a.k.a. -           <chip@pobox.com>
 (Roller coaster on camera:)  "Wow, this square quarter mile
    has unbelievably good light rail transit!"  // MST3K


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

Date: 25 Aug 1997 22:20:00 GMT
From: fox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: XS (converting perl array to char**..)
Message-Id: <5tt0eg$hko5@eccws1.dearborn.ford.com>

Buzz Moschetti <buzz@bear.com> writes:
> John Tucker wrote:
> > I'm using perlxs to create a perl extension package for a set C
> > functions and most of thes functions expect a "char**" member which
> > represents an array of file pathnames.
> > [...]
> >   int
> >   func(files, branch="", comment=".")
> >         char **files;
> >         char *comment;
> 
> The out-of-the-box typemap of char** is
> 	char** p_arr = XS_unpack_charPtrPt(ST(0))
> 
> XS_unpack_charPtrPtr is not defined anywhere and even if it was,
> there's a small matter of the memory allocated for p_arr.

There are quite a few places in the standard typemap that look
bogus.  I've posted a query to the p5p mailing list, but so far
nobody has said anything.  (Everybody at the perl conference?)

> I recommend passing either a va list or an AV*, mallocing the
> char** yourself, and iterating over the collection, calling
> SvPV(ST(n), na) to populate the elements of the array.

I've never gotten the default typemap conversion for AV * to work
for me.  I always prototype with an SV * and then do the type check
and croak myself.  Is this what you do?

Of course, there is still the problem of what to do with the
array length.  It is easy for that to get lost.  A proxy struct
and a perl helper function is probably the easiest and most
robust way to go.  That approach will even gabage collect the
array in the event of an exception.  (I think I discussed this
in my first answer to this question.)

- Ken

-- 
Ken Fox (kfox@ford.com)                  | My opinions or statements do
                                         | not represent those of, nor are
Ford Motor Company, Powertrain           | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section             | "Is this some sort of trick
                                         |  question or what?" -- Calvin


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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