[11041] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4641 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 13 12:03:00 1999

Date: Wed, 13 Jan 99 09:00:21 -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           Wed, 13 Jan 1999     Volume: 8 Number: 4641

Today's topics:
        __DATA__ om7@cyberdude.com
    Re: Archive::Tar question/issue (Johannes Poehlmann)
    Re: CONCLUSIVE PROOF:  John is dead though <ghand@mitretek.org>
    Re: Displaying and entering data for drop down boxs (Clay Irving)
    Re: Displaying and entering data for drop down boxs dave@mag-sol.com
    Re: How can I compare two arrays? <uri@home.sysarch.com>
    Re: How can I compare two arrays? <uri@home.sysarch.com>
    Re: How can I compare two arrays? <dgris@moiraine.dimensional.com>
    Re: Jpeg or Gif filesize (Clay Irving)
        login script with perl ! <ammann@ip-plus.net>
        looking for snmpcmd2.pm <pascal.masuit@netbuilding.simac.be>
    Re: looking for snmpcmd2.pm (Clay Irving)
        Make Perl 5.0052 error leading@technologist.com
    Re: Not printing if blank line found <newsposter@cthulhu.demon.nl>
        Oracle - OraPerl with shared libs bub@bII.bessy.de
    Re: Perl and LDAP (Dirk Vleugels)
    Re: Perl Controlling Server RS-232 Port (sjm)
    Re: Perl Criticism (I R A Aggie)
    Re: Perl Criticism dturley@pobox.com
    Re: Perl Criticism dturley@pobox.com
    Re: Perl Criticism droby@copyright.com
    Re: Perl Script wanted for possible profitable project (Tad McClellan)
        problems implimenting Net::Ping in Perl for Win32 <millard.matt@principal.com>
        read/write same file <dropzone@mail.utexas.edu>
    Re: Renaming a directory in NT. <mivl@inquo.net>
    Re: SUMMARY: Optimizing `eval' in a loop <dgris@moiraine.dimensional.com>
    Re: Threads Solaris memory leak ? signals handling? (Clinton Pierce)
    Re: Verify an email address mark_thomas@my-dejanews.com
    Re: Year 2038 problem (Johannes Poehlmann)
    Re: Yet another REGEX question (John Moreno)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 13 Jan 1999 15:11:43 GMT
From: om7@cyberdude.com
Subject: __DATA__
Message-Id: <77id37$por$1@nnrp1.dejanews.com>

Can someone please tell me where to find out more about __DATA__ and how and
when to use it.  I've tried looking in Programming Perl, but didn't find much
help there with regards to how and what to use it for and I don't have access
to the man pages.

Thanks.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 13 Jan 1999 00:00:00 +0000
From: j.poehlmann@link-n.cl.sub.de (Johannes Poehlmann)
Subject: Re: Archive::Tar question/issue
Message-Id: <78liQ0qZUkB@link-n-j.poehlmann.link-n.cl.sub.de>

sboss  wrote Re: Archive::Tar question/issue:

> PS
> Please email me directly since I do not get to read the newsgroups very
> often.

Why should someone do that ? When a experienced person is
answering this kind of questions, it wants one or more of
the following :
1. beeing known as a helpful person
2. beeing known as a expert.
3. Help more then one person
4. Contribute to the pile of tips and recipes in this newsgroup





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

Date: Wed, 13 Jan 1999 09:53:57 -0500
From: Gary Hand <ghand@mitretek.org>
Subject: Re: CONCLUSIVE PROOF:  John is dead though
Message-Id: <369CB384.25AAA34F@mitretek.org>

This has to do with astronomy?

Bry wrote:
> 
> Recently, eric <eendersnospam@ford.com> wrote:
> 
> >John Lennon said so,  so there!
> 
> But now he is dead! A pity really. He was a nice guy!


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

Date: 13 Jan 1999 15:06:19 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: Displaying and entering data for drop down boxs
Message-Id: <77icpb$lt2$1@news.panix.com>

In <kV0n2.5$c72.72@news.enterprise.net> "Simmo" <simsi_NO_SPAM@hotmail.com> writes:
>I dont claim to be an expert but i achieved it without problems as below -
>putting the info in a string and then using print to print the string at the
>end of the loop. I tend to use pipes ( | ) as my field delimiters - (could
>be there's a comma getting in the way ?). Dont know if this helps but there
>you go anyway - works for me  :)

>$catlinks = "<select name=whatever>";
>open (SUBLINKDB, "index_sublinks.txt");
>while (<SUBLINKDB>)
>{
>  $items = "$_";
>  @fields = split (/\|/, $items);
>  $category   = $fields[0];
>  $subcategory   = $fields[1];
>  $title     = $fields[2];
>  $unused    = $fields[3];
>  $linkname     = $fields[4];
>  $target_frame  = $fields[5];
>$allow_user_links = $fields[6];
>$allow_user_links =~ s/\n//g;

I'd condense these statements to:

    open SUBLINKDB, "index_sublinks.txt"
        or die "Can't open index_sublinks.txt: $!\n";
    while (<SUBLINKDB>) {
        chomp;
        ($category, $subcategory, $title, $unused, $linkname, $target_frame,
            $allow_user_links) = split /\|/;


I assume the other variables in the list are used -- Otherwise, I'd just
get the category and title:

    ($category, $title) = (split /\|/)[0,2];

>  $catlinks .= "<option
>value=\"$category-$title\">$category-$_title</option>\n";
                                       ^ What's this?

>   }
>   close (SUBLINKDB);
>$catlinks .= "</select>";

Since I'm lazy, I'd use CGI.pm and write something like:

   #!/usr/local/bin/perl -w
   # WARNING: Untested! I don't have the data files.
   
   use CGI qw(:standard :html3);
   
   open SUBLINKDB, "index_sublinks.txt"
       or die "Can't open index_sublinks.txt: $!\n";
   while (<SUBLINKDB>) {
       chomp;
       ($category, $subcategory, $title, $unused, $linkname, $target_frame,
           $allow_user_links) = split /\|/;
       $categories{$category} = $title;
   }
   
   print header;
       print start_html(-title=>'Example Page',
                        -author=>'clay@panix.com'),
       start_form,
       scrolling_list(-name=>'category', -size=>1, -value=>\%categories,
                      -labels=>\%categories, -default=>['whatever']),
       end_form,
   end_html;
    
-- 
Clay Irving
clay@panix.com


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

Date: Wed, 13 Jan 1999 15:54:58 GMT
From: dave@mag-sol.com
Subject: Re: Displaying and entering data for drop down boxs
Message-Id: <77ifkc$sb9$1@nnrp1.dejanews.com>

In article <kV0n2.5$c72.72@news.enterprise.net>,
  "Simmo" <simsi_NO_SPAM@hotmail.com> wrote:
>
> Alan Copeland <hotdogboy@Icdc.com> wrote in message
> 77beop$92d$1@remarQ.com...
>
> I have a file with the names of book genres, sepereatae by commas
> >(e.g. comedy,young adult,fiction)  Then I wanted a function to read these
> >and put them in a drop down box for selection.
>
> Ian Sims replied:
>
> I dont claim to be an expert but i achieved it without problems as below -
> putting the info in a string and then using print to print the string at the
> end of the loop. I tend to use pipes ( | ) as my field delimiters - (could
> be there's a comma getting in the way ?). Dont know if this helps but there
> you go anyway - works for me  :)
>
> $catlinks = "<select name=whatever>";
> open (SUBLINKDB, "index_sublinks.txt");
> while (<SUBLINKDB>)
> {
>   $items = "$_";
>   @fields = split (/\|/, $items);
>   $category   = $fields[0];
>   $subcategory   = $fields[1];
>   $title     = $fields[2];
>   $unused    = $fields[3];
>   $linkname     = $fields[4];
>   $target_frame  = $fields[5];
> $allow_user_links = $fields[6];
> $allow_user_links =~ s/\n//g;
>
>   $catlinks .= "<option
> value=\"$category-$title\">$category-$_title</option>\n";
>
>    }
>    close (SUBLINKDB);
> $catlinks .= "</select>";

 ...or maybe it's a little more maintainable like this:

#!/usr/local/bin/perl -w

use strict;
use CGI qw/:all/;

my @options;
while (<DATA>)
  {
    chomp;
    my ($category, $subcategory, $title, $unused,
        $linkname, $target_frame, $allow_user_links)
          = split /\|/;

    push @options, "${category}-${title}";
  }

my $catlink = popup_menu(-name=>'whatever',
                         '-values'=>[@options]);

print $catlink;

__END__
Fiction|SF|Foundation||link|target|Y
Fiction|SF|Foundation & Empire||link|target|Y
Fiction|SF|Second Foundation||link|target|N


--
Dave Cross
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 13 Jan 1999 10:49:00 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: How can I compare two arrays?
Message-Id: <x7n23ngolv.fsf@home.sysarch.com>

>>>>> "DG" == Daniel Grisinger <dgris@moiraine.dimensional.com> writes:

  DG> Uri Guttman <uri@home.sysarch.com> writes:

  >> when will such bleeding edge improvements migrate to
  >> production versions? 

  DG> The 5.005_[5-9]x versions will eventually become 5.006.

which is supposed to come out when? i haven't heard much about that version.

  >> and when will 5.005_xx be considered stable (even
  >> without threads) by the masses. 

  DG> _02 isn't bad (for some value of bad, I've had very few problems), _03
  DG> should be better.

that phrase doesn't fill me with confidence.

  DG> If you're only using it to try out the new stuff, why aren't you 
  DG> using a version on the devel track?  You'd probably be happier 
  DG> with _54 for home use, especially considering your stated goal 
  DG> of trying out new features.

combination of lazy and not needing to see every little new thing. 5.005
had enough new stuff to play with, mostly regexes and foreach modifier,
etc.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: 13 Jan 1999 10:55:33 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: How can I compare two arrays?
Message-Id: <x7lnj7goay.fsf@home.sysarch.com>

>>>>> "J" == JPAH-FLA  <mymail@nospam.com> writes:

here are some perlish answers. most can be done with stuff you don't
seem to know about.

  J> (sum of all elements in A): +/A

$sum = 0 ; $sum += $_ foreach @A

  J> (has A a non-zero value?): v/A

grep( $_ != 0, @A )

  J> (generate an array of values 1 thru N): iN

( 1 .. $N )

  J> (is A all non-0?) ^/A

grep( $_ == 0, @A )

  J> (is array A the same as, elementally, B?): ^/A=B


  J> (length of A): pA

@A	in a scalar context
$#A	last index of @A

  J> (randomly reorder A): A[?ipA]

push( @rand_A, splice( @A, int( rand( @A ), 1 ) ) ) while @A

  J> (make A into an N by M matrix) N M pA
  J> (invert Matrix A) (domino)A
  J> (largest value in A): (ceiling)/A

$max = $A[0] ; $_ > $max && $max = $_ foreach @A ;

  J> (smallest) (floor)/A

$min = $A[0] ; $_ < $min && $min = $_ foreach @A ;

  J> (concatenate array B to A): A,B

push( @A, @B ) ;

  J> (laminate B below A) A,[1.5]B

splice( @A, 0, 0, @B ) 
splice( @A, 0, 0, @B[0 .. 4] ) 

you don't say if you want all of b or part of it

  J> (make a new array of the first n-elements of A) N(take)A

@A[ 0 .. N - 1]

  J> (make a new Array by removing the last N elemets of A): N(drop)A
@A[ $#A - N + 1 .. $#A]

  J> (Make a new array of element N and M): A[M N]

@a[ M, N ]

  J> (cross product of A with B): A +.*B
  J> and so on....

  J> Now I know SOME of these are supported in Perl without writing a loop-
  J> reverse and concatenate come to mind. But (a) I can't optimize a loop as
  J> well as the guy who writes the compiler, and (b) I don't want to write
  J> loops for these types of problems over and over again. Make them part of
  J> the language. Its much easier to work outside of loops for the developer,
  J> and one of Larry's design critera was to create a tool to solve problems
  J> quickly. Its MUCH faster to write the constructs above than to loop.


remember, perl is not matrix oriented like apl (not much is oriented
like apl). other than matrix stuff like inversion, multiplication and
reshaping perl can do most with builtin stuff. a few need tight foreach
modifier loops. and some of the matrix stuff i bet is done in CPAN
modules where it belongs since you need the speed of C there.

learn more perl before you think it can't do something. it isn't called
the swiss army chainsaw of languages for nothing.

you obviously have never seen splice, array slices in particular. wait
til you get ahold of hash slices, something apl doesn't have. i don't
even think it has hashes either.

hth,

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: 13 Jan 1999 09:26:21 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: How can I compare two arrays?
Message-Id: <m3ww2rw34i.fsf@moiraine.dimensional.com>

Uri Guttman <uri@home.sysarch.com> writes:

> >>>>> "DG" == Daniel Grisinger <dgris@moiraine.dimensional.com> writes:

>   DG> The 5.005_[5-9]x versions will eventually become 5.006.
> 
> which is supposed to come out when? i haven't heard much about that version.

There isn't an official or strict timetable, but I'd be surprised to
see it this year.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: 13 Jan 1999 15:11:14 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: Jpeg or Gif filesize
Message-Id: <77id2i$luh$1@news.panix.com>

In <MPG.11072728a667932989691@news.singnet.com.sg> leading@technologist.com writes:

>How can I know the file size of a gif or jpeg like (lengthxwidth)?

Hmm? Image? Size? Hmmm...

Let's check CPAN:

    cpan> i /image/
    Distribution    M/MA/MAHEX/Image-Grab-0.9.1.tar.gz
    Distribution    MIKEH/CGI_Imagemap-1.00.tar.gz
    Distribution    RJRAY/Image-Size-2.9.tar.gz
    Module          CGI::Imagemap   (MIKEH/CGI_Imagemap-1.00.tar.gz)
    Module          FAQ::OMatic::ImageData (JHOWELL/FAQ-OMatic-2.608.tar.gz)
    Module          FAQ::OMatic::ImageRef (JHOWELL/FAQ-OMatic-2.608.tar.gz)
    Module          FAQ::OMatic::checkedImage (JHOWELL/FAQ-OMatic-2.603.tar.gz)
    Module          FAQ::OMatic::pickerImage (JHOWELL/FAQ-OMatic-2.603.tar.gz)
    Module          FAQ::OMatic::spaceImage (JHOWELL/FAQ-OMatic-2.603.tar.gz)
    Module          FAQ::OMatic::uncheckedImage (JHOWELL/FAQ-OMatic-2.603.tar.gz)
    Module          Image::Colorimetry (Contact Author Jon Orwant <orwant@media.mit.edu>)
    Module          Image::Grab     (M/MA/MAHEX/Image-Grab-0.9.1.tar.gz)
    Module          Image::Grab::RequestAgent (M/MA/MAHEX/Image-Grab-0.9.1.tar.gz)
    Module          Image::Magick   (JCRISTY/PerlMagick-1.58.tar.gz)
    Module          Image::Size     (RJRAY/Image-Size-2.9.tar.gz)
    Module          PDL::Graphics::TriD::Image (LUKKA/PDL-1.99989.tar.gz)
    Module          QImage          (AWIN/PerlQt-1.06.tar.gz)
    Module          Tk::Image       (NI-S/Tk800.012.tar.gz)
    Module          Tk::ImageBack   (NI-S/Tk800.012.tar.gz)
    
I bet the `Image::Size' module would do the trick:

    Image::Size

    Image::Size is a library based on the image-sizing code in the 
    wwwimagesize script, a tool that analyzes HTML files and adds HEIGHT
    and WIDTH tags to IMG directives. Image::Size has generalized that code 
    to return a raw (X, Y) pair, and included wrappers to pre-format that 
    output into either HTML or a set of attribute pairs suitable for the 
    CGI.pm library by Lincoln Stein. Currently, Image::Size can size images 
    in XPM, XBM, GIF, JPEG, TIFF, PNG and the PPM family of formats 
    (PPM/PGM/PBM). 

