[7556] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1182 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 15 19:17:20 1997

Date: Wed, 15 Oct 97 16:00:38 -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           Wed, 15 Oct 1997     Volume: 8 Number: 1182

Today's topics:
     "Attaching" a zipped file <synex@snx.com>
     Re: [cperl-mode] How do I get that kind of indent: (Toutatis)
     Re: [Q]: cgi/perl: Location (brian d foy)
     An SMTPD in Perl <XturianX@fas.harvard.edu>
     Re: Bulk email solution needed that works with Linux, P <nelson@crynwr.com>
     Re: Cannot Use use (Andrew M. Langmead)
     Re: CGI scripts to access client hard drives (brian d foy)
     Re: CGI.pm and variable named form elements (Faust Gertz)
     CGI.pm uploading files (Ted Braun)
     Re: Constants <rootbeer@teleport.com>
     Date::Manip (Aram Mirzadeh)
     Re: global variable under "use strict" (Toutatis)
     Re: global variable under "use strict" (brian d foy)
     Re: Grepping on a Parenthesis and an Asterisk in a Perl (Tad McClellan)
     Re: Help on Security Issues <rootbeer@teleport.com>
     Re: How to make a word bold? (brian d foy)
     Need a good perl guy for short project: shopping cart <user@msn.com>
     Re: Need a good perl guy for short project: shopping ca (Faust Gertz)
     open() missing line <chiyung@b1.hkstar.com>
     Re: open() missing line (brian d foy)
     Re: Perl output in another frame (brian d foy)
     Re: Perl Revision History - problem with Hash's (brian d foy)
     Perl support (Patrick Hanly)
     Re: Perl system() call never returns (Solaris 2.5.1, Pe <rootbeer@teleport.com>
     Re: PGP encoding with MIME::Entity? (Bruno Wolff III)
     Re: Problems with flock <rootbeer@teleport.com>
     regular expression extensions <svr5@cac.psu.edu>
     Re: regular expression extensions (brian d foy)
     Save As... Name on MS Word downloads <mark@metro2000.net>
     Re: SCO Unix (Neil Briscoe)
     Some strange Perl things? <jxikis@mail.hsclib.sunysb.edu>
     Re: statics or const in perl ? (dave)
     Tab delimited fields <gbh@middlemarch.net>
     Re: Tab delimited fields (brian d foy)
     WIN32::Process Module (NT) <matthew.kravitz@systecinc.com>
     Re: Writing/Reading Bin Files (need example) (Andrew M. Langmead)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 15 Oct 1997 17:25:44 -0400
From: Stacy Hunter <synex@snx.com>
Subject: "Attaching" a zipped file
Message-Id: <344534AD.827417EE@snx.com>

Subject:
               Attaching a zipped file
         Date:
               Wed, 15 Oct 1997 16:58:30 -0400
        From:
               Stacy Hunter <synex@snx.com>
 Organization:
               SNX (formally SYNEX)
 Newsgroups:
               comp.mail.mime
 
 
 

I have a perl script that successfully "attaches" an hqx application and

sends it to an email address. When I try the same script with a zipped
file it arrives garbled and when I save it onto my desktop (mac) it is 0

k (no content).Additionally, if I don't use my scritp but attach it
using Pine it loads and downloads fine (as is true when I attach it
using Netscape. What are these two methods ddoing to encrypt it that I
am not seeing? The headers are identical and the one I used to transmit
(applicaation; x-zip) and Base64.

Any help would be most appreciated.

- Stacy
 
 



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

Date: 15 Oct 1997 20:35:00 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: [cperl-mode] How do I get that kind of indent:
Message-Id: <toutatis-ya023180001510972234590001@news.euro.net>

In article <3444FF3E.6F6A0895@idnet.fr>, Nicolas MONNET <nico@idnet.fr> wrote:

> I want something like:
> 
> very_long_function_name(
>     "Parameter 1",
>     second_parameter(),
>     0
> );

Sucks a lot

>         instead of:
> 
> very_long_function_name(
>                         "Parameter 1",
>                         second_parameter(),
>                         0
>                         );

Sucks a little
 
> ... which, you have to admit, sucks as much as one can.
> Is it just possible?

You just proved it.

> I'm not that familiar with elisp/emacs. Is there a way to twiddle
> cperl so that it will treat parentheses as braces somehow? (let
> alone all the electric stuff)

I'd say twiddle your function names...

-- 
Toutatis


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

Date: Wed, 15 Oct 1997 16:46:07 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: [Q]: cgi/perl: Location
Message-Id: <comdog-ya02408000R1510971646070001@news.panix.com>

[nb: follow ups set]

In article <344516DF.6850@cisco.com>, Ganesan Ramu <rganesan@cisco.com> wrote:

>A server gives an URL to its client and the client has to open the
>URL with a *new* browser window.

See the references under "FAQs" and "Working with Frames" in the
CGI Meta FAQ for the answer to your question.

further CGI issues should be directed to comp.infosystems.www.authoring.cgi

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 15 Oct 1997 21:29:42 GMT
From: Joseph Turian <XturianX@fas.harvard.edu>
Subject: An SMTPD in Perl
Message-Id: <623ck6$5p2$1@news.fas.harvard.edu>
Keywords: smtpd perl smtp sendmail

I was interested in writing a no-frills smtpd that would merely receive local
mail and reject anything else. For fun, I thought that it would be cool to
write the thing in Perl.

How exactly would I go about writing a server? If the answer in RTFM, which
FM? I have RFC 821, but what FM is there for writing a server in general?
Like for, example, I never would have imagined without anyone having told me
that when a server receives a connection that it should fork.

-- 
Joseph Turian
XturianX@fas.harvard.edu
http://wish.student.harvard.edu

Home address:    Wigglesworth B-22
Mailing address: 2507 Harvard Yard Mail Center
                 Cambridge, MA 02138
Home phone:      (617) 493-3917

In an attempt to reduce junk email I display an invalid email address.
My correct email address can be determined by removing the Xs.


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

Date: 15 Oct 1997 17:39:34 -0400
From: Russell Nelson <nelson@crynwr.com>
Subject: Re: Bulk email solution needed that works with Linux, Perl
Message-Id: <m2sou2so2x.fsf@desk.crynwr.com>

Chris Schoenfeld <chris@ixlabs.com> writes:

> We have a email subscription service for the users of one of our
> client's websites. The user can specify the information which appears in
> their email, which results in all the email contents being unique.

Problems with sendmail are best solved by installing qmail.
http://www.qmail.org.

-- 
-russ <nelson@crynwr.com>  http://www.crynwr.com/~nelson  | Freedom is the
Crynwr Software supports freed software | PGPok |   primary cause of peace.
521 Pleasant Valley Rd. | +1 315 268 1925 voice | Taxes feed the naked
Potsdam, NY 13676-3213  | +1 315 268 9201 FAX   |   and clothe the hungry.


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

Date: Wed, 15 Oct 1997 22:35:50 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Cannot Use use
Message-Id: <EI46rq.CE@world.std.com>

Rick <rbrewer@ccmail.dsccc.com> writes:
>I am trying to make use of Perl modules but cannot get "use"
>to find the modules. Even when adding the command:
>push (@INC, "/usr/local/perl/lib");
>then
>use Carp;

This is a rather unintuitive aspect of perl. The "use" function works
at compile time (while perl is parsing your script.) and the push()
function happens at runtime. So even though the "push" appears before
"use", it happens to late to control the @INC directories that "use"
looks through.

Since you can't use Carp, you probably can't use the "use lib" module
either. The only way I can see fix things is by putting the push
function inside a BEGIN block like this:

BEGIN {
 push (@INC, "/usr/local/perl/lib");
}

use Carp;

A script can have more than one BEGIN block, and the contents of those
blocks happen at compile time, just like this "use" statement. (and
since the BEGIN is earlier in the script than the "use" it will happen
first. Actually, if you look up "use" in the perlfunc man page, you
see it decribed in terms of BEGIN.

Just to point out, not being able to "use Carp" implies that perl on
this system not configured correctly. You may want to recompile it so
that it can find its standard modules.

-- 
Andrew Langmead


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

Date: Wed, 15 Oct 1997 16:43:26 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: CGI scripts to access client hard drives
Message-Id: <comdog-ya02408000R1510971643260001@news.panix.com>

[nb: follow ups set]

In article <876924534.6101@dejanews.com>, praveen_s@trigent.com wrote:

>I am looking for help on Perl CGI scripts or mechanisms 

CGI issues are discussed in comp.infosystems.www.authoring.cgi, but
you should check the FAQs for your answers. The CGI Meta FAQ has pointers 
to the documents that will help you answer your questions.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Wed, 15 Oct 1997 20:13:48 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: CGI.pm and variable named form elements
Message-Id: <34451e5d.993703@news.wwa.com>

On Tue, 14 Oct 1997 12:33:47 -0400, Stephan Vladimir Bugaj
<bugaj@bell-labs.com> wrote:

>I tried:
>
>$query->textfield(-name=>$foo);
>$query->textfield(-name=>"$foo");
>
>both to no avail (the form winds up with NAME=" " where $foo should have
>been). Clearly '$foo' just gives the string $foo as the name of
>the form field... 
>
>I want to be able to do this
>
>foreach $fieldname (@fields)
>{
>	$query->textfield(-name=>$fieldname, ...
>	  ... more code... 
>}

I don't see why this wouldn't work.  Here are some pieces of code that
I beleive work.

This just modifies the values stored in $q.

:#   Replace newlines with spaces, reduce number of spaces to one, and
:#   escape single and double quotation marks.
:
:for ($q->param) {
:    $value = $q->param($_);
:    $value =~ s/(['"])/\\$1/g;
:    $value =~ tr/\015\012 / /s;
:    $q->param(-name=>$_,-value=>$value);
:}

and here is part of some code to generate a page and the subroutine
which feeds variables to the CGI object.

:print $query->startform;
:print "\t<TR>\n", &input('text',     'name',       1, 3, 25), "\t</TR>\n";
:print "\t<TR>\n", &input('textarea', 'street',     1, 3, 50, 2), "\t</TR>\n";
:print "\t<TR>\n", &input('text',     'city',       1, 1, 25);
:print             &input('text',     'state',      1, 1, 15), "\t</TR>\n";
:print "\t<TR>\n", &input('text',     'country',    1, 1, 25, 1, 'United States');
:print             &input('text',     'zip',        1, 1, 12), "\t</TR>\n";
:print "\t<TR>\n", &input('text',     'home_phone', 1, 1, 16);
:print             &input('text',     'work_phone', 1, 1, 16), "\t</TR>\n";
:print "\t<TR>\n", &input('text',     'e-mail',     1, 3, 25), "\t</TR>\n";

:sub input {
:
:$_[2] ||= 1;
:$_[3] ||= 1;
:$_[4] ||= 20;
:$_[5] ||= 1;
:my ($colspan, $value) = ($_[2] + $_[3]);
:
:if ($_[0] eq 'view'){
:     if ($query->param($_[1])) {
:          $value  = join ('', "\t\t<TD COLSPAN=$_[2]>\n\t\t\t<STRONG>", &label($_[1]), ":</STRONG>\n\t\t</TD>\n\t\t<TD COLSPAN=$_[3]>\n\t\t\t", $query->escapeHTML($query->param($_[1])), "<BR>\n\t\t</TD>\n");
:     }
:     else {
:     $value  = "\t\t<TD COLSPAN=$colspan>\n\t\t\t<PRE></PRE>\n\t\t</TD>\n";
:     }
:}
:elsif ($_[0] eq 'text') {
:     $value  = join ('', "\t\t<TD COLSPAN=$_[2]>\n\t\t\t<STRONG>", &label($_[1]), ":</STRONG>\n\t\t</TD>\n", "\t\t<TD COLSPAN=$_[3]>\n\t\t\t", $query->textfield(-name=>$_[1], -size=>$_[4]), "\t\t</TD>\n");
:     $value  = join ('', "\t\t<TD COLSPAN=$_[2]>\n\t\t\t<STRONG>", &label($_[1]), ":</STRONG>\n\t\t</TD>\n", "\t\t<TD COLSPAN=$_[3]>\n\t\t\t", $query->textfield(-name=>$_[1], -default=>$_[6], -size=>$_[4]), "\t\t</TD>\n") if $_[6];
:}
:elsif ($_[0] eq 'textarea') {
:     $value  = join ('', "\t\t<TD COLSPAN=$_[2]>\n\t\t\t<STRONG>", &label($_[1]), ":</STRONG>\n\t\t</TD>\n", "\t\t<TD COLSPAN=$_[3]>\n\t\t\t", $query->textarea(-name=>$_[1], -columns=>$_[4], -rows=>$_[5]), "\t\t</TD>\n");
:}
:
:return ($value);
:
:}

Please excuse all the yucky HTML formating.  I wouldn't do it that way
again, but you should be able to see how this works and maybe see the
difference, if any, between my code and your code.  If all else fails,
did you run perl -w and 'use strict;'?


HTH

Faust Gertz
Philosopher at Large


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

Date: Thu, 16 Oct 1997 06:52:17 +0900
From: braun@safins.or.jp (Ted Braun)
Subject: CGI.pm uploading files
Message-Id: <braun-1610970652170001@tkycc-01p65.ppp.odn.ad.jp>

I am having problems uploading *non-text* files via using HTML - upload,
CGI - POST, and then Perl via CGI.pm and specifically
start_multipart_form().  I am able to upload text files (ie say a
tab-delimited flat file) fine.  But am unable to upload say a Gif or
Excel formatted file (ie a file that would test out to a -B file as
opposed to a -T file) for example.

I see where it can be done as I have seen it done at a few places out on
the internet for all types of files, Excel, MIDI, GIF, etc, but am
currently unable to do it and it is driving me crazy.

I have read and tried things per the documentation at:
           http://www.genome.wi.mit.edu/ftp/pub/software/WWW/#multipart
ie within L. Stein's CGI.pm library, but am still unable to do it (again,
am fine with standard text files though).  Does anyone have a specific
code ex. that they could post for me, or a specific place for me to look
where I could figure this out.

Thanks for any inputs,
-ted 
aaa23700@pop01.odn.ne.jp


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

Date: Wed, 15 Oct 1997 14:13:39 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Matthew Cravit <mcravit@best.com>
Subject: Re: Constants
Message-Id: <Pine.GSO.3.96.971015140837.13645V-100000@usertest.teleport.com>

On 14 Oct 1997, Matthew Cravit wrote:

>     sub NUMERIC_CONSTANT { 27.3; }

>     $foo += NUMERIC_CONSTANT;

Unfortunately...

     $bar = NUMERIC_CONSTANT + 3;

     print "$bar\n";

Doesn't do what you might expect. I encourage everyone to "constantly" use
constant.pm, instead. 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/
              Ask me about Perl trainings!



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

Date: 15 Oct 1997 19:27:28 GMT
From: awm@luers.qosina.com (Aram Mirzadeh)
Subject: Date::Manip
Message-Id: <slrn64a690.dgt.awm@luers.qosina.com>
Keywords: Date::Manip Perl Date

*** REMOVE .nospam from email before replying ***

I'm trying to use Date::Manip to find 2 business days ago from today, I 
have: 

$time = (localtime);		# Wed Oct 15 15:17:20 1997

I need to find:  Mon Oct 13 00:01:00 1997 

I tried using Date::Manip from CPAN, but the format seems to always come out
wrong, when I try to reduce 2 business days from the date. 

Ex: 1997101300:01:00

Any help would be greatly appreciated. 

Thanks in advance. 

<Aram>

*** REMOVE .nospam from email before replying ***

-- 
                                        | Aram Mirzadeh
I'm not under the alkafluence of inkahol| MIS Manager
that some thinkle peep I am.            | Qosina Corp.
It's just the drunker I sit here the    | http://www.qosina.com/~awm/
longer I get.                           | awm@qosina.com
                			| Apache httpd - awm@hyperreal.com
	   -- PGP Key http://www.qosina.com/~awm/pgpkey.html --
	  -- BE 49 9D F6 2A A7 22 FC  02 E9 1E 3D F7 0C 67 A0 --


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

Date: 15 Oct 1997 20:08:55 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: global variable under "use strict"
Message-Id: <toutatis-ya023180001510972208540001@news.euro.net>

Jeremy D. Zawodny wrote:
> Toutatis wrote:
> >Jeremy D. Zawodny wrote:

> >> my $global_foo = 50;
> >
> >You can not define a global variable with 'my': au contraire.
> >If you want to define a global variable, say:
> >$global = 'value';
> >However, 'strict' wants you to fully specify the package name, so
> >you have to be more specific:
> >$packagename::global = 'value';
> >UNLESS you tell strict you intend to use $global as a global, by saying:
> >use vars qw($global);
> 
> But my way of doing "global" variables should have satisfied the
> original need, no?

Your "way of doing global" means creating a *private*, lexically scoped
variable, that you happen to access from within the same block (in this
case, the script). Outside that block (required subroutines, used modules)
this variable is not visible, cause you declared it with 'my'.

#!/usr/bin/perl -w
use strict;

{
package Foo;
use vars qw($one);
$one = 10;
my $two = 20;
}

{
package Bar;
print ("\$Foo::one = '$Foo::one'\n",
       "\$Foo::two = '$Foo::two'\n");
}

prints:
$Foo::one = '10'
$Foo::two = ''

Now if I wouldn't use strict, I could just say:

#!/usr/bin/perl -w
{
package Foo;
$one = 10;
}
{
package Bar;
print $Foo::one,"\n";
}

Maybe this will clear up things a little.

-- 
Toutatis


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

Date: Wed, 15 Oct 1997 16:51:10 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: global variable under "use strict"
Message-Id: <comdog-ya02408000R1510971651100001@news.panix.com>

In article <3444f224.169108925@igate.hst.moc.com>, zawodny@hou.moc.com (Jeremy D. Zawodny) wrote:


>>> #!/usr/local/bin/perl
>>> 
>>> use strict;
>>> 
>>> my $global_foo = 50;

>But my way of doing "global" variables should have satisfied the
>original need, no?

but your way is not a "global" variable.  whether or not it satisfied 
the conditions of the problem are irrelevant to the definition of
"global" :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Wed, 15 Oct 1997 15:16:39 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Grepping on a Parenthesis and an Asterisk in a Perl Script
Message-Id: <7b8326.kuh.ln@localhost>

Kevin M Simonson (simonsen_nospam@skopen.dseg.ti.com) wrote:
:      I need to write a Perl script that takes the last line of a data file
: that has a substring beginning with a right parenthesis asterisk pair, and
: ending with the string " ns *)", and extracts from the contents of this
: substring between these two boundaries.  


Like this?


   while (<>) {
      $last_one = $1 while /\Q(*\E(.*?)\Q ns *)/g;
   }

   print "the last one '$last_one'\n";


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Wed, 15 Oct 1997 15:26:22 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: John Timothy Kelly <johnk@discover-net.net>
Subject: Re: Help on Security Issues
Message-Id: <Pine.GSO.3.96.971015151528.13645W-100000@usertest.teleport.com>

On Wed, 15 Oct 1997, John Timothy Kelly wrote:

> 	I was wondering if anyone might be able to help me with adding
> security coding to a guestbook file I am writing for my web page.

I don't want to get on your case, but I'm still going to take issue with
your choice of words. :-)  The way you say that, it's as if security is an
extra that is added to a script - but really, you need to write the script
from the start with security in mind.

A good place to start is the www security FAQ. The CGI Security tutorial
is good too.

    http://www.w3.org/Security/Faq/
    http://hoohoo.ncsa.uiuc.edu/cgi/security.html
    http://www.go2net.com/people/paulp/cgi-security/ 

If you have Perl questions not answered in these or in the Perl docs and
FAQs, please ask them here. Thanks for making the world a safer place! :-)

-- 
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/
              Ask me about Perl trainings!



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

Date: Wed, 15 Oct 1997 16:29:51 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: How to make a word bold?
Message-Id: <comdog-ya02408000R1510971629510001@news.panix.com>

In article <62351b$a6t@freenet-news.carleton.ca>, as646@FreeNet.Carleton.CA (John Robson) wrote:

>How do you make a word or pattern *bold* by using the substitution.
>Is it possible to do this in Perl?

Perl doesn't know anything about bold.  Perhaps this is a TeX question?
if you explain what you are trying to do (the big picture, not the fine
detail) someone might be able to help. :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Wed, 15 Oct 1997 13:00:53 -0700
From: "Patrick Jia" <user@msn.com>
Subject: Need a good perl guy for short project: shopping cart
Message-Id: <01bc9d22$bfca8220$fe522299@venus>


Hi,
	I have a "short project" for shopping cart & password entry log form.
Anyone intereested: $ 100-200 extra cash for you. Please reply to my
regular email
at pj@bestlink.net..
thks so much for your time.

Patrick 


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

Date: Wed, 15 Oct 1997 22:43:52 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Need a good perl guy for short project: shopping cart
Message-Id: <344545fb.3275287@news.wwa.com>

On Wed, 15 Oct 1997 13:00:53 -0700, "Patrick Jia" <user@msn.com>
wrote:

>	I have a "short project" for shopping cart & password entry log form.
>Anyone intereested: $ 100-200 extra cash for you. 

So do you anticipate this project only about one or two hours?  :-)  

Is there any consensus on whether we want to allow job related posts
or if we should ask that they be redirected to
misc.jobs.offered/contract or some other job newsgroup?  I think some
newsgroups (Smalltalk and SAS) allow it, but I know others forbid it.


Streben nach Wahrheit

Faust Gertz
Philosopher at Large


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

Date: Wed, 15 Oct 1997 12:07:05 +0800
From: Aldoliu Chan <chiyung@b1.hkstar.com>
Subject: open() missing line
Message-Id: <Pine.SOL.3.95.971015120315.26290A-100000@b1.hkstar.com>

Hi,

TEST.DAT
--------
ABC
DEF

open(d, 'test.dat');
while (<d>){
  $one=<d>;
  $two=<d>;
}
close(d);
print "ONE=$one\n";
print "TWO=$two\n";


OUTPUT:
ONE=DEF
TWO=


Why the first line was skipped?


Cheers,
Aldoliu Chan 
==========================================================================
Senior Programmer                           e-mail: aldoliu@mailhost.net 
Citybus Limited                                     chiyung@hkstar.com
(HONG KONG) ** ICQ:1684644                          isbyron@citybus.com.hk



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

Date: Wed, 15 Oct 1997 18:28:03 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: open() missing line
Message-Id: <comdog-ya02408000R1510971828030001@news.panix.com>

In article <Pine.SOL.3.95.971015120315.26290A-100000@b1.hkstar.com>, Aldoliu Chan <chiyung@b1.hkstar.com> wrote:

>while (<d>){
>  $one=<d>;
>  $two=<d>;
>}

>Why the first line was skipped?

look what you did in the while condition - you read a line into $_
then did nothing with it.  once inside the loop, you read the next
line into $one and the next line after that into $two.  once the
loop goes past that it reads the next line into $_ again, overwriting
the previous value of $_.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Wed, 15 Oct 1997 16:38:17 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl output in another frame
Message-Id: <comdog-ya02408000R1510971638170001@news.panix.com>

[nb: follow ups set]

In article <876933473.6922.0.nnrp-01.9e98215b@news.demon.co.uk>, "Alp Bora Toker" <abt@unistat.demon.co.uk> wrote:

>Firstly, I'm not sure weather this is the correct newsgroup to post to, but
>please can you help anyway? 

CGI issues are discussed in comp.infosystems.www.authoring.cgi

>Can anyone help me to select the
>frame into which the results are displayed so that the submit button can be
>on another separate frame without having reloading the  entire frame-set?

References and documentation on working with Frames and most other
CGI issues can be found through the CGI Meta FAQ.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Wed, 15 Oct 1997 16:35:29 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl Revision History - problem with Hash's
Message-Id: <comdog-ya02408000R1510971635290001@news.panix.com>

In article <jjRo$AAjjPR0Ew2o@connected.demon.co.uk>, SPAM FILTER <Its.Spelt.out.in.the.Sig@File.OK> wrote:

>My (almost complete) shopping kart seems to be returning strange results
>(too many and varied to list but it seems to be to do with processing
>hash's.  

   * are you doing something really wierd?

   * are you using a non-broken CGI library?

   * does the input data look the same as it did before?

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 15 Oct 1997 16:07:08 -0400
From: phanly@panix.com (Patrick Hanly)
Subject: Perl support
Message-Id: <6237pc$do4@panix3.panix.com>
Keywords: perl support

Does anyone know of a company that provides professional quality support
for perl?

I know a company named Cygnus used to but upon contacting them I found 
that they no longer work with perl.

Thanks.



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

Date: Wed, 15 Oct 1997 13:58:53 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Bruce Hahne <hahne@netcom.com>
Subject: Re: Perl system() call never returns (Solaris 2.5.1, Perl 5.004_03)
Message-Id: <Pine.GSO.3.96.971015135118.13645U-100000@usertest.teleport.com>

On Tue, 14 Oct 1997, Bruce Hahne wrote:

> Problem: calls to Perl's system() command intermittently fail to return
> for some system() calls, and always fail to return for other types of
> system()  calls.

That's (almost always) the fault of the called program, which may have an
infinite loop. 

> When system() fails to return, the Perl process spins forever and burns
> CPU. 

If that's so, that perl is wedged and the child is done, you've found a
bug. Can you use gdb on it?

>   if($CHECKPOINTS) { print stderr "Checkpoint 1\n"; }
>   $cmd = "$MYCOMMAND -t -m $filename1 -o=$filename2";
>   system($cmd);

Do you still have the problem if there's no shell involved?

    system($MYCOMMAND, '-t', '-m', $filename1, "-o=$filename2";

> When $MYCOMMAND is run from the shell command line, it works and exits
> properly. 

What about when it's run in other ways. :-)  It may not be hanging, but
the shell which called it may be. (Not likely, but perhaps.)

Here's a wild guess: Do you install a handler for CHLD? Or, is yours a CGI
script run by a server which has a handler for that signal? Try explicitly
setting the handler to 'DEFAULT' and see what you get. Good luck!

-- 
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/
              Ask me about Perl trainings!



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

Date: 15 Oct 1997 20:44:01 GMT
From: bruno@cerberus.csd.uwm.edu (Bruno Wolff III)
Subject: Re: PGP encoding with MIME::Entity?
Message-Id: <6239uh$mp3@uwm.edu>

>From article <343DECE9.C28728A0@neckar-alb.de>, by Jochen Wiedmann <wiedmann@neckar-alb.de>:
] Hello,
] 
] I'd like to use the Mimetools package for automagically encoding
] mails with PGP. Integration into sendmail is no problem, I have
] it up and running. What I don't understand is, how to use the
] MIME::Entity object I have got after parsing the mail. For
] example, I could:
] 

