[7859] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1484 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 16 15:17:26 1997

Date: Tue, 16 Dec 97 12:00:27 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 16 Dec 1997     Volume: 8 Number: 1484

Today's topics:
     Re: Advice on References to Class Functions ? <tchrist@mox.perl.com>
     Re: Advice on References to Class Functions ? (Andrew M. Langmead)
     Re: CGI/PERL & Netshow Video Server <rootbeer@teleport.com>
     Re: CR/LF Text-File (John Moreno)
     Re: Detect Java, JavaScript Enabled via Perl (Thaths)
     Re: foreach && references (Honza Pazdziora)
     Re: foreach && references <reibert@mystech.com>
     Framework for building custom HTTP servers? <dsill@sws5.ctd.ornl.gov>
     Re: help decode a pattern (John Moreno)
     Re: help decode a pattern <rootbeer@teleport.com>
     Re: help decode a pattern <dboorstein@ixl.com>
     Re: Hex, Oct, and Bin convertor? (Steffen Beyer)
     localtime() _is_ year-2000 compliant, right? (Michael Budash)
     Re: localtime() _is_ year-2000 compliant, right? (I R A Aggie)
     Re: localtime() _is_ year-2000 compliant, right? <rootbeer@teleport.com>
     Re: Looking for Perl Spreadsheet <Russell_Schulz@locutus.ofB.ORG>
     Re: Looking to work with Perl for Master's Thesis <rootbeer@teleport.com>
     Re: NEED:  Fast, Fast string trim() <ajohnson@gpu.srv.ualberta.ca>
     Re: Newbie, very newbie (Tad McClellan)
     Re: Perl editor needed <webmaster@everyweek.com>
     Re: Perl Question (Faust Gertz)
     Re: post your dynamic IP address to a web page-cant be  <rootbeer@teleport.com>
     Return value after OPEN() <joneil@cks.ssd.k12.wa.us>
     Re: Return value after OPEN() <tchrist@mox.perl.com>
     Re: Teaching programing <dboorstein@ixl.com>
     Wacky idea: a PERL server <dsill@sws5.ctd.ornl.gov>
     Re: Why does my suid program have /dev/fd/3 in $0 <rootbeer@teleport.com>
     Win32 Perl with MS Access (Ray Ho)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 16 Dec 1997 18:02:05 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Advice on References to Class Functions ?
Message-Id: <676fmt$i3j$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, mbennett@ideaeng.com writes:
:Andrew M. Langmead wrote:
:> How about if you pass a string containing the name of the method you
:> want to call (lets say we store it in a variable called $method), and
:> say:
:> 
:>   $node->$method();
:
:An interesting idea.
:
:I had started down that path yesterday, but I had syntax
:problems because my function needed to take arguments.

It seems to me that the function passed in should not be a method.
Passing a method means a string.  Oh, you can get the address using
UNIVERSAL::can() and use that as a method as of 5.004, but it's no longer
relative to the object.  Now you can use that code ref later.

    $cref = $self->can("some_method");
    $obj->$cref();

But what if $obj shouldn't be called with that method?  At least
the symbolic way works for this:

    $methname = 'some_method';
    $obj->$methname();

It can be easily argued that a "method reference" must also 
capture the exact object you're currently talking about.

    $mref = sub { $self->some_method(@_) };
    &$mref(args go here);

But in the case of passing a bit of code to run to data structure
walking routine, I think a closure that expects a closure is best.

    $obj->walk(sub {print shift->value(), "\n"});

    sub Tree::walk {
	my($self, $cref) = @_;
	return unless $self;
	$self->left->walk($cref);
	$cref->($self);
	$self->right->walk($cref);
    } 

It occurs to me that these seem equivalent:

    $cref->($self);
    $self->$cref();

You might also do care to this:

    $obj->walk(sub {print "@_\n"});

    sub Tree::walk {
	my($self, $cref) = @_;
	return unless $self;
	$self->left->walk($cref);
	$cref->($self->value());
	$self->right->walk($cref);
    } 

I play around with various versions of this in my

    CS-Talk/sources/dstruct/trees/bintree

program, found at http://www.perl.com/perl/misc/CS-Talk.tar.gz

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    str->str_pok |= SP_FBM;                     /* deep magic */
    s = (unsigned char*)(str->str_ptr);         /* deeper magic */
        --Larry Wall in util.c from the perl source code


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