-- 
Clay Irving
clay@panix.com


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

Date: Wed, 13 Jan 1999 17:15:02 +0100
From: Patrick <ammann@ip-plus.net>
Subject: login script with perl !
Message-Id: <369CC686.E9DB743F@ip-plus.net>

Hi,

I'm really new and I don't know much about perl programming.
My problem is that i have to write a script witch should do the
following. I have a few routers and i have do do some commands to all of
them. I also have a list witch is formated likethe following one:

IP-Adress    Hostname
IP Adress    Hostname

The point is that i have to login to ech router and make a "show
version" and "show mem". Then i need to analyse the output.

If you already have a script that does the described thing please e-mail
it to ammann@ip-plus.net. If you can give me some information on how to
make a telnet connection with perl please let me know also.

Many thanks in advance.

Patrick



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

Date: Wed, 13 Jan 1999 15:26:58 +0100
From: "Pascal Masuit" <pascal.masuit@netbuilding.simac.be>
Subject: looking for snmpcmd2.pm
Message-Id: <77ib46$p2a$1@news3.Belgium.EU.net>

Can someone tell me where I could find the snmpcmd2.pm module (written by
Blaine Bauer). ?
I've found some usefull scripts that are based on this module, but
unfortunately, I can't find it on the web.
Thanks in advance.