Take a look at RFC 2015. The mutt MUA uses this standard for sending and
receiving encrypted messages. I don't know if any other MUAs do.
I have written a dice roller in perl that sends out pgp signed die
rolls using this standard.
-- 
I do not accept mail that originates or is relayed through hosts in AGIS,
UUNET, BT-NET, Internet Direct, Flashnet Comm, or Mindspring net blocks. Other
net blocks will be blocked as needed.


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

Date: Wed, 15 Oct 1997 13:49:27 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Peter J. Schoenster" <pschon@baste.magibox.net>
Subject: Re: Problems with flock
Message-Id: <Pine.GSO.3.96.971015134739.13645T-100000@usertest.teleport.com>

On Tue, 14 Oct 1997, Peter J. Schoenster wrote:

> But it seems as though I should
> 
> open
> flock
> close
> 
> Since the close will do the unflocking. 

Yes. Except for people who understand all about input and output buffers
in Perl, (and you know who you are) you should never explicitly unlock a
filehandle. Cheers!

-- 
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/
              Ask me about Perl trainings!



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

Date: Wed, 15 Oct 1997 17:50:31 -0400
From: Shrikant Vijay Ranade <svr5@cac.psu.edu>
Subject: regular expression extensions
Message-Id: <Pine.SUN.3.93.971015174920.10771A-100000@farman>