Date: Tue, 16 Dec 1997 18:51:57 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Advice on References to Class Functions ?
Message-Id: <ELApqL.483@world.std.com>

"Mark L. Bennett" <mbennett@ideaeng.com> writes:

>Andrew M. Langmead wrote:
>> 
>> How about if you pass a string containing the name of the method you
>> want to call (lets say we store it in a variable called $method), and
>> say:
>> 
>>   $node->$method();
>> 
>I had started down that path yesterday, but I had syntax
>problems because my function needed to take arguments.

If the arguments vary depending on the method called, another idea
would be to pass an anonymous code reference that gets passed the
object and whatever else Traverse() needs to pass it, the code ref
would muck with its argument list as it likes and call the method.

my $where = 'screen';
Traverse($node, sub {
                     my $object = shift; 
                     my @args = @_; 
                     $object->PrintShort($where, @args[4,3,1]);
                }
);
-- 
Andrew Langmead


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

Date: Tue, 16 Dec 1997 11:00:11 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: darkcyde <bazaillion@primary.net>
Subject: Re: CGI/PERL & Netshow Video Server
Message-Id: <Pine.GSO.3.96.971216105654.23116F-100000@user2.teleport.com>

On Mon, 15 Dec 1997, darkcyde wrote:

> The only sever software that I have seen that supports PPV access is the
> Real Video Server 5.0 however its extremely exspensive ($16,000+ for 50
> streams) Is their any way through CGI this could be done with Microsofts
> Netshow Video Server?

There may be. If you can't find the answer to this question in the
relevant docs and FAQs, you may ask it in a newsgroup about CGI
programming or about servers. This newsgroup is about Perl, and there's
nothing in your question that is specific to Perl. By asking in a more
appropriate newsgroup, you're more likely to get better and more complete
answers than you can get here. 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: Tue, 16 Dec 1997 14:08:19 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: CR/LF Text-File
Message-Id: <1d1cv13.146r47x1x9mduaN@roxboro-174.interpath.net>

Tad McClellan <tadmc@metronet.com> wrote:

> Remove xx (xxTony.Curtis@vcpc.univie.ac.at) wrote:
> : Re: CR/LF Text-File, Tobias
> : <udta@rzstud1.rz.uni-karlsruhe.de> said:
> 
> : Tobias> But the perl/skript runs on a LinuX-System.  How can
> : Tobias> i read strings from a text-file with cr/lf at the
> : Tobias> end of each line on a LinuX-Plattform ???
> 
> : Do this to the input line
> 
> :     s/\r$//;
> 
> : That will remove the CR (\r) if there's one at the end.
> 
> 
> Or, better yet, when transfering the files, use FTP in ASCII mode and
> it will convert the line endings for you.

Why not

$/="\r\n";  #or whatever the hex values of \r\n is


-- 
John Moreno


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

Date: 16 Dec 1997 02:45:18 GMT
From: thaths@nospam.com (Thaths)
Subject: Re: Detect Java, JavaScript Enabled via Perl
Message-Id: <674pvu$i1e2@continuity.mcom.com>

In article <8c7m99479n.fsf@gadget.cscaper.com>,
	Randal Schwartz <merlyn@stonehenge.com> writes:
>>>>>> "ywang" == ywang  <ywang@maingate.net> writes:
> ywang> Could anyone tell me how to detect the user's brower is
> ywang> JavaScript/Java enabled via using Perl CGI program?
> Well, you can do tricks like tell Javascript to go to a new page, and
> if it doesn't go, Javascript isn't enabled. :-) But I hate those pages
> because my "back" button doesn't work right any more.

It would work if it were done the right way.

location.replace("http://language.perl.com/"); 

would redirect you and give you a working 'Back' button.

Enough of this non perl related posting to c.l.p.m

Thaths
-- 
                 "He who laughs last gets dirty stares."
                   http://people.netscape.com/thaths/
                    %remove_this%thaths@netscape.com


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

Date: Tue, 16 Dec 1997 17:40:14 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: foreach && references
Message-Id: <adelton.882294014@aisa.fi.muni.cz>

Justin Banks <justinb@cray.com> writes:


> Hello - 
> 	I can't see why the following two snippets execute differently.
> I'm sure that it's something simple, but I can't see it.
> 
> $a = "one: two:three:four:five";
> ($junk, @b) = (split ':', $a);
> $c{test} = \@b;
> foreach $d (@$c{test}) {
>   print "$d\n";
> }
> 
> Prints nothing.

use strict is your friend:

use strict;
my $a = "one: two:three:four:five";
my ($junk, @b) = (split ':', $a);
my %c;
$c{test} = \@b;
my $d;
foreach $d (@$c{test}) {
  print "$d\n";
  }
__END__
Global symbol "c" requires explicit package name at - line 7.
Execution of - aborted due to compilation errors.

So the problem obviously is, that the c is not the c. What you
probably wanted to write was

	foreach $d (@{$c{test}}) {

which is the element of a hash dereferenced as array.

Hope this helps,

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Tue, 16 Dec 1997 11:27:42 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: foreach && references
Message-Id: <3496C81E.CCEFF356@mystech.com>

Justin Banks wrote:

> Hello -
>         I can't see why the following two snippets execute differently.
> I'm sure that it's something simple, but I can't see it.
>
> $a = "one: two:three:four:five";
> ($junk, @b) = (split ':', $a);
> $c{test} = \@b;
> foreach $d (@$c{test}) {
>   print "$d\n";
> }

$c{test} = \@b creates a hash (%c) with one key (test) whose value is a
reference to array @b. To turn this into an array in the foreach, you need an
extra set of braces as in

foreach $d ( @{ $c{test} } )

The @{ arrayRef } construct creates an array from a reference!

HTH,
Mark Reibert
-----------------------------
   Mark S. Reibert, Ph.D.

  Mystech Associates, Inc.
  3233 East Brookwood Court
   Phoenix, Arizona 85044

    Tel: (602) 732-3752
    Fax: (602) 706-5120
 E-mail: reibert@mystech.com
-----------------------------




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

Date: 16 Dec 1997 14:43:40 -0500
From: Dave Sill <dsill@sws5.ctd.ornl.gov>
Subject: Framework for building custom HTTP servers?
Message-Id: <wx07m95vztf.fsf@sws5.ctd.ornl.gov>

Is there a module or recipe for creating small special-purpose HTTP
servers in perl?

Say I've got a program, e.g., "ls", and I want to create a web-based
interface for it--an HTTP daemon that listens to some odd port, does
whatever user authentication I want (tcpcontrol or tcpwrappers can
handle the host access control), and presents an HTML form with
buttons for the various options to ls and a text entry field for the
list of files or directories. The user fills out the form, hits
"send", the server validates the form data, runs the appropriate ls
command, and formats the output as HTML.

I know I could do something similar with Tk, but the beauty of HTTP is 
that every schmoe in the world has a terminal that can access it.

-- 
Dave Sill <dsill@sws5.ctd.ornl.gov>        <URL:http://web.infoave.net/~dsill>
Lockheed Martin Energy Research   Oak Ridge National Lab   Workstation Support
Take the qmail Challenge. See <URL:http://web.infoave.net/~dsill/qmail.html>


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

Date: Tue, 16 Dec 1997 14:08:31 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: help decode a pattern
Message-Id: <1d1cxb1.kvjw0h1db9ci2N@roxboro-174.interpath.net>

terminator <milab@nortel.ca> wrote:

> could someone interpret the expression below for me.
> 
> $alines=~ /^\[([^\]]*)\]/
>                ^^^^^^
> 
> i can make some sense of it, but i need to know what it does
> specifically. i think it will match a word starting with '[' and
> ending with ']', and save it in $1. but i don't know how the
> implementation [^\]]* is interpreted. could someone post the
> interpretation.

Yes that's it (or mainly it at any rate).

$alines='[test this]';
$alines=~    # use alines as the search pattern
    /^       # start at the start of the line
    \[       # look for a [
    ([^\]]*) # match everything that is not a ], goes into $1
    \]       # look for ]
    /x;      # x makes it ignore white space so I can comment

print $1."\n";

produces:
test this

-- 
John Moreno


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

Date: Tue, 16 Dec 1997 11:38:52 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: terminator <milab@nortel.ca>
Subject: Re: help decode a pattern
Message-Id: <Pine.GSO.3.96.971216113456.23116J-100000@user2.teleport.com>

On Tue, 16 Dec 1997, terminator wrote:

> could someone interpret the expression below for me.
> 
> $alines=~ /^\[([^\]]*)\]/

	/^			# start of string
	\[			# left square bracket
	(			# Start of memory 1
	    [^\]]		# anything but right square bracket
	    *			# zero or more times
	)
	\]			# right square bracket
	/x

So it would match something like '[foo] bar' or '[foo][bar]', putting
'foo' into $1, but it wouldn't match 'bar [foo]' or '[foo'.

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: Tue, 16 Dec 1997 14:30:04 -0500
From: Dan Boorstein <dboorstein@ixl.com>
To: terminator <milab@nortel.ca>
Subject: Re: help decode a pattern
Message-Id: <3496D6BC.1FE8B165@ixl.com>

$alines=~ /^        # the beginning of the string
           \[       # a beginning-square-bracket
            (       # begin grouping
             [^\]]* # 0 or more not ending-square-brackets
            )       # end grouping
           \]       # an ending-square-brackets
          /x;

essentially it requires that the string have a bracket at the start, and
an ending bracket somewhere to the right. $1 will get the value of 
whatever is between the open bracket and the first closing bracket.

the part in the middle that you had a question about is a negated 
character class. the un-escaped brackets with the caret ([^]) mean that
any characters inside here are not valid. so this sub-pattern won't
match right side square brackets.

dan boorstein
dboorstein@ixl.com


terminator wrote:
> 
> could someone interpret the expression below for me.
> 
> $alines=~ /^\[([^\]]*)\]/
>                ^^^^^^
> 
> i can make some sense of it, but i need to know what it does
> specifically. i think it will match a word starting with '[' and
> ending with ']', and save it in $1. but i don't know how the
> implementation [^\]]* is interpreted. could someone post the
> interpretation.
> 
> Thanks,
> Parampreet


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

Date: 16 Dec 1997 14:01:03 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: Hex, Oct, and Bin convertor?
Message-Id: <6761iv$4p$1@en1.engelschall.com>

Mark S. Reibert <reibert@mystech.com> wrote:
> Heng-Chih Lin wrote:

>> I am wondering if there is any routine in perl which can convert number back
>> and forth among Dec, Hex, Oct, and Bin formats.
>>
>> For example, if I have a number 3476 (in decimal) or 10100 (in binary), how can
>> I convert it to other formats?
>>
>> Any suggestion is highly appreciated!

> Standard Perl has the hex() and oct() functions to convert hexadecimal and octal
> numbers (actually, strings) to decimal. Use sprintf() to go the other direction.
> For example:

> $dec = hex( "ff" );
> $hexString = sprintf( "%lx", $dec );

> Similar examples can be constructed for decimal-octal conversions. See page 179,
> 190, and 222 in "Programming Perl" for more details.

> I don't know if Perl has any functions for binary numbers - check CPAN for a
> module. Otherwise, it is not too difficult to write yourself!

The new version of the "Bit::Vector" module (5.0b1) does perform
bin/hex/dec-conversions for arbitrary length strings/bit vectors.