Pascal Masuit




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

Date: 13 Jan 1999 15:19:44 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: looking for snmpcmd2.pm
Message-Id: <77idig$m0j$1@news.panix.com>

In <77ib46$p2a$1@news3.Belgium.EU.net> "Pascal Masuit" <pascal.masuit@netbuilding.simac.be> writes:

>Can someone tell me where I could find the snmpcmd2.pm module (written by
>Blaine Bauer). ?
>I've found some usefull scripts that are based on this module, but
>unfortunately, I can't find it on the web.

His homepage <http://members.xoom.com/bbauer/> indicates:
 
    I regret that I am unable to post my scripts here, due to 
    potential intellectual property issues.

-- 
Clay Irving
clay@panix.com


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

Date: Wed, 13 Jan 1999 22:45:39 +0800
From: leading@technologist.com
Subject: Make Perl 5.0052 error
Message-Id: <MPG.1107326aba8b09a7989692@news.singnet.com.sg>

I tried to make Perl 5.0052 in a pentium machines, I got the following 
error, can someone advise me how to retify it?



Configure:  FATAL ERROR:
This version of perl5 can only be compiled by a compiler that
understands function prototypes.  Unfortunately, your C compiler
        cc -Dbool=char -DHAS_BOOL -A cpu,mathchip -I/usr/include -