hi,

i am trying to use the regular expression extensions to search for the
following in a string.
$in =~ s/&((?!vendor)|(?!Vendor)|(?!delivery))/and/g;

in short, i am trying to find all occurances of an "&" that is not followed
by either vendor/Vendor/delivery.

this does not work? can some one tell me what the error is?

i get the following error message.
/&((?!vendor)|(?!Vendor)|(?!delivery))/: ?+* follows nothing in regexp 


Thanks.


 ____________________________________________________________________
|                 |                                                  |
| * * * * * * * * |                                                  | 
| *             * |                                                  |
| * Penn  State * |                                                  |
| *             * |  Shrikant V. Ranade                              |
| *   1 8 5 5   * |  Center for Academic Computing                   |
| *             * |  The Pennsylvania State University               |
| *             * |  Phone no. (814)-863-1770                        |
|  *           *  |                                                  |
|    *       *    |                                                  |
|      *   *      |                                                  |
|        *        |                                                  |
|____________________________________________________________________|



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

Date: Wed, 15 Oct 1997 18:25:34 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: regular expression extensions
Message-Id: <comdog-ya02408000R1510971825340001@news.panix.com>

In article <Pine.SUN.3.93.971015174920.10771A-100000@farman>, Shrikant Vijay Ranade <svr5@cac.psu.edu> wrote:

>i am trying to use the regular expression extensions to search for the
>following in a string.
>$in =~ s/&((?!vendor)|(?!Vendor)|(?!delivery))/and/g;

it's easier to see what's going on if you group those patterns within
a negative lookahead:

   #!/usr/bin/perl -wT
   use strict;
   
   my $string = '&amp;&vendor&quot;&Vendor&delivery';
   
   $string =~ s/              #start of substitution
              &               #an ampersand
              (?!             #negative lookahead
                 (?: vendor|  #grouping without capture
                     Vendor|  #  not necessary, but i like it :)
                     delivery
                  ) 
               )          
             /and /xg;       #Global, eXtended
   
   print "$string\n";
   
   __END__

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 15 Oct 1997 22:36:32 GMT
From: "Mark" <mark@metro2000.net>
Subject: Save As... Name on MS Word downloads
Message-Id: <01bcd9cf$c2220b80$bde08ecf@mark.metro2000.net>

I'm trying to download a MS Word document via my html using an HREF to a
CGI/PERL script.  I'm passing in the name of the file as "file".  The Save
As.. dialog box gives a default name of the CGI file.  However it downloads
the contents of the doc file fine.  The CGI/PERL code is:

#!/usr/local/bin/perl

require 'cgi-lib.pl';
&ReadParse;