It is available from my web site at http://www.engelschall.com/u/sb/download/
or any CPAN ftp server (http://www.perl.com/CPAN/authors/id/STBEY/).

I consider it to be "beta" because the documentation is still rudimentary,
but the code itself is stable already.

Hope this helps.

Yours,
-- 
    Steffen Beyer  <sb@sdm.de>  http://www.engelschall.com/u/sb/
     Feel free to visit my download area with free software at
              http://www.engelschall.com/u/sb/download/
    >> Unsolicited commercial email goes directly to /dev/null <<


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

Date: Tue, 16 Dec 1997 10:14:01 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: localtime() _is_ year-2000 compliant, right?
Message-Id: <mbudash-1612971014020001@d39.pm.sonic.net>

Hello all -

The camel book says the $year portion of the list returned by localtime()
"has had 1900 subtracted from it". Do i dare make the assumption that in
the year 2000, that value will be 100 and not 0? I guess the more direct
question is: is $year limited to some set number of decimal places? I
think not, but a fellow programmer disagrees.

Anybody feel like trying it on their local development machine (by
falsifying their system date)? Or does anyone know for sure?

TIA,
Michael

-- 
                   _____________________________

                       Michael Budash, Owner
                     Michael Budash Consulting
                           707-255-5371
                        707-258-7800 x7736
                   http://www.sonic.net/~mbudash
                         mbudash@sonic.net
                   _____________________________


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

Date: Tue, 16 Dec 1997 14:07:11 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: localtime() _is_ year-2000 compliant, right?
Message-Id: <-1612971407110001@aggie.coaps.fsu.edu>

In article <mbudash-1612971014020001@d39.pm.sonic.net>, mbudash@sonic.net
(Michael Budash) wrote:

+ The camel book says the $year portion of the list returned by localtime()
+ "has had 1900 subtracted from it". Do i dare make the assumption that in
+ the year 2000, that value will be 100 and not 0? I guess the more direct
+ question is: is $year limited to some set number of decimal places? I
+ think not, but a fellow programmer disagrees.

You would be right, your fellow would be wrong. Ridicule him for not
Reading The Fine Manual:

man localtime


ctime(3C)                                                            ctime(3C)



NAME
     ctime, localtime, gmtime, asctime, tzset, ctime_r, localtime_r, gmtime_r,
     asctime_r - convert date and time to string

[snip]

     Declarations of all the functions and externals, and the tm structure,
     are in the time.h header file.  The structure declaration is:

          struct    tm {
[snip]
               int  tm_year;  /* years since 1900 */
[snip]
          };

How big can int's get? Just remember this: $year=$year+1900;

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: Tue, 16 Dec 1997 11:42:01 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael Budash <mbudash@sonic.net>
Subject: Re: localtime() _is_ year-2000 compliant, right?
Message-Id: <Pine.GSO.3.96.971216114018.23116K-100000@user2.teleport.com>

On Tue, 16 Dec 1997, Michael Budash wrote:

> The camel book says the $year portion of the list returned by localtime()
> "has had 1900 subtracted from it". Do i dare make the assumption that in
> the year 2000, that value will be 100 and not 0? 

No, you don't dare. But if you evaluate localtime(time+1e8) you might find
out what you need to know. (Or, of course, you could look in the FAQ. :-)

-- 
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: Tue, 16 Dec 1997 12:08:21 +0000
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: Looking for Perl Spreadsheet
Message-Id: <19971216.120821.2p8.rnr.w164w@locutus.ofB.ORG>

James Frogel <tory1@IDT.NET> writes:

> Does anybody know of a Perl spreadsheet.

as in, a spreadsheet input/output/manipulation package in perl?

> I am trying to take some thousands of prices and perform multiple
> transformations on each of the prices. Of course I could just Map
> this but I need the spreadsheet display to move around thru the
> values...

why not just use some spreadsheet then?
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: Tue, 16 Dec 1997 11:19:32 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "Bradley M. Kuhn" <bmk@agnostic.ebb.org>
Subject: Re: Looking to work with Perl for Master's Thesis
Message-Id: <Pine.GSO.3.96.971216111543.23116H-100000@user2.teleport.com>

On 15 Dec 1997, Bradley M. Kuhn wrote:

> Consequently, I hope to find a Master's Thesis topic that will result in
> the implementation of something useful for the free software community. 
> I enjoy Perl, so I was thinking I might be able to do something with
> Perl. 

There's a wish list that The Perl Institute is maintaining. Some of these
projects are already being worked upon.

    http://www.perl.org/wishlist.html

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: Tue, 16 Dec 1997 11:46:20 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: NEED:  Fast, Fast string trim()
Message-Id: <3496BE6C.567B1254@gpu.srv.ualberta.ca>

Tony Bowden wrote:
> 
> Aaron Harsh (ajh@rtk.com) wrote:
> :     $string =~ s/^\s*(|.*\S)?\s*$/$1/;
> : This looks even more cryptic than the original one-liner, so Mark should be
> : happy :-)
> 
> Excellent ...
> 
> Now, what's the fastest way of removing all unwanted whitespace, which
> means triming all leading and trailing spaces, _and_ trimming multiple
> whitespace down to single spaces? Can this be done easily in one pass?

here's a quickie one pass version (quickie in terms of thinking it up, not
running time) ---should be easy to improve upon:

$_='   blah   blah blah   blah   ';
s/(^\s+|\s+$)|(\s+)/$1?'':' '/eg;
print;

regards
andrew


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

Date: Tue, 16 Dec 1997 12:45:33 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Newbie, very newbie
Message-Id: <d8i676.d72.ln@localhost>