I/sys5/usr/inc
lude -I/usr/local/include
doesn't seem to understand them.  Sorry about that. 


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

Date: Wed, 13 Jan 1999 11:02:07 -0500
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Not printing if blank line found
Message-Id: <369CC37F.70782028@cthulhu.demon.nl>

A Melton wrote:

> Program example below:
> 
>   open IN, $filename or die "Cannot read $filename: $!";
>   @a = <IN>; # read all lines of this file
>   chomp ($val=@a[10]);
                ^  you meant to use a $ instead of the @, right?
>   $val =~ s/-//g;
>   $final="978".$val;
>   print unless ($a[10]) eq "";
>   print OUTPUT ("$final \n");
>   chomp ($val=@a[17]);
                ^ same here
>   $val =~ s/-//g;
>   $final1="978".$val;
>   print unless ($a[17]) eq "";
>   print OUTPUT ("$final1 \n");
> 
> The print unless does not stop the printing
> of the blank line probably because it is followed by print OUTPUT

As someone else mentioned, arrays start at 0, so line x is in $a[x-1]

Erik
-- 
Sure, doesn't everyone sign up for internet service so as to have
their mailbox stuffed with megabytes of postage-due rubbish every day?
Absolutely.  And everyone who owns a car intends that it be used as a
portable dumpster.  Any unwanted garbage in their vehicle they can
simply throw away, after all.


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