print("Content-type: application/msword\n\n");

open (TEMP, "../DOC/$in{file}");
while(<TEMP>) {
  print ($_);
}
close (TEMP);

Can anyone see what I need to do different to make the Save As filename the
same as the name of the file being downloaded?

Thanks,

Mark



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

Date: 15 Oct 1997 20:38:01 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: SCO Unix
Message-Id: <memo.19971015213759.21753A@skep.compulink.co.uk.cix.co.uk>

In article <622s14$pde@news1.iamerica.net>, sport@lamedicare.com (Herbert
Travis) wrote:

> I am running SCO Unix Open Server V.  I have been unable to find a PERL
> binary that will with this OS. (I don't have a C compiler)  Where can I
> get this.  Thanks
>
>

I can't remember where I found it - but I have some binary tars.

You can do an ftp://anorak.fourthnet.co.uk/pub/perl and there you'll find
some SCO specific binaries.

I take no responsibility for the archive - I will only say that applying
it has not affected my SCO server adversely.

Hope this helps.

Regards
Neil



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

Date: Wed, 15 Oct 1997 18:01:03 -0400
From: Jim Xikis <jxikis@mail.hsclib.sunysb.edu>
Subject: Some strange Perl things?
Message-Id: <34453D1F.82085745@mail.hsclib.sunysb.edu>

This is a multi-part message in MIME format.
--------------8B0A06210E5B1022190F18D0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I'm having a problem understanding why the following code does not work
the way one would expect.  I'm possitive there is a better way to do
this but I originally wrote it this way and some weird things happened.
The script is supposed to open a file, make some replacements to the
text, write to a temp file, then open the temp file and make some
replacements to that text etc.

Here's what happens:

If I use anything other than "F" or "G" for a file handle, nothing is
written to any of the temp files but "temp1".

Then, there are a bunch of lines in the code that I threw in that are as
follows:

if (eof G){
close <G>; }

If I leave out these lines of code, the program prints out two extra
lines of what seems to be garbage at the end of the file.
(The remove_last subroutine was a fix for that until I discovered this).

If you remove the "if (eof G)" line, and print some text to G just
before closing G, the "garbage"  prints *after* the text.

Some very strange things.
(the data file "bills" is attached)

#!/usr/bin/perl

&strip_header;
&strip_newlines;
&add_newlines;
&add_tabs;
#&remove_last;
#&cleanup;



sub strip_header {
 open(F, "bills");
 open(G, ">temp1");
 $ctr= 0;

 while (<F>) {
  @line = split (/ /);

  if ($ctr == 2) {
     $ctr += 1;
  }

  if (@line[0] eq ".colhead\n") {
     $ctr += 1;
  }

  if ((@line[0] eq ".end\n") && ($ctr == 1)) {
     $ctr += 1;
  }
  if ($ctr > 2) {
     print G
      $_;
  }
}
if (eof G){
close <G>; }
close <F>;
}

sub strip_newlines{
open(F, "temp1");
open(G, ">temp2");

 while (<F>) {
       $line = $_;
       $line =~ s/\n/ /g;
       $line =~ s/\t/ /g;
       print G
        $line;
 }
if (eof G){
close <G>; }
close <F>;
}

sub add_newlines {

open(F, "temp2");
open(G, ">temp3");

 while (<F>) {
       $line = $_;
       $line =~ s/(amount:\$\d*\.\d\d )/$1\n/g ;
       print G
        $line;
 }
if (eof G){
close <G>; }
close <F>;
}


sub add_tabs {
 open(F, "temp3");
 open(G, ">bills.txt");

 while (<F>) {
       $line = $_;
       $line =~ s/(\d\d\d\d\d\d\d\d\d\d\d\d\d\d).+payment date:/\t$1\t/;

       $line =~ s/type:/\t/;
       $line =~ s/amount:/\t/;
       $line =~ s/(ERROR)/\t\t$1/;
       $line =~ s/(FORGIVEN)/\t\t$1/;
       $line =~ s/(CANCEL)/\t\t$1/;
       print G
        $line;
 }
if (eof G){
close <G>; }
close <F>;
}

sub remove_last {
 open(F, "bills.txt");
 open(G, ">end");
 $ctr = 0;
 while (<F>) {
  $ctr += 1;
  if ($ctr == 1) { $line1 = $_ };
  if ($ctr == 2) { $line2 = $_ };
  if ($ctr > 2) {
   print G
     $line1;
   $line1 = $line2;
   $line2 = $_;
  }
 }
}

sub cleanup {
 unlink temp1;
 unlink temp2;
 unlink temp3;
}


--
James Xikis                                        (516)444-3100
Systems Administrator
SUNY Stony Brook - HSC Library


--------------8B0A06210E5B1022190F18D0
Content-Type: text/plain; charset=us-ascii; name="bills"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="bills"

Report Log for Bill List
Report 'billitemlist' scheduled as 'billitemlist'
A list of bills with associated items.
UNICORN bill selection v8.1 started on Friday, September 26, 1997, 6:30 AM
  Bill file will be read sequentially by primary key
  The user key will be written to standard output
  The item key number will be written to standard
  output
  The bill key will be written to standard output
  Bill will be selected if any date of payment is not earlier than 9/25/1997 and not later than 9/25/1997
  Bill will be selected if it has an associated item
  10048 bill record(s) considered
  16 bill record(s) selected.
UNICORN bill selection finished on Friday, September 26, 1997, 6:30 AM
UNICORN user selection v8.1 started on Friday, September 26, 1997, 6:30 AM
  The user key will be read from standard input
  String from standard input will be written to standard output
  The user name key will be written to standard output
  The user ID will be written to standard output
  16 user record(s) considered
  16 user record(s) selected.
UNICORN user selection finished on Friday, September 26, 1997, 6:30 AM
UNICORN item selection v8.1 started on Friday, September 26, 1997, 6:30 AM
  Item file will be read by primary key from standard input
  The callnum key will be written to standard output
  String from standard input will be written to standard output
  16 item record(s) considered
  16 item record(s) selected.
UNICORN item selection finished on Friday, September 26, 1997, 6:30 AM
UNICORN call number selection v8.1 started on Friday, September 26, 1997, 6:30 AM
  Call numbers will be read by primary key from standard input
  The catalog key will be written to standard output
  String from standard input will be written to standard output
  16 callnum record(s) considered
  16 callnum record(s) selected.
UNICORN call number selection finished on Friday, September 26, 1997, 6:30 AM
UNICORN catalog selection v8.1 started on Friday, September 26, 1997, 6:30 AM
  Catalog key will be read from standard input
  String from standard input will be written to standard output
  Catalog will be selected if it is NOT a review record
  16 catalog record(s) considered
  16 catalog record(s) selected.
UNICORN catalog selection finished on Friday, September 26, 1997, 6:30 AM
Sort: sorting by USER NAME
UNICORN bill printing v8.1 started on Friday, September 26, 1997, 6:30 AM
  Bill key will be read from standard input
  The report title option will be used
  Payments will be listed
  The bill report will be written to standard output
  16 bill(s) printed.
UNICORN bill printing finished on Friday, September 26, 1997, 6:30 AM
 .report
 .col 40l,2,14l,2,16r,2,16r,2,10l,2,13r
 .title
Bill List

Produced Friday, September 26, 1997 at 6:30 AM

 .end
 .colhead
NAME		USER ID		DATE BILLED		AMOUNT		REASON		BALANCE

 .end
ALIGAEN, RACHEL                                             		40066000947062		9/25/1997,12:08		$10.00		OVERDUE		$.00		
  WJ 342 D421P 1991 copy:1
  Prescribing hemodialysis : a guide to urea modeling / Thomas A. Depner.
  Depner, Thomas A.
  payment date:9/25/1997,12:08  type:ERRORamount:$10.00
COSTA, DONNA                                                		40066001010654		9/25/1997,13:25		$5.50		OVERDUE		$.00		
  BF 367 K84V 1983 copy:1
  Visualization : the uses of imagery in the health professions / Errol R.
  Korn, Karen Johnson.
  Korn, Errol R.
  payment date:9/25/1997,13:28  type:CHECKamount:$5.50
COSTA, DONNA                                                		40066001010654		9/25/1997,13:25		$5.50		OVERDUE		$.00		
  HV 43 M937C 1997 copy:1
  Case management by design : reflections on principles and practices / David
  P. Moxley.
  Moxley, David (David P.)
  payment date:9/25/1997,13:28  type:CHECKamount:$5.50
MECENAS, PETER                                              		41794001098879		9/25/1997,17:35		$2.75		OVERDUE		$.00		
  WL 359 H236 1992 copy:1
  Handbook of Parkinson's disease / edited by William C. Koller.
  Koller, William C., 1945-
  payment date:9/25/1997,17:36  type:CASHamount:$2.75
MECENAS, PETER                                              		41794001098879		9/25/1997,17:35		$2.75		OVERDUE		$.00		
  WL 359 C975 1993 copy:1
  Current concepts in Parkinson's disease research / edited by Jay S.
  Schneider, Madi Gupta.
  Schneider, Jay S., 1956-
  payment date:9/25/1997,17:36  type:CASHamount:$2.75
MECENAS, PETER                                              		41794001098879		9/25/1997,17:35		$2.75		OVERDUE		$.00		
  WL 300 M381N 1989 copy:4
  Neuroanatomy : text and atlas / John H. Martin.
  Martin, John H. (John Harry), 1951-
  payment date:9/25/1997,17:36  type:CASHamount:$2.75
MILAN, GERALD                                               		40066000993264		5/27/1997,15:49		$.25		OVERDUE		$.00		
  WB 100 M555M 1992 copy:1
  The Merck manual of diagnosis and therapy.
  Berkow, Robert, 1929-
  payment date:9/25/1997,13:48  type:CASHamount:$.25
MORLOCK, MARY                                               		40066000161862		8/18/1997,10:22		$2.25		OVERDUE		$.00		
  WV 100 B678F 1978 copy:1
  Boies's Fundamentals of otolaryngology : a textbook of ear, nose, and throat
  diseases / George L. Adams, Lawrence R. Boies, Jr., Michael M. Paparella
  Adams, George L. (George Linton), 1941-
  payment date:9/25/1997,15:48  type:CASHamount:$2.25
MORLOCK, MARY                                               		40066000161862		8/18/1997,10:22		$2.25		OVERDUE		$.00		
  WV 500 G811V 1980 copy:1
  The voice and its disorders / Margaret C. L. Greene.
  Greene, Margaret C. L.
  payment date:9/25/1997,15:48  type:CASHamount:$2.25
MORLOCK, MARY                                               		40066000161862		8/18/1997,10:22		$2.25		OVERDUE		$.00		
  WV 500 C725U 1990 copy:1
  Understanding voice problems : a physiological perspective for diagnosis and
  treatment / Raymond H. Colton, Janina K. Casper ; with contributions from
  Minoru Hirano.
  Colton, Raymond H.
  payment date:9/25/1997,15:48  type:CASHamount:$2.25
MORLOCK, MARY                                               		40066000161862		8/18/1997,10:22		$2.25		OVERDUE		$.00		
  WV 500 T892L 1993 copy:1
  The larynx / Harvey M. Tucker.
  Tucker, Harvey M.
  payment date:9/25/1997,15:48  type:CASHamount:$2.25
MORLOCK, MARY                                               		40066000161862		8/18/1997,10:22		$2.25		OVERDUE		$.00		
  WV 100 H432 1993 VOL. 1 copy:1
  Head and neck surgery-- otolaryngology : self-assessment/study guide /
  [edited by] Byron J. Bailey ... [et al.].
  Bailey, Byron J., 1934-
  payment date:9/25/1997,15:48  type:CASHamount:$2.25
VOGEL, WOLF                                                 		40066000974777		4/3/1997,17:36		$2.00		OVERDUE		$.00		
  WS 100 D284P 1984 copy:1
  Pediatric primary care / Catherine DeAngelis.
  DeAngelis, Catherine.
  payment date:9/25/1997,11:14  type:CASHamount:$2.00
VOGEL, WOLF                                                 		40066000974777		4/3/1997,17:37		$2.00		OVERDUE		$.00		
  WS 100 N432 1992 copy:1
  Nelson textbook of pediatrics / editor, Richard E. Behrman ; associate
  editor, Robert M. Kliegman ; senior editors, Waldo E. Nelson, Victor C.
  Vaughan, III.
  Nelson, Waldo E. (Waldo Emerson), 1898-
  payment date:9/25/1997,11:14  type:CASHamount:$2.00
VOGEL, WOLF                                                 		40066000974777		6/26/1997,16:32		$3.00		OVERDUE		$.00		
  WB 18 I574 1985 copy:1
  Internal medicine case studies : a compilation of 58 clinical studies / Joan
  Bachorik ... [et al.].
  Bachorik, Joan E.
  payment date:9/25/1997,11:14  type:CASHamount:$3.00
WHITFIELD, NATALIE                                          		41794000712074		9/25/1997,12:03		$10.00		OVERDUE		$.00		
  WE 250 S814 1980 copy:1
  Osteoporosis : recent advances in pathogenesis and treatment : proceedings
  of the Tenth Steenbock Symposium, held at the University of
  Wisconsin--Madison, June 9-12, 1980 / edited by Hector F. DeLuca ... [et
  al.].
  Steenbock Symposium on Ribosomes (10th : 1980 : University of
  Wisconsin--Madison)
  payment date:9/25/1997,12:05  type:ERRORamount:$10.00

--------------8B0A06210E5B1022190F18D0--



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

Date: Wed, 15 Oct 1997 20:55:33 GMT
From: over@the.net (dave)
Subject: Re: statics or const in perl ?
Message-Id: <3445259b.198553@news.one.net>

Doug Seay <seay@absyss.fr> wrote:


>I don't want to sound harsh, but I fail to see any problems.  Am I
>overlooking something, or are you looking for problems?   Please tell us
>what are your concerns.  The docs for this are _very_ technical, perhaps
>even a bit too implementation specific.  Not only do you read what
>constants do, but also how they do it.  Maybe it is this presentation
>that bothers you.

I think you're right.  A lot of detail is presented which is always a little
scary to me at first glance.

But I do have an underlying concern about the growth of Perl modules and my
work group's ability to keep up with them.  I guess I feel the need to only
adopt the modules that have a big impact.

My group is almost exclusively HPUX, ANSI C and ksh scripts.  I have recently
implemented a user interface/test setup language using Perl and the Tk module.
I started with 5.002 and upgraded to 5.004.  I got egg on my face when, in
front of a co-worker, the FileHandle module appeared (in perldoc) to be
superceded by the IO module, right after I told him how great I thought
FileHandle was.

I should have kept up a little better, but even if I had, it's a pretty scary
thought to a lot of people that things can change so drastically between
"minor" releases.  And if a lot of the change can be eliminated by not adopting
every new module, well ...


Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________


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

Date: Wed, 15 Oct 1997 18:18:00 -0400
From: <gbh@middlemarch.net>
Subject: Tab delimited fields
Message-Id: <Pine.GSO.3.96.971015180910.1617A-100000@clark.net>

How can I read a tab delimited database line by line,
and store the fields into backreferences? I'm trying
to do something like:

while (<tab.delimited.file>) {
     m/(field_1)(field_2).../;
 ...
}

What would be the correct syntax for the second line?

--Greg




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

Date: Wed, 15 Oct 1997 18:39:50 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Tab delimited fields
Message-Id: <comdog-ya02408000R1510971839500001@news.panix.com>

In article <Pine.GSO.3.96.971015180910.1617A-100000@clark.net>, <gbh@middlemarch.net> wrote:

>How can I read a tab delimited database line by line,
>and store the fields into backreferences? I'm trying
>to do something like:
>
>while (<tab.delimited.file>) {
>     m/(field_1)(field_2).../;
>...
>}

once you match them and capture the matching peices, the data are
already stored in the $n variables (where n is some small cardinal
number). are you sure that you want to save them into back references?

does splitting into an array do something that you don't like?  it
should be much faster than matching.

   while( <FILE> )
      {
      @array = split /\t/, $_;
      #stuff
      }


good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 15 Oct 1997 20:00:56 GMT
From: "Authorized User" <matthew.kravitz@systecinc.com>
Subject: WIN32::Process Module (NT)
Message-Id: <01bcd9a4$c31309c0$7cfce59b@matthewk.systecinc.com>

hello-
i was interested in creating a process within my perl script utilizing the
Perl module WIN32:Process.  For example:

use Win32::Process
Win32::Process:Create($PROCESS_NAME,
	"PATH_TO_PROCESS"
	"Command_Line"
	0,	
	Detached_Process,
	".")

the question:  How can i tell my perl script to wait for this process? 
Note:  a simple system() will no do.  i need to wait on this process
further down the script.  Does the function ' $ProcessObj->Wait (INFIINTE)
' apply here?  if so, how in the world do you use it?  

thanks for the help,
 matthew kravitz


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

Date: Wed, 15 Oct 1997 22:31:47 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Writing/Reading Bin Files (need example)
Message-Id: <EI46L0.KyK@world.std.com>

kivisild@rs1.tcs.tulane.edu (James A. Kivisild) writes:
>#define MAXLEN 10
>typedef struct
> {
>      long b; 
>      long m; 
> } xint;
> struct userinfo
> {
>      char name[MAXLEN];
>      xint a;
>      xint b;
>      xint c;
>      char reserved[28];
> };
> typedef struct userinfo userinfo;

One idea would be to write it in C in an XS module that you could
(dynamically, if allowed by your OS) link to your perl script. See
perlxstut and perlxs for details.

For a "pure" perl solution and keeping perl constructs that closely
match your C ones, maybe something like this:

$namelen = 10
$namepaddinglen  = 6; # adjust as necessary for compiler.
$xintlen = 8;
$reservedlen = 28;
$respaddinglen = 4; # adjust as necessary for compiler.

$structsize = $namelen  + $namepaddinglen + (3 * $xintlen) + 
	$reservedlen + $respaddinglen;

while(read $buffer, $structsize, 0) {
	undef %userinfo;
	($userinfo{name}, 
	$userinfo{a}{b}, $userinfo{a}{'m'}, 
	$userinfo{b}{b}, $userinfo{b}{'m'}, 
	$userinfo{c}{b}, $userinfo{c}{'m'}, 
	$userinfo{reserved}) = 
	unpack("A$namelenX$namepaddinglenLLLLLLA$reservedlen", $buffer);

	# do something with %userinfo
}

-- 
Andrew Langmead


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

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

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