Creede Lambard ($_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print) wrote:

: Sergio Rodrigues Giraldo wrote in message
: <674i99$q85$1@puma.unisys.com.br>...

: >I just downloaded Perl-Win32 from Activeware and I don't know how to test a
: >simple Perl script !


[snip very good advice, particularly that part about the -w switch ]


: My advice? Read the FAQs, play around with Perl, kick the tires, take it for
: a spin to see what it can do. And have fun.


I'll add one more piece of advice.

Get it working in a "command line" (or however you run independant
perl scripts on Bill's stuff) environment first.

After you have proven the core of your script, then move to
"CGI-ifying" it.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 16 Dec 1997 11:40:58 -0700
From: "J. Masterson" <webmaster@everyweek.com>
Subject: Re: Perl editor needed
Message-Id: <3496CB3A.5F267F43@everyweek.com>

Kent Scheidegger wrote:
> 
> Bill Guindon <billg@networkapparel.com> wrote:
> 
> : Larry Hanlon wrote:
> : >
> : > Hello, just found first lesson in PERL. I need to find a editor
> that doesn't
> : > add a CR to the end of each line. What I am doing is the
> programming in a
> : > WIN95/DOS environment and when the scripts are run on a UNIX
> platform the
> : > CR's create errors. Please reply to e-mail as the news server is
> sometimes
> : > buggy.

I use WS_FTP to upload my scripts-- setting it to 'ascii' works great,
no further manipulations needed, aside from a chmod to make it
executable.

-- 
John Masterson
Assistant Webmaster, Pollmaster                Webmaster
Internet Connect Services                      Missoula Independent
http://www.montana.com/ics/                    http://www.everyweek.com


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

Date: Tue, 16 Dec 1997 19:51:09 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Perl Question
Message-Id: <3496d5cd.19538682@news.wwa.com>

> If you haven't figured it out or gotten an answer email me

I haven't.  Please help.


Streben nach Wahrheit

Faust Gertz
Philosopher at Large

"Our music is pure art. Like I'm moving, I'm creating the truth. I'm
not trying to entertain people, I'm playing the truth for those who
can listen.  I realize that not everybody is capable of listening to
real beauty. Real beauty is beyond most people, it's only for a select
few. I'm hoping in the future that more people will listen. They'll
have to attune themselves to the truth."  -- Albert Ayler


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

Date: Tue, 16 Dec 1997 11:02:53 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Brian Wheeler <bdwheele@indiana.edu>
Subject: Re: post your dynamic IP address to a web page-cant be done, right?
Message-Id: <Pine.GSO.3.96.971216110147.23116G-100000@user2.teleport.com>

On 15 Dec 1997, Brian Wheeler wrote:

> open(OUT,">/tmp/$$");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
Thanks.

-- 
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: Tue, 16 Dec 1997 11:20:50 -0800
From: Jerome O'Neil <joneil@cks.ssd.k12.wa.us>
Subject: Return value after OPEN()
Message-Id: <3496D492.283988F8@cks.ssd.k12.wa.us>

I have noticed recently that the "regulars" have been promoting the
value of checking the return value of open() after opening a file.  Very
well and good.

Is it good form to check the value after opening a pipe to another
process?

Jerome "Put *WHAT* in my Pipe and Smoke It?" O'Neil



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

Date: 16 Dec 1997 19:29:20 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Return value after OPEN()
Message-Id: <676kqg$lsf$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Jerome O'Neil <joneil@cks.ssd.k12.wa.us> writes:
:Is it good form to check the value after opening a pipe to another
:process?

% man perlfaq8

   Why doesn't open() return an error when a pipe open fails?

   It does, but probably not how you expect it to.  On
   systems that follow the standard fork()/exec() paradigm
   (eg, Unix), it works like this: open() causes a fork().
   In the parent, open() returns with the process ID of the
   child.  The child exec()s the command to be piped to/from.
   The parent can't know whether the exec() was successful or
   not - all it can return is whether the fork() succeeded or
   not.  To find out if the command succeeded, you have to
   catch SIGCHLD and wait() to get the exit status.  You
   should also catch SIGPIPE if you're writing to the child
   -- you may not have found out the exec() failed by the
   time you write.  This is documented in the perlipc
   manpage.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    "You can't have filenames longer than 14 chars.  
     You can't even think about them!"
        --Larry Wall in Configure from the perl distribution


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

Date: Tue, 16 Dec 1997 14:15:15 -0500
From: Dan Boorstein <dboorstein@ixl.com>
Subject: Re: Teaching programing
Message-Id: <3496D343.F0594252@ixl.com>

Russ Allbery wrote:
> 
> I'll agree with most of that, but the presence of a garbage collector
> tends to make programmers lazy about memory issues (since they don't have
> to think about them).  As long as you intend to stick with programming
> languages with GC, that's fine, but it makes for drastic culture shock
> when you start trying to use C.
> 

I learned to program with Perl about 3 years ago. Before that I had only
done some TI-Basic on my old 99-4A (about 17 years ago), so essentially
I learned to program with Perl. In some ways I think it has helped me
be even more careful. Structure has never been my cup-of-tea and I
prefer
to learn than to be taught. I think this goes along with the idea
(I am paraphrasing Larry Wall I believe) that I would prefer that people
not come into my living room because they were not invited, not because
I have an armed shotgun in my lap.  When I pickup other languages now I
am careful about scoping and other issues because I learned with a
language that would let me hang myself in an instant if I was not always
vigilant. Granted, some may not be suited to this style of learning, but
I've always been the kind of person to RTFM (usually after jumping in
head-first, and finding myself upside-down in a big mess of crap), and I
learn best from my repeated failures, not through a single example of
someone elses success.