Date: Wed, 13 Jan 1999 17:36:21 +0100
From: bub@bII.bessy.de
Subject: Oracle - OraPerl with shared libs
Message-Id: <369CCB84.EF7C998@bII.bessy.de>

HI

I am trying to create Oraperl with shared libraries under HP-UX.
With static libs it worked. But with shared libs we are missing some
code which was
compiled without the +z or +Z compiler switch. Does anyone have
some experiences with that. Actually we are missing code for symbols
osntns
osnptt
osnttt

The sources for these symbols are in libOracle.a (static lib)
and there in
osntni.o
osnptt.o
osntco.o
The funny thing about it is that there are about 1770 object-files
within the
archieve-file and about 1000 object-files are compiled with the +Z flag.

I think I could solve my problem if would have these object-files for
shared
libs.
Maybe some could already talk Oracle into recompiling it for him or
has another conclusion

Thanks for any help

      Sebastian
please mailto:bub@bii.bessy.de   too





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

Date: 13 Jan 1999 15:05:27 GMT
From: dv@de.uu.net (Dirk Vleugels)
Subject: Re: Perl and LDAP
Message-Id: <77icnn$o5s$1@goof.de.uu.net>

On Tue, 12 Jan 1999 15:31:03 -0500, Indy <indy@NOSPAMdemobuilder.com> wrote:
> The PerlDap module you are refering to is the one by Clayton Donley.  It is
> a wrapper to an LDAP API.  The LDAP API itself in implemented in a windows
> DLL from Netscape.
> 
> Implementing an LDAP involves encoding and decoding ASN data structures and
> low level bit manipulation.  Writing such a thing in Perl is not practical.
> It would be equivalent to writing the Perl interpreter in Perl - not
> impossible, but impractical.  For this reason I don't think you will find a
> pure Perl implementation of LDAP out there.

Graham Barr wrote Net::LDAP. Does _not_ need a SDK installed afaik. Works
against the openldap-1.1.X server.

Dirk

> 
> Indy
> www.perl2exe.com
> 
> Brian Sullivan wrote in message ...
> >I have been confused by all the LDAP modules for Perl that seem to be
> >around.


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

Date: 13 Jan 1999 07:20:27 -0800
From: sjm@halcyon.com (sjm)
Subject: Re: Perl Controlling Server RS-232 Port
Message-Id: <77idjr$nuf$1@halcyon.com>

In article <369C07BF.8DC@habit.com>,
Austin Schutz  <spamsux-tex@habit.com> wrote:
>Steve Shawl wrote:
>> 
>> Hello
>> Is there a perl command or set of commands that will allow a script to
>> output a single character to the rs-232 port of the server that the
>> script is running on?
>> Thank you (in advance)
>> Steve Shawl
>
>
>`echo -en "$ARGV[0]" > $ARGV[1]`
>


use POSIX;
$termios = POSIX::Termios->new;

-- 
-- Steve McCarthy                          Author RightOn 2.4 for Windows
  sjm@halcyon.com                             The Power Mouse Utility
                                   http://www.halcyon.com/sjm/righton.html
Current wind and temp at my house: http://www.halcyon.com/sjm/wx/latest.html


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

Date: Wed, 13 Jan 1999 09:42:59 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl Criticism
Message-Id: <fl_aggie-1301990942590001@aggie.coaps.fsu.edu>

In article <itrg77.fo1.ln@magna.metronet.com>, tadmc@metronet.com (Tad
McClellan) wrote:

+ I R A Aggie (fl_aggie@thepentagon.com) wrote:
+ : In article <369B85F6.B68B0E1@mail.uca.edu>, Cameron Dorey
+ : <camerond@mail.uca.edu> wrote:
+ 
+ : + I thought that cartooning was done by computers now. I wonder which
+ : + brand does the drawing for Mr. Adams? 
+ 
+ : I think its the Adams Mk I, Rev 0.
+ 
+ 
+    Bzzzzt.
+ 
+    His name is Scott, not Mark,   heh, heh...

Don't make me come over there...

James


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

Date: Wed, 13 Jan 1999 15:20:56 GMT
From: dturley@pobox.com
Subject: Re: Perl Criticism
Message-Id: <77idkd$q9q$1@nnrp1.dejanews.com>

In numerous articles topmind@technologist.com wrote a bunch of stuff he has
not been able to defend:

This is going nowhere. I hereby pledge to never read or repsond to any post
from this person again. Why don't we all make the same promise and let him
just fade away. If this person had anything to contribute to Perl he would do
so by providing code, not name calling. Every reply just keeps him coming
back, ignore him, killfile him, he will go away.

This thread is dead for me.


____________________________________
David Turley
dturley@pobox.com
http://www.binary.net/dturley/

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 13 Jan 1999 15:17:07 GMT
From: dturley@pobox.com
Subject: Re: Perl Criticism
Message-Id: <77idd8$q5b$1@nnrp1.dejanews.com>

In article <77hgv4$21t$1@nnrp1.dejanews.com>,
  topmind@technologist.com wrote:

> Putting "should" aside, at least you now admit that Perl
> can be hazardous and F up a company real bad. That
> is a start.

You have dug yourself in hole so deep you are desparate for a way out. Perl
cannot F anything up, programmers do. It is a tool. By your ~logic, we should
ban all programming languages since ANY programming language could be used to
do something bad.

I could could F my employer up by uploading child porn to their web site and
using the company email to threaten the President, so now e need to get rid of
HTMl and SMTP as well.

I find it amusing that your criticisms have bee reveiwed and thoroghly
debunked, yet you continue to argue the point. You are entitle to your
opinions but you seem to be only able to defend them anonymously and by
insults and calling names.  So mature. ____________________________________
David Turley dturley@pobox.com http://www.binary.net/dturley/

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 13 Jan 1999 16:02:12 GMT
From: droby@copyright.com
Subject: Re: Perl Criticism
Message-Id: <77ig1s$sks$1@nnrp1.dejanews.com>

In article <77hjkh$490$1@nnrp1.dejanews.com>,
  topmind@technologist.com wrote:
>
> Think like a manager. They do not want to risk being stuck with
> cryptic code that takes the follow-on guy or guydette 1 hour
> per line to reverse engineer.
>

There are ways of preventing this outside the programming language design.
There really is no way of preventing bad code in the programming language
design.

> Suppose you owned a business where a programmer spent 4 years
> building all the software. The programmer suddendly quits
> and you hire a new Perl expert. The Perl expert inspects the
> code and realize that the system is composed of 30,000 lines
> of code that looks something like this:
>

I would have been taking a look at the code and design early in that 4 years,
and he/she would have corrected this behavior or been gone.

>   perl -le '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
>   $t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
>   $x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x"'
>   '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
>   $t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
>   $x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x"'
>   '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
>   $t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
>   $x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x"'
>   '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
>   $t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
>   $x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x"'
>

You're improving.  Ignoring the repeat, which I assume you put in just to
make it even uglier, it is working code and provides the answer to Life, the
Universe and Everything.  Similarly obfuscated code accomplishing similar
results could of course be done in the language of your choice.  All
languages allow meaningless variable names and obscure computations, which
are the primary flaws in this code.

> Can you spell B.A.N.K.R.U.P.T.C.Y  ?
>
> Of course this is an extreme example, but it happens on this and
> smaller scales all the time.
>

Perhaps, but this reflects bad management as much as bad code.	A business
owner who allows a programmer to write 30,000 lines of code like that over a
span of 4 years deserves bankruptcy.

> As for languages that are less abusable, consider Pascal, Java, or
> Visual Basic. One programmer confided in me, "I hate
> programming in Visual Basic, but when I see
> other's VB code, I can usually figure out
> what is going on."
>

I bet you could write a VB program to print 42 that your friend would have
trouble with.

--
Don Roby

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 13 Jan 1999 07:35:55 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Perl Script wanted for possible profitable project
Message-Id: <rf7i77.k23.ln@magna.metronet.com>

Gary Baker (gbkr@worldnet.att.net) wrote:

: Although I have read books on perl and have a Linux setup I am not a
: perl programmer. I have written simple scripts but nothing as complex
: as this and I believe that this is fairly simple. I need a script to
: search the Internet by arguments, using  only two terms actually. The
: searches would need to be performed on a listing of search engines and
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^
: the results would need to be written to a file. The file would then
: need to be sorted in alphabetical order with duplicates discarded.


   The WWW::Search module can query some search engine sites.

      http://www.isi.edu/lsam/tools/WWW_SEARCH or on CPAN


: Any help would be greatly appreciated and if you are interested in
: getting paid for the script email me with your price.


   Immediately disqualify anyone who provides a price with only
   the information you have provided. They don't know what
   they are doing, or they are trying to scam you.



   Querying 200 search engines is likely to cost more that
   querying 3 search engines.

   Querying some search engines will be harder than querying
   other search engines.


   We know neither the members, nor the size, of your list...


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


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