I realize this would be a difficult task, but I would be interested to
see a basic programming class that allowed the students to pick their
language of choice based on a summary of each. How well would the
students do at picking languages that suit their interests, abilities
and attitudes?

Dan Boorstein
dboorstein@ixl.com


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

Date: 16 Dec 1997 14:32:32 -0500
From: Dave Sill <dsill@sws5.ctd.ornl.gov>
Subject: Wacky idea: a PERL server
Message-Id: <wx090tlw0bz.fsf@sws5.ctd.ornl.gov>

Perl is nifty, but it's just too expensive to start up a new perl
process to handle a quick job like munging/matching mail/news headers
on a busy SMTP/NNTP server. Has anyone ever thought about the
possibility of running perl in a client/server mode, where
/usr/bin/perl is just a client that passes the script to a long-lived
server daemon and waits for the results? One obvious complication is
handling different users. The server could run as root, I suppose, but
that's kind of scary. Perhaps a metaserver running as root could
manage a set of N perl servers, each running under a different
UID. The hard part would probably be creating the long-lived perl
process that'd be able to reset itself after each job.

Any thoughts? Is this feasible, or am I missing something?

-- 
Dave Sill <dsill@sws5.ctd.ornl.gov>        <URL:http://web.infoave.net/~dsill>
Lockheed Martin Energy Research   Oak Ridge National Lab   Workstation Support
Take the qmail Challenge. See <URL:http://web.infoave.net/~dsill/qmail.html>


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

Date: Tue, 16 Dec 1997 11:33:18 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Russ Allbery <rra@stanford.edu>
Subject: Re: Why does my suid program have /dev/fd/3 in $0
Message-Id: <Pine.GSO.3.96.971216113217.23116I-100000@user2.teleport.com>

On 16 Dec 1997, Russ Allbery wrote:

> In comp.lang.perl.misc, lee gammell <lee.gammell@feedME> writes:
> 
> > I have a suid/sgid script called dbkill.pl, however when i try and print
> > out $0 in a USAGE clause it prints as "/dev/fd/3" not "dbkill.pl".  I
> > know this is because it is a suid; is there some other way to get the
> > real script name?
> 
> No, not that I'm aware of.  The reason why Perl does this for setuid
> scripts on platforms that support them securely 

To be sure, _Perl_ doesn't do this on these systems; the system itself
does it. :-)

-- 
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, 17 Dec 1997 03:37:04 GMT
From: raymond.ho@virgin.net__delete_this_bit__ (Ray Ho)
Subject: Win32 Perl with MS Access
Message-Id: <676l5l$qn0$1@nclient5-gui.server.virgin.net>


Does anyone know how to access a MS Access database using Win32
version of Perl?  What modules, sample codes will be much appreciated.



Ray Ho

to reply remove "__delete_this_bit__" from my address



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

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

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