Date: Wed, 13 Jan 1999 15:37:22 GMT
From: Matt Millard <millard.matt@principal.com>
Subject: problems implimenting Net::Ping in Perl for Win32
Message-Id: <77iejh$ral$1@nnrp1.dejanews.com>

I'm trying to write a ping script using the Net::ping library on an NT
machine.  I keep running into problems with the alarm($timeout) saying it's
not implimented.  I'm trying to check to see if a host is up using
pingecho($system, $timeout).  Any ideas how I can work around this?

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 13 Jan 1999 09:39:33 -0600
From: Forrest Reynolds <dropzone@mail.utexas.edu>
Subject: read/write same file
Message-Id: <369CBE34.D1ABFC75@mail.utexas.edu>

Hello,
     I want to read a log and update it with a switch if it contains a certain
$filename. I can do this fine if I write to a different file than I'm reading,
but if I try to write
back to the old one, it wipes it out.
   Here's some code that works:
#!/usr/bin/perl
$report_path = "/usr/home/nrrfr/bin";
$file_name = "SAT6882.336";
 open (OLDLOG,"$report_path/oldmail.log") || die "cannot open etslog";
open (NEWLOG,">$report_path/newmail.log") || die "cannot open newlog";
        while (<OLDLOG>) {
            $_ =~ s/($file_name)/$1 Y/;
           print NEWLOG $_;

          }
close OLDLOG;
close NEWLOG;
exit 0;
 ...... I want to write to OLDLOG. I RTFM(CAMEL), all I came up with was
appending to a file.
       I thought I might read each $_ into an array and change the array, then
write it all back, but that seems 
unnecessarily convoluted.
       New to PERL, Thanks for your help, Forrest


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

Date: Wed, 13 Jan 1999 08:25:19 -0700
From: Kris Davey <mivl@inquo.net>
To: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Renaming a directory in NT.
Message-Id: <369CBADF.30F8AEAB@inquo.net>

I didn't mention it but I tried the rename function and it didn't work and all
the documentation siad this was for renaming files and not directories. I
appreciate your pointing out the "brainfart" of the single \ I'll try that.
Thanks.

Eric Bohlman wrote:

> Kris Davey <mivl@inquo.net> wrote:
>
> : I have a quick question that has been kicking my ass for a while now. It
> : should be very simple and I'm probably overlooking something. Here's the
> : problem I have created a script that FTP's trace files off our solaris
> : server to make them available to everyone on a Windows platform. The
> : script creates a \tmp directory FTp's all the files into the directory,
> : pulls the current date and formats it. The problem is that I cannot seem
> : to rename the file to the date, stored in $_. Here is what I've tried
> : `ren e:\tmp $_`
> : `ren e:\tmp "$_"`
> : system ("ren e:\tmp $_")  *** This actually worked on Win98 at home.
>
> Well, a big part of your problem is that you probably don't have a file
> whose name consists of a tab character followed by "mp" in the root of
> your e: drive.  Remember that backticks impose a doublequotish context,
> so you need to double up backslashes if you want to represent them literally.
>
> You should also be using Perl's rename() function rather than starting a
> separate process to do something as simple as renaming.



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

Date: 13 Jan 1999 09:28:34 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: SUMMARY: Optimizing `eval' in a loop
Message-Id: <m3sodfw30t.fsf@moiraine.dimensional.com>

Hrvoje Niksic <hniksic@srce.hr> writes:

> BTW, where is the correct place to announce my extra-super-mega-useful 
> utility to the world, once it's finished (ha!)?  Should I fire away to 
> comp.lang.perl.announce, or should I first try here for some review?

I'd announce it here to get the first round of feedback and bug
reports, then upload it to CPAN once the first set of bugs had
been fixed.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Wed, 13 Jan 1999 16:31:38 GMT
From: cpierce1@mail.ford.com (Clinton Pierce)
Subject: Re: Threads Solaris memory leak ? signals handling?
Message-Id: <36a5c92e.3195439402@news.ford.com>

[Courtesy CC sent to poster in E-Mail]

On Sun, 10 Jan 1999 09:32:08 GMT, ruxfounder@my-dejanews.com wrote:
>Hi !
>
>I've kicked by sysadmin that my script uses too many
>system resources, yeah, server is hard working and
>sometimes shows 'table is full' message.
>I mean that server has a lot of virtual memory, but
>runs too many processes...(kernel bounds apply)
>
>My script was actually a simple http proxy server with fork().
>I've switched to cool new feature Threads in perl 5.005_02.
>After all, it just works!!!
>and uses only one PID, so sysadm now happy, I think.
>But I've 2 problems
>
>1. After about 1000-2000 connections my server with threads hangs.
>I use ps -ael command and see VERY huge memory allocation for perl
>process. I have to restart my script-server once a day. I've written
>a small "test" suite:

I believe...and someone shoot me if I'm wrong...that Apache gets around
library memory leaks, etc.. by re-forking and exec'ing its children
every now and then.

So every now and then, clean up your messes, and just re-exec()
yourself.  I think you'll have problems for socket connections waiting
on the que to connect to your port, and you might have other problems
(REUSEADDR is your friend), but this will work around your memory leak
if you can't find it otherwise.




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

Date: Wed, 13 Jan 1999 15:04:03 GMT
From: mark_thomas@my-dejanews.com
Subject: Re: Verify an email address
Message-Id: <77icks$p8l$1@nnrp1.dejanews.com>


> Otherwise, you're rejecting the perfectly valid (and active!) email
> address <fred&barney@stonehenge.com> (go ahead, try it!).

Heh, Outlook Express messes up on the above address, but that's what I would
expect.

Someone a while back in the cgi group a single-line Perl regexp that
supposedly is RFC-822bis compliant.

$_ =~ /^(([0-9a-zA-Z!#\x24%&\x27\*\+\-\/\?=^_\x60\x7B\x7D\|~]+(\.[0-9a-
zA-Z!#$%&\x27\*\+\-\/\?=^_\x60\x7B\x7D\|~]+)*)|(\"([\x01-\x08\x0B-\x0C\
x0E-\x20\x21\x23-\x5B\x5D-\x7F]|\\[\x01-\x09\x0B-\x0C\x0E--\x7F])*\"))@
([0-9a-zA-Z!#$%&\x27\*\+\-\/\?=^_\x60\x7B\x7D\|~]+(\.[0-9a-zA-Z!#$%&\x2
7\*\+\-\/\?=^_\x60\x7B\x7D\|~]+)*|\[([\x01-\x08\x0A\x0B\x0E-\x20\x21-\x
5A\x5E-\x7F]|\\[\x01-\x09\x0A-\x0B\x0D-\x7F])*\])$/

Anyone care to verify it ? :-)

I didn't know about the Email::Valid module because it wasn't in the CPAN, but
I may give it a try.

--
Mark Thomas, who just recently entered the third
printf"%x",34*join('',unpack('C*',"*^'"));
of his life!

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 13 Jan 1999 00:00:00 +0000
From: j.poehlmann@link-n.cl.sub.de (Johannes Poehlmann)
Subject: Re: Year 2038 problem
Message-Id: <78liP-z3UkB@link-n-j.poehlmann.link-n.cl.sub.de>

bvitro (Billy Vitro)  schrieb zu Re: Year 2038 problem:
> Well, that makes me feel soooo much better.  I just tried the code below
> on my "Y2K Compliant" Solaris 2.6 (Ultra 60).  Here's what I got:

1 >> perl5 -e 'print (scalar localtime 2**31, "\n")'
> Mon Jan 18 19:14:08 2038
2 >> perl5 -e 'print (scalar localtime 2**32, "\n")'
> Wed Dec 31 15:59:59 1969
4 >> perl5 -e 'print (scalar localtime 2**55, "\n")'
> Wed Dec 31 15:59:59 1969
5 >> perl5 -v

> This is perl, version 5.004_04 built for sparc-sun-solaris2.6
>
> Yummy.
>
> Guess that means I can't figure out what my options will be worth in
> 2039...

I found, that perl 5.004 on Linux (Kernel 2.0.29 ) interpretes negative
values as "seconds before Jan 1. 1970 1am." So if the negative numbers
become too big, they end as year 1901.

So there are too possibilities how to interpret a given 32 bit
time value > 2^31.
- It can been interpreted as invalid ( Posix compliant ? )
- It can been interpreted as signed   (seconds before Jan 1. 1970 1am.)
- It can been interpreted as unsigned (ignoring the 2038 barrier)

When naively expanding 32 bit values to 64 bits (without knowning wich
of the above possibilities applies, this can cause trouble. (When expanding
0x80 00 00 01 to signed 64 bit, we get 0x 8f ff ff ff 00 00 00 01.
When going unsigned, we fill up with zeroes.

The problem are old stored time values, e.g in a database. ( There are
contracts signed today signed after 2038...)




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

Date: Wed, 13 Jan 1999 10:47:40 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Yet another REGEX question
Message-Id: <1dlkfi1.1f5uyu41cz9mo0N@roxboro0-009.dyn.interpath.net>

Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:

> John Moreno <phenix@interpath.com> wrote:
> 
> > The [+-] was indeed in case there was a sign present, * means zero or
> > more, since the ? means to use a non-greedy match, and that's irrelevant
> > at that point, I didn't use it (and the more strict test would have been
> > [+-]{0,1} to make sure that there wasn't more than one).
> 
> {0,1}...
> 
> ?, anyone?

D'OH.  I'm so stupid.

I thought he meant why wasn't it [+-]*?  -- HEY, I just checked he DID
ask why it wasn't [+-]*?.

-- 
John Moreno


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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