[8370] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1987 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 27 20:14:41 1998

Date: Fri, 27 Feb 98 17: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           Fri, 27 Feb 1998     Volume: 8 Number: 1987

Today's topics:
    Re: [QUES} Perl Win95 <rschafe@nbnet.nb.ca>
        ANNOUNCE: Call for testing new module: Tk::Tie::MenuHas <zenin@best.com>
        ANNOUNCE: Math::ematica 1.106 - Perl talks to Mathemati <pfeifer@wait.de>
        ANNOUNCE: Number::Format released hermit@bayview.com
    Re: Array into Hash index? (Greg Bacon)
    Re: Array into Hash index? <jefpin@bergen.org>
    Re: Failure to run Benchmark.pm on Win32 (Jonathan Feinberg)
    Re: Function evaluation within strings? <jim.michael@gecm.com>
    Re: How do you put a string into a array? (Andrew M. Langmead)
    Re: How do you put a string into a array? <Dave.Cross@gb.swissbank.com>
        how to copy a file from a website <npaci@bigfoot.com>
        image displaying according to time on server <atriosNOSPAM@earthlink.net>
    Re: indirect object syntax tobez@plab.ku.dk
        Iss, exec & perl <pds-root@portesdusoleil.com>
    Re: Killfile Triage (John Moreno)
    Re: Killfile Triage <spt@cstr.ed.ac.uk>
    Re: Killfile Triage (Sven Guckes)
    Re: Killfile Triage <*@qz.little-neck.ny.us>
    Re: Newbie Q: How does TIE work?? (Jonathan Feinberg)
    Re: Perl and the Windows clipboard <ebohlman@netcom.com>
        Statistics::Descriptive v2.2 (Colin Kuskie)
    Re: Viewing local vars in debugger (Greg Bacon)
    Re: What does this one-liner do? <eike.grote@theo.phy.uni-bayreuth.de>
    Re: What does this one-liner do? <vallon@pearl.fi.bear.com>
    Re: What does this one-liner do? (Greg Bacon)
    Re: Win95 - Running scripts from browser? <atijapan@gol.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 27 Feb 1998 10:44:33 -0500
From: rschafe <rschafe@nbnet.nb.ca>
Subject: Re: [QUES} Perl Win95
Message-Id: <34F6DF61.467@nbnet.nb.ca>

Erik Kristiansen wrote:
> 
> What type of Web server are you using? I use MS PWS 1.0. You have to
> associate the perl.exe to .cgi and .pl in the windows registry with this
> package. I took about two weeks of headaches to get my setup completely
> right.
> 

SCwrote
> >I am currently using a copy of PERL5 from the SAMS "Learn Perl
> >for Windows NT" book.
> >

Hi Chris,

Thanks for responding.

Actually I'm not using a server alone. According to the documentation I
should not have to be. The problem seems to be within Netscape executing
the cgi and not being able to find perl.

I have tried running the cgi script below on both Win95 standalone and
WinNT 4.0 Workstations. The result is always the same. When run from a
DOS shell using "perl file_rd.cgi" it works fine. When run from Netscape
by way of the Form and Submit it finds the cgi file (I know because I
renamed it to find out for sure) but simply will not execute it.

It is a very simple script to test the environment.
I will check your suggestion on the NT side though.


NETSCAPE:
--------->
<FORM METHOD="POST" ACTION="file_rg.cgi">
<INPUT TYPE="SUBMIT" NAME="SUBMIT"  Value="STUFF">
</FORM>

<---------

SCRIPT: - "file_rg.cgi"
----------->
#c:/perl

$thefile = "testfile";
open(TFILE,">$thefile") || die "This don't work";
$OUTF = TFILE;

print $OUTF "Yet Another line.......";
close(TFILE);

<---


Thanks again

SC


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

Date: 27 Feb 1998 16:07:15 GMT
From: Zenin <zenin@best.com>
Subject: ANNOUNCE: Call for testing new module: Tk::Tie::MenuHash
Message-Id: <6d6obj$kb0$1@news1.teleport.com>

I've created a new module to ease the use of Tk menubuttons.  It's more of
an abstraction layer over Tk::Menubutton.  The module's perldoc is listed
below.  Please try it out and post any comments you have about it, the name,
the interface, the code, bugs, flames, love letters, etc.  The module's
tar ball can be found at:

	ftp://thrush.omix.com/pub/perl/modules/Tk-Tie-MenuHash-1.9.tar.gz

Standard module install, no C code.  Make test will try to bring up a window
with a menubutton in it.  It's only been tested on FreeBSD, so any feedback
on how it works with other systems would be great.

It also only handles single level menus right now (at least, internally)
because perl only supports single layer tied hashes.  You can still access
them via standard Tk::Menubutton methods however, as they all get mapped to
the real menubutton.

Thanks!

-- 
-Zenin
 zenin@best.com

NAME
    Tk::Tie::MenuHash - Ties a Tk::Menubutton widget to a hash object thingy

SYNOPSIS
      use Tk::Tie::MenuHash;

      my $MB = new Tk::Tie::MenuHash ($Menubutton);
      my $MB = new Tk::Tie::MenuHash (
          $MW->Menubutton (
              -relief       => 'raised',
              -text         => 'Pick something',
              -underline    => 0,
          )->pack (
              -side         => 'left',
          )
      );

      $MB->{'Some lable name'}        = 'default';
      $MB->{'Some list item label'}   = [ \&CommandFunction, 'args' ];
      $MB->{'Some other label'}       = \&CommandFunction;

      delete $MB->{'Some other label'};

      $MB->configure ( -text => 'Pick something else' );

      my $menuText = $MB->{"Anything, it doesn't matter"};

      ##############################################################
      ## Or you can do it this way, but it needs two vars so I don't
      ## recommend it...  It's only useful for prexisting code, IMHO.

      tie my %MB, 'Tk::Tie::MenuHash', $Menubutton;
      ## Or...
      tie my %MB, 'Tk::Tie::MenuHash', $MW->Menubutton (
          -relief       => 'raised',
          -text         => 'Pick something',
          -underline    => 0,
      )->pack (
          -side         => 'left',
      );

      $MB{'Some list item label'}   = [ \&CommandFunction, 'args' ];
      $MB{'Some other label'}       = \&CommandFunction;
      $MB{'Some lable name'}        = 'default';

      delete $MB{'Some other label'};

      $Menubutton->configure ( -text => 'Pick something else' );

      my $menuText = $MB{"Anything, it doesn't matter"};

DESCRIPTION
    Creates a tied Tk::Menubutton widget hash reference object kinda
    thingy....

    It's actually much simplier then it sounds, at least to use. It walks
    and talks half like an object, and half like a (tied) hash reference.
    This is because it's both in one (it's a blessed reference to a tied
    hash of the same class, but don't worry about that).

    When you add a key (label) to the hash it added it to the menubutton.
    The value assigned must be either a valid Tk::Menubutton -command
    option, or the string 'default' (case is not important). The default is
    simply a function that configure()s the Menubuttons -text to that of the
    selected label. You can then retrieve the text by just reading a key
    (any key, even if it doesn't exist, it doesn't matter) from the hash.

    The new() method passes back a reference to a tie()d MenuHash, but with
    all the properties (and methods) of the Menubutton you passed it. With
    this type you can set and delete fields as hash keys references:

            $MenuHash->{'Some label'} = 'default';

    But also call Tk::Menubutton (or sub-classes of it, if that's what you
    passed the constructor) methods:

            $MenuHash->configure ( -text => 'Pick something' );

    This involves black magic to do, but it works. See the AUTOLOAD method
    code if you have a morbid interest in this, however it's more that we
    are dealing with 3 objects in 2 classes.

    I prefer this useage myself as it meens I only need to carry around one
    var that walks and talks almost exactly like a "real" Tk::Menubutton
    (that is, you can call any valid Tk::Menubutton method off it directly),
    but with the added (and much needed IMHO) feature of being able to
    easily add, delete, select, and read menu options as simple hash ref
    keys.

HISTORY
     $Log: MenuHash.pm,v $
     Revision 1.9  1998/02/12 22:15:45  byron
            -More doc changes

     Revision 1.4  1997/12/24 00:39:59  byron
            -Made the 'default' string case independant
            -Modified docs

     Revision 1.3  1997/12/24 00:28:28  byron
            -Fixed class name bug
            -Fixed DESTROY autoload problem

     Revision 1.2  1997/11/22 01:06:45  byron
            -Added new() constuctor, and ability to call widget methods off the tied()
             value reference.

AUTHOR
    Zenin <zenin@best.com>
    aka Byron Brummer <byron@omix.com>

COPYRIGHT
    Copyright (c) 1997,1998 OMIX, Inc.

    Available for use under the same terms as perl.




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

Date: 27 Feb 1998 16:08:31 GMT
From: Ulrich Pfeifer <pfeifer@wait.de>
Subject: ANNOUNCE: Math::ematica 1.106 - Perl talks to Mathematica talks to Perl
Message-Id: <6d6odv$kbs$1@news1.teleport.com>

New in 1.106: 

        Calling Perl from a running Mathematica session (calling back
        from a spawned sub-kernel was possible before).

http://www.perl.com/CPAN/authors/id/ULPFR/

Ulrich Pfeifer
--
NAME
    Math::ematica - Perl extension for connecting Mathematica(TM)

SYNOPSIS
      use Math::ematica qw(:PACKET :TYPE :FUNC);

WARNING
    This is alpha software. User visible changes can happen any time.

    The module is completely rewritten. Literally no line of the old stuff
    is used (don't ask - I've learned a few things since these days ;-). If
    you are using the old 1.006 version, note that the interface has
    changed. If there is an overwhelming outcry, I will provide some
    backward compatibility stuff.

    Feel free to suggest modifications and/or extensions. I don not use
    Mathematica for real work right now and may fail to foresee the most
    urgent needs. Even if you think that the interface is great, you are
    invited to complete the documentation (and fix grammos and typos). Since
    I am no native English speaker, I will delay the writing of real
    documentation until the API has stabilized.

    I do develop this module using Mathematica 3.0.1 on a Linux 2.0.30 box.
    Let me know, if it does work with other versions of Mathematica or does
    not work on other *nix flavors.

DESCRIPTION
    The `Math::ematica' module provides an interface to the MathLink(TM)
    library. Functions are not exported and should be called as methods.
    Therefore the Perl names have the 'ML' prefix stripped. Since Perl can
    handle multiple return values, methods fetching elements from the link
    return the values instead of passing results in reference parameters.

    The representation of the data passed between Perl and Mathematica is
    straight forward exept the symbols which are represented as blessed
    scalars in Perl.

Exported constants
    `PACKET'
         The `PACKET' tag identifies constants used as packet types.

           print "Got result packet" if $link->NextPacket == RETURNPKT;

    `TYPE'
         The `TYPE' tag identifies constants used as elements types.

           print "Got a symbol" if $link->GetNext == MLTKSYM;

Exported functions
    `FUNC'
         The `FUNC' tag currently only contains the `symbol' function which
         returns the symbol for a given name.

           $sym = symbol 'Sin';

The plain interface
    This set of methods gives you direct access to the MathLink function.
    Don't despair if you don't know them too much. There is a convenient
    layer ontop of them ;-). Methods below are only commented if they do
    behave different than the corresponding C functions. Look in your
    MathLink manual for details.

  `new'

    The constructor is just a wrapper around `MLOpenArgv'.

      $ml = new Math::ematica '-linklaunch', '-linkname', 'math -mathlink';

    The link is automatically activated on creation and will be closed upon
    destruction.

  `ErrorMessage'

      print $link->ErrorMessage;

  `EndPacket'

  `Flush'

  `NewPacket'

  `NextPacket'

  `Ready'

  `PutSymbol'

  `PutString'

  `PutInteger'

  `PutDouble'

  `PutFunction'

  `GetNext'

  `GetInteger'

  `GetDouble'

  `GetString'

    The method does the appropriate `MLDisownString' call for you.

  `GetSymbol'

    The module does the appropriate `MLDisownSymbol' call for you. It also
    blesses the result string into the package `Math::ematica::symbol'.

  `Function'

    Returns the function name and argument count in list context. In scalar
    contex only the function name is returned.

  `GetRealList'

    Returns the array of reals.

The convenience interface
  `PutToken'

    Puts a single token according to the passed data type.

      $link->PutToken(1);               # MLPutInteger

    Symbols are translated to `MLPutFunction' if the arity is provided as
    aditional parameter.

      $link->PutToken(symbol 'Pi');     # MLPutSymbol
      $link->PutToken(symbol 'Sin', 1); # MLPutFunction

  `read_packet'

    Reads the current packet and returns it as nested data structure. The
    implementaion is not complete. But any packet made up of `MLTKREAL',
    `MLTKINT', `MLTKSTR', `MLTKSYM', and `MLTKFUNC' should translate
    correctely. A function symbol `List' is dropped automatically. So the
    Mathematica expression `List[1,2,3]' translates to the Perl expression
    `[1,2,3]'.

    *Mabybe this is *too* convenient?*.

  `call'

    Call is the main convenience interface. You will be able to do most if
    not all using this call.

    Note that the syntax is nearly the same as you are used to as *FullForm*
    in Mathematica. Only the function names are moved inside the brackets
    and separated with ',' from the arguments. The method returns the nested
    data structures read by `read_packet'.

      $link->call([symbol 'Sin', 3.14159265358979/2]); # returns something near 1

    To get a table of values use:

      $link->call([symbol 'Table',
                   [symbol 'Sin', symbol 'x'],
                   [symbol 'List', symbol 'x',  0, 1, 0.1]]);

    This returns a reference to an array of doubles.

    You may omit the first `symbol'. *Maybe we should choose the default
    mapping to *Symbol* an require *Strings*s to be marked?*

  `install'

    If you find this too ugly, you may `install' Mathematica functions as
    Perl functions using the `install' method.

      $link->install('Sin',1);
      $link->install('Pi');
      $link->install('N',1);
      $link->install('Divide',2);

      Sin(Divide(Pi(),2.0)) # should return 1 (on machines which can
                            # represent '2.0' *exactely* in a double ;-)

    The `install' method takes the name of the mathematica function, the
    number of arguments and optional the name of the Perl function as
    argument.

      $link->install('Sin',1,'sin_by_mathematica');

    Make shure that you do not call any *installed* function after the
    `$link' has gone. Wild things will happen!

  `send_packet'

    Is the sending part of `call'. It translates the expressions passed to a
    Mathematica package and puts it on the link.

  `register'

    This method allows to register your Perl functions to Mathematica.
    *Registered* functions may be called during calculations.

      sub addtwo {
        $_[0]+$_[1];
      }

      $link->register('AddTwo', \&addtwo, 'Integer', 'Integer');
      $link->call([symbol 'AddTwo',12, 3]) # returns 15

    You may register functions with unspecified argument types using undef:

      sub do_print {
        print @_;
      }
      $link->register('DoPrint', undef);
      $link->call(['DoPrint',12]);
      $link->call(['DoPrint',"Hello"]);

  `main'

    This method allows to have Perl scripts installed in a running
    Mathematica session. The Perl script try.pl might look like this:

      use Math::ematica;
      sub addtwo {
        my ($x, $y) = @_;
      
        $x + $y;
      }
      $ml->register('AddTwo', \&addtwo, 'Integer', 'Integer');
      $ml->main;
      
    Inside the Mathematica do:

      Install["try.pl"]
      AddTwo[3,5];

    Admittedly, adding two numbers would be easier inside Mathematica. But
    how about DNS lookups querying or SQL Databases?

AUTHOR
    Ulrich Pfeifer <pfeifer@wait.de>

SEE ALSO
    See also the perl(1) manpage and your Mathematica and MathLink
    documentation. Also check the t/*.t files in the distribution.

ACKNOWLEDGEMENTS
    I wish to thank Jon Orwant of *The Perl Journal*, Nancy Blachman from
    *The Mathematica Journal* and Brett H. Barnhart from *Wolfram Research*.

    Jon brought the earlier versions of this module to the attention of
    Nancy Blachman. She in turn did contact Brett H. Barnhart who was so
    kind to provide a trial license which made this work possible.

    So subscribe to *The Perl Journal* and *The Mathematica Journal* if you
    are not subscribed already if you use this module (a Mathematica license
    is needed anyway). You would be nice to nice people and may even read
    something more about this module one day ;-)

    Special thanks to Randal L. Schwartz for naming this module.

Copyright
    The Math:ematica module is Copyright (c) 1996,1997,1998 Ulrich Pfeifer.
    Germany. All rights reserved.

    You may distribute under the terms of either the GNU General Public
    License or the Artistic License, as specified in the Perl README file.

    Mathematica and MathLink are registered trademarks of Wolfram Research.




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

Date: 27 Feb 1998 16:12:03 GMT
From: hermit@bayview.com
Subject: ANNOUNCE: Number::Format released
Message-Id: <6d6okj$khl$1@news1.teleport.com>


Announcing the release of the Number::Format module.  Now available from
CPAN.  Here is the README file:

Number::Format - Convert numbers to strings with pretty formatting

Version: 1.10

WHAT IS IT

Number::Format is a library for formatting numbers.  Functions are
provided for converting numbers to strings in a variety of ways, and to
convert strings that contain numbers back into numeric form.  The output
formats may include thousands separators - characters inserted between
each group of three characters counting right to left from the decimal
point.  The characters used for the decimal point and the thousands
separator come from the locale information or can be specified by the
user.

Also of note is the format_picture command which converts a number into
a string using a "picture" string that you provide.  This is similar to
the PRINT USING statement that some versions of BASIC have.


BUILDING/INSTALLING

This package is set up to configure and build like a typical Perl
extension.  To build:

        perl Makefile.PL
        make && make test && make install
        make install

NOTE: You may need super-user access to install.


PROBLEMS/BUG REPORTS

Please send any reports of problems or bugs to wrw@bayview.com.


CREDITS AND LICENSES

This package is copyright 1997-8 by William R. Ward <wrw@bayview.com>
and may be distributed under terms of the Artistic License used to cover
Perl itself.  See the file Artistic in the distribution of Perl 5.002 or
later for details of copy and distribution terms.


CHANGE HISTORY

This is version 1.10:

* Add object oriented interface and support for POSIX locales.

* NOTE: Some aspects of the API have changed.  Please reread the
  documentation carefully if you used 1.0 previously!!!

Initial version 1.0:

* Limited release beta version.





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

Date: 27 Feb 1998 16:11:10 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
To: munn@bigfoot.com (Thomas Munn)
Subject: Re: Array into Hash index?
Message-Id: <6d6oiu$2b7$3@info.uah.edu>

[Posted and mailed]

In article <6d5eed$3f0@nnrp3.farm.idt.net>,
	munn@bigfoot.com (Thomas Munn) writes:
: I have am array that contains elements like this:
: 
: 1 usctjm04
: 2 munn
: 
: What I want to do is get this array into a hash table that will use
: the first value as the key, and the second value as the returned
: value.

[ Lines properly wrapped.  Please try to hit return every 72 columns
  or so--the world will love you for it. ]

: In my reading I 
: noticed that Randall Scwartz did something similar with the map
: operator

Randal's been known to savagely beat people who misspell his name. :-)

: Will the map function do what I need, or is there another way to get my array 
: into a hash??

Sure:

    open FILE, 'input-file' or die "$0: Failed open input-file: $!";
    %hash = map { chomp; split } <FILE>;

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Fri, 27 Feb 1998 10:15:51 -0500
From: "I have a life, and I can prove it!" <jefpin@bergen.org>
To: Thomas Munn <munn@bigfoot.com>
Subject: Re: Array into Hash index?
Message-Id: <Pine.SGI.3.95.980227101519.11281A-100000@vangogh.bergen.org>

>I have am array that contains elements like this:
>
>1 usctjm04
>2 munn
>
>Will the map function do what I need, or is there another way to get my array 
>into a hash??

Just do %hash = @array;

--
| You have the ability to annoy God!
|                                                  - Joe Holbrook

    Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
             techmaster@bergen.org | techmaster@mindless.com
                qw[jeff] on #perl,#javascript,#cgi on IRC

 &jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
jp{for$w(@_){$c=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print "$c\n"}}



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

Date: Fri, 27 Feb 1998 10:30:39 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: Failure to run Benchmark.pm on Win32
Message-Id: <MPG.f60a62e2f6e9d6a989747@news.concentric.net>

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

i-janlun@microsoft.com said...
: Could someone please tell me why I keep getting this message when trying to
: run any function from the Benchmark module:
: 
: "times not implemented at C:\PERL\lib/Benchmark.pm line 274."

Microsoft, huh?  Anyway, make sure you're running Gurusamy Sarathy's Win32 
perl port, available at CPAN...

   http://www.perl.com/CPAN-local/authors/Gurusamy_Sarathy/

Tell us if that doesn't work better for you than the ActiveState distribution 
that I assume you're trying now.  GSAR's is much closer to the current Perl 
version.

-- 
#!/usr/bin/perl -w --                     Just another Perl hacker,
(open 0),$_=<0>,s,.*- +,,,chop;for(split?@*?){($$_++or$}=$_,y,y \,\
y,<STDIN>,,$$=~s\^\"sub $_ {print'$}'};7"\ee),y,} \,},>STDOUT,,&$_}
# Jonathan Feinberg         jdf@pobox.com        Sunny Brooklyn, NY


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

Date: Fri, 27 Feb 1998 11:15:10 -0500
From: Jim Michael <jim.michael@gecm.com>
Subject: Re: Function evaluation within strings?
Message-Id: <34F6E68E.7DF0@gecm.com>

Andrew M. Langmead wrote:
> 
> Could you demonstrate what you had in mind?

When I see "how do I evaluate a function within a string" I think of an
actual function defined inside the string, and naturally think eval().
So I was thinking along the lines of:

eval 'print "This is a test of --\$$_--"';

Cheers,

Jim


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

Date: Fri, 27 Feb 1998 15:21:09 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: How do you put a string into a array?
Message-Id: <Ep1MnA.KHK@world.std.com>

"DKD CEO." <dimitri102@hotmail.com> writes:

>Just use:

>@array = $string

C'mon, try things before you post them!

#!/usr/bin/perl -w
$string = "I you he she they me her him his them their";
@array = string;
print "$array[1];
print "$array[2];

The answer, of course is to use split() on the string and store the
result into an array. One small stumbling block is that Seong asked
for $array[1] to contain the first word.

Personally, I'd suggest that he take another look and see if he really
needs that to be the case. What does he want contained in $array[0]?
(Perl's arrays start counting at zero, not one. I know that perl is
supposed to have more than one way of doing most things, but zero
based arrays are so ingrained, fighting perl may not be worth it.)

If he has an idea of what $array[0] is supposed to be, then I'd
suggest just adding it to the assignment. 

@array = ('', split ' ', $string);
-- 
Andrew Langmead


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

Date: Fri, 27 Feb 1998 14:54:16 GMT
From: David Cross <Dave.Cross@gb.swissbank.com>
Subject: Re: How do you put a string into a array?
Message-Id: <y4dsop5p087.fsf@gb.swissbank.com>

"DKD CEO." <dimitri102@hotmail.com> writes:

> 
> Seong Y. Kim wrote:
> > 
> > Let's say that I have a string "I you he she they me her him
> > his them their", and I want the array like this.
> > 
> > $string = "I you he she they me her him his them their";
> > 
> > @array;
> > $array [1]= "I";
> > $array[2]= "you";
> > $array[3]="he";
> > .....
> > $array[11]="their";
> > 
> > how do you do this?
> > 
> > thanks to .......   ;-)
> 
> Just use:
> 
> @array = $string
> 
> 
> There ya go!,

This doesn't actually do what was wanted. It puts the whole string
in $array[0].

Try

@array = split(/\s/, $string);

Dave...

-- 
If I wasn't so busy writing status reports,
my status report might just become a progress report.

Dave.Cross@gb.swissbank.com


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

Date: Fri, 27 Feb 1998 09:28:57 -0500
From: Noah Paci <npaci@bigfoot.com>
Subject: how to copy a file from a website
Message-Id: <34F6CDA7.47A12E90@bigfoot.com>

Is there an internal way to grab a file off of a web site?  I need to
grab a text file from one site and copy it to my site.  I don't think
the site will let me ftp it off.

Thanks for any help
npaci@bigfoot.com



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

Date: Fri, 27 Feb 1998 03:38:04 -0700
From: "TM" <atriosNOSPAM@earthlink.net>
Subject: image displaying according to time on server
Message-Id: <6d64r5$8i3@chile.earthlink.net>

How would I go about controlling whether an image is loaded on a webpage
according to the time of day on the server?  For example, a image showing a
phone number that is only displayed between 7:00 AM and 7:00 PM.  If someone
has a script like this already, please let me know (preferably by email)

Thanks!

Todd Miller


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

Date: Fri, 27 Feb 1998 16:59:50 +0100
From: tobez@plab.ku.dk
Subject: Re: indirect object syntax
Message-Id: <34F6E2F6.708C@plab.ku.dk>

O'Shaughnessy Evans wrote:
> 
> In article <34F354C3.54BF@netvision.net.il>,
> Tzadik Vanderhoof  <stvhoof@netvision.net.il> wrote:
> >
> >I am using CGI.pm.  I have a line that says
> >
> >$foo = $cgi->param('bar');
> >
> >It works fine.  Just as an experiment to increase my understanding of
> >using objects in Perl, I tried changing it to:
> >
> >$foo = param $cgi 'bar';
> >
> >This caused a syntax error.  Why is this?  Aren't "object-oriented" and
> >"direct object" syntax supposed to do the same thing?
> 
> Just like Gabor mentioned, you need to qualify param().  Since it's
> not in the main namespace by default, you have to use ``CGI::param''
> instead.  You may find some useful info on this by lookup up the
> "use" pragma, @EXPORT, @EXPORT_OK, and even the docs for CGI.pm.
> Also, I think that if you try something like ``use CGI qw(param)''
> instead of simply ``use CGI'', you won't have to qualify that
> function.


That's VERY wrong!  param $cgi 'bar' is an alternative syntax for
calling methods of objects.  Methods do not need to be exported 
into caller's namespace.

In original post Tzadik did not tell which particular error it was.
I strongly suspect that it was not a syntax error but a semantic 
error --- something was wrong with $cgi variable --- it did not 
hold a valid reference to a valid object with a valid `param' 
method.

This script works perfectly alright (don't try that from the server 
side, use command line instead):

#!/usr/local/bin/perl
use CGI;

my $cgi = new CGI;

print "Hej!\n";
my $foo = param $cgi 'bar';
print "BAR is $foo\n";
__END__

The screenshot of the test run:

(offline mode: enter name=value pairs on standard input)
bar=Perl
^D
Hej!
BAR is Perl


Hope this helps,

Anton.


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

Date: Fri, 27 Feb 1998 14:18:07 +0100
From: Julien Metayer <pds-root@portesdusoleil.com>
Subject: Iss, exec & perl
Message-Id: <34F6BD0F.A54CFCC9@portesdusoleil.com>

I have installed a NT server with IIS 2.0, perl for Win32 and,
configured the system for executing perl scripts.

But the instruction "<--#exec cmd="/cgi-bin/test.pl" --> doesn't run and

give me a blank page. Can I run automatically perl scripts under iis ?

Thanks fo responses

Julien





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

Date: Fri, 27 Feb 1998 10:12:19 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Killfile Triage
Message-Id: <C295FBB28A202975.847EEB9300C5D2C8.05600B4CCA9153CA@library-proxy.airnews.net>

In news.software.readers Richard Caley <spt@cstr.ed.ac.uk> wrote:

> Not sure what I'll do next time I ask a real question in a newsgroup
> and so want replies. Probably I'll set up a new mail address for the
> replies, read the mail as it comes in and put up with the spam and zap
> the address after a month or so.

Well, it's not 100% positive, but you could use the Mail-Copies-To with
your real address in it.  This would handle replies from people using
Gnus, slrn as well as several other newsreaders (not that there are a
lot of Mac Perl hackers, but most of the Mac shareware newsreaders now
support it).  So if Randal Randal Schwartz has the answer you'd get it
(Gnus) - I don't know about any of the others.

-- 
John Moreno
I am trying to convince the author of YA-NewsWatcher that the latest
version should be released to the public.  He doesn't think there's much
interest in a new version.  Help me prove him wrong.  To do so, send me
mail <mailto:phenix@interpath.com> with a Subject of New YA.  Comments
on what you like/dislike in the current version will be appreciated. 


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

Date: 27 Feb 1998 12:31:23 +0000
From: Richard Caley <spt@cstr.ed.ac.uk>
Subject: Re: Killfile Triage
Message-Id: <eyh3eh5ut44.fsf@liddell.cstr.ed.ac.uk>

In article <34f6536b.1679058@news>, Jim Britain (jb) writes:

jb> No deal from me on that one (reading to the end of the text)  

Must make replying something of a hit and miss business if they
something important in the last paragraph:-).

jb> I answer upwards of 100 help messages a day.  Quite simply, if a
jb> user does not have a valid address in his message header, he does
jb> not get a response.

If someoen spamroofs the reply address in a message where they expect
an answer by mail, they deserve the silence they may get. I
have had spamproofed addresses in email for instance. Clearly someone
not engaging brain.

However, people posting news generally aren't expecting mail replies.

Not sure what I'll do next time I ask a real question in a newsgroup
and so want replies. Probably I'll set up a new mail address for the
replies, read the mail as it comes in and put up with the spam and zap
the address after a month or so.

jb> I have one particular irate client from Australia.  Not only was his
jb> "From:" address nospam@nowhere.org he also forgot to put a correct
jb> address anywhere in the message.  I'm not going to dig for it.  He can
jb> use the phone to call our 800 number.

-- 
Mail me as rjc not spt@cstr.ed.ac.uk		_O_
						 |<



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

Date: 27 Feb 1998 12:51:54 GMT
From: guckes@math.fu-berlin.de (Sven Guckes)
Subject: Re: Killfile Triage
Message-Id: <slrn6fddna.42f.guckes@rudin.math.fu-berlin.de>

psamuels@sampo.REMOVETHIS.creighton.edu (Peter Samuelson):
> Most people do something semi-obvious to the address itself, rather than
> outright replace it.  [...] it's usually obvious enough from the address
> itself.  [...] should take all of, say, five seconds to spot the average
> spam-mangled address

Now, what would happen if everyone just used a valid address?
Noone would have to scan the complete article for clues.
No loss of time.  Just followup/reply.  What a concept.

I hope that JED will add some code or macros to slrn
which will warn me about "nospam" address of posters
so I can abort my response right away.
I really dont want to waste any time on people
who make it clear that they do not want replies.

How did comp.lang.perl.misc get into this?
Note: Followup-To: news.software.readers

Sven


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

Date: 27 Feb 1998 15:34:13 GMT
From: Eli the Bearded <*@qz.little-neck.ny.us>
Subject: Re: Killfile Triage
Message-Id: <eli$9802271019@qz.little-neck.ny.us>

peter caffin <nospam_synic@omen.net.au> wrote:
> Eli the Bearded <*@qz.little-neck.ny.us> did cunningly address to
> comp.lang.perl.misc..
> :peter caffin <nospam_synic@omen.net.au> wrote:
> :> Whereas if I receive a bounce message, I read it to find out:
> :>   (a) Who didn't get my email,
> :>   (b) Why they didn't get my email (system down? misspelled domain?),
> :>   (c) What I need to do to get the message through.
> :Very time consuming. Do you get paid to do this?
> Nope. But then, I guess I value communication. If I get a bounce it means
> that I spent a lot of time composing a message that didn't get there.
> Therefore, I maximise my value:time ratio by making sure my email gets to
> where I want it to go.

And I just say, fuck it, no use talking to the deaf and move on. If I
do see that you have bounced my mail I am likely to throw you in my
killfile. Tom C. has avoided this thus far but he is pushing my limits.

> Then again, I don't spam. Therefore I don't -expect- multitudes of bounce
> messages.

Are you accusing me of spamming?

> :> :It is not my responsibility to prove to you my mail is not spam.
> :> It is if you want it read ;-). I mean, really..
> :Not. A. Fucking. Chance.
> Your loss. You've spent time replying and now your reply goes straight to the
> trash bin.

The loss is mutual, if I could have helped.

> :If I go to the work to send you email and
> :you have deliberately configured things to frustrate me
> Nope. Just the autobots who don't read to the end of an article to find reply
> directions.

I expect that I can hit 'R' to reply and not have to do anything else.
If I cannot, and it is because you have arranged for things to be that
way (as opposed to a real problem with a machine not being configured
correctly) then you have made a deliberate effort to frustrate would be
repliers. Just because some repliers might be spammers does not alter
that fact.

> :then you have
> :just pissed me off and I don't evenwant to know about it. I kind of
> :like helping people, if you make me jump through hoops it is no fun
> :at all.
> Reply to Usenet only or read to the end of peoples .sigs. Is it really that
> hard??

Some things are not topical in the group they are being discussed.

> :> Why bother going to the effort
> :> of writing email if you can't be bothered making sure it gets there?
> :Good faith effort to tell people trying to post to the group I moderate
> :why I am rejecting their posts? (Eg. no uuencoded posts.) Simple question
> And I repeat again: Why bother going to the effort of writing email if you
> can't be bothered making sure it gets there? (I certainly don't doubt your

I can send a reply saying 'UUencoded material is not appropriate for
alt.sex.stories.moderated' in ten keystrokes. If I have to page through
or jump down to the end to look for a signature that says 'remove the
hyphens to email' it takes a lot longer to send a reply out. 

> :Recently I have been getting five to ten bounces a week on twenty to
> :fifty pieces of email a week, mostly (I suspect) post rejections.
> All of which could have been avoided with a quick glance to those peoples
> .sigs. That's what I just don't understand: why people are so averse to
> reading an article to which they're replying to the end for the reply method
> info.

That's what I don't understand, why people think that munging their
address is not going to annoy people who believe computers should take
tedium such as hand addressing mail out of their lives.

Elijah
------
uses computers to take the tedium out of sorting email


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

Date: Fri, 27 Feb 1998 10:34:35 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: Newbie Q: How does TIE work??
Message-Id: <MPG.f60a715689f3bbd989748@news.concentric.net>

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

pbelair@geocities.com said...
: - How do you do it ??
: 
: Is there a usable example anywhere?

One of the documents that comes with perl is devoted exclusively to this 
topic.  It's called perltie.

-- 
#!/usr/bin/perl -w --                     Just another Perl hacker,
(open 0),$_=<0>,s,.*- +,,,chop;for(split?@*?){($$_++or$}=$_,y,y \,\
y,<STDIN>,,$$=~s\^\"sub $_ {print'$}'};7"\ee),y,} \,},>STDOUT,,&$_}
# Jonathan Feinberg         jdf@pobox.com        Sunny Brooklyn, NY


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

Date: Fri, 27 Feb 1998 13:14:09 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Perl and the Windows clipboard
Message-Id: <ebohlmanEp1GrL.Lx6@netcom.com>

Ben Jones <ben_j@usa.net> wrote:
: Is there a way of using the windows clipboard as the input file for a
: Perl script?

If there is, it will involve using a module, and the most likely place to 
find a module is on CPAN.  If you don't find one there, check out the 
list of Win32 resources at http://www.perl.com and see if any of the 
authors there has one.



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

Date: 27 Feb 1998 16:13:14 GMT
From: colink@latticesemi.com (Colin Kuskie)
Subject: Statistics::Descriptive v2.2
Message-Id: <6d6omq$kim$1@news1.teleport.com>

Greetings everyone!

In the midst of a world of apathetic (or maybe just pathetic) newbies
and frustrated gurus a voice rose above the din and said:

"Hey, your module acts funny sometimes!"

So after much convincing (on his part) and much work (on my part) I'm
happy to release version 2.2 of Statistics::Descriptive that contains a
fix for the AUTOLOAD/Carp bug.  It should be mirrored around the world
by PAUSE within a few days (Feb 25 or 26).  If you have comments,
suggestions or complaints please send them to me or post to the groups
and include this information:

What version of perl you're using (output from perl -v).
Which version of Statistics::Descriptive you're talking about.
A detailed description of your problem.

(If you're not using perl5.004_04 or Statistics::Descriptive2.2 please
consider upgrading and retesting before launching major complaints :)

And remember, if you could arbitrarily shift the probability density
function of your atoms you could go to the beach!

Colin Kuskie

p.s. The README file from the distribution is included below:


This new version (2.2) of Statistics::Descriptive contains:

- A bug fix for the calculation of min and max.  Thanks to Thomas Goetze
  for alerting me to this (and supplying a solution).

- A bug fix for a strange bug when using AUTOLOAD and Carp.  Actually,
  I benefitted from the bug.  If you use the AUTOLOAD from the perltoot
  manpage and use Carp to provide "nice" error trapping from the module,
  then the AUTOLOAD doesn't catch calls to DESTROY (which it is supposed
  to do, technically).  If you use warn, then it catches the call to
  DESTROY and prints the error message 'Unable to access method DESTROY
  in class Statistics::Descriptive'.

  Thanks to Terrence Brannon for alerting me to this.  He, running
  perl5.003_07, has the AUTOLOAD method intermittently catch the
  call even when Carp is being used.  Go figure...

List of methods by class:

Statistics::Descriptive::Sparse
----------------------------------
add_data
count
mean
sum
variance
pseudo_variance
min
max
mindex
maxdex
standard_deviation
sample_range

Statistics::Descriptive::Full
----------------------------------
All methods above and:
get_data
sort_data
presorted
median
trimmed_mean
harmonic_mean
mode
geometric_mean
frequency_distribution
least_squares_fit

Ideas for ongoing development:

- An interface to Jon Orwant's Statistics::ChiSquare module to
  provide a method for determining how random data is (for a uniform
  distribution) or how well is fits another distribution (for
  non-uniform distributions like normal(gaussian), log-normal,
  rayleigh, etc).

  The major issue I'm concerned about is the updating of someone else's
  code and future extensibility.  Now, major paranoia should be obvious
  since Jon hasn't changed Statistics::ChiSquare for a long, long
  time.  Still, a wrapper module that inherits from several other
  modules is appealing.  Perhaps it will be called Statistics::Bundle.




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

Date: 27 Feb 1998 15:20:09 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
To: Matthew Couchman <Matthew.Couchman@bbsrc.ac.uk>
Subject: Re: Viewing local vars in debugger
Message-Id: <6d6lj9$2b7$1@info.uah.edu>

[Posted and mailed]

In article <34F6AC18.9C4633B@bbsrc.ac.uk>,
	Matthew Couchman <Matthew.Couchman@bbsrc.ac.uk> writes:
: I'm using the debugger with perl5.00404 but i'm having trouble viewing
: variables that have been declared local with my().

The debugger provide interactive help, you know.

: I can view variables
: whose scope has not been specified as normal

Please define ``normal scope''.

: but "X var" on a local
: variable returns a blank.

You mean ``lexically scoped''.

: Has anyone else experienced this? Is there a
: solution?

Yes and yes.

    % perl -de 0

    Loading DB routines from perl5db.pl version 1.01
    Emacs support available.

    Enter h or `h h' for help.

    main::(-e:1):   0
      DB<1> h X
    X [vars]        Same as "V currentpackage [vars]".

See the ``currentpackage'' bits?  Lexicals don't live in packages.
This is documented in the perlsub manpage (in the ``Private Variables
via my()'' section).  You either want to assign your lexical to a
variable that lives in a symbol table (read package) or use the
debugger's `x' command.

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Fri, 27 Feb 1998 14:09:28 +0100
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: What does this one-liner do?
Message-Id: <34F6BB08.41C6@theo.phy.uni-bayreuth.de>

Hi,

Olav Reinert wrote:
> 
> Another guy trying to learn Perl, and I'm having trouble understanding what
> the return value of the assignment operator is. Consider this statement:
> 
> print ( $x = ($a) = (7,8,9) );

First point to mention: associativity of '=' is "right" which
means that the above is equivalent to

  print ( $x = ( ($a) = (7,8,9) ) );

The reason why the value of '$x' is equal to '3' afterwards can be
found in the "Camel", 2nd ed., p.48:

  "List assignment in a scalar context returns the number of
   elements produced by the expression on the right side of the
   assignment: ..."


Bye, Eike
-- 
=======================================================================
>>--->>    Eike Grote  <eike.grote@theo.phy.uni-bayreuth.de>    <<---<<
-----------------------------------------------------------------------
 Home Page, Address, PGP,...:  http://www.phy.uni-bayreuth.de/~btpa25/
-----------------------------------------------------------------------
 PGP fingerprint:      1F F4 AB CF 1B 5F 4B 1D 75 A1 F9 C5 7B 3F 37 06
=======================================================================


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

Date: 27 Feb 1998 10:24:22 -0500
From: Justin Vallon <vallon@pearl.fi.bear.com>
Subject: Re: What does this one-liner do?
Message-Id: <x6eogztm5p5.fsf@pearl.fi.bear.com>

Olav Reinert <oreinert@daimi.aau.dk> writes:

> Hi folks,
> 
> Another guy trying to learn Perl, and I'm having trouble understanding what
> the return value of the assignment operator is. Consider this statement:
> 
> print ( $x = ($a) = (7,8,9) );

I thought it was returning the rhs, but man perlfunc says:

      Array assignment in a scalar context returns the number of elements
      produced by the expression on the right side of the assignment:

          $x = (($foo,$bar) = (3,2,1));       # set $x to 3, not 2
          $x = (($foo,$bar) = f());           # set $x to f()'s return count

That was news to me.

local @x = (($a) = (10, 20));
print join ",", @x;
print "\n";

local $y = (($a) = (10, 20));
print "$y\n";

Gives:

10
2

Very strange indeed.

> 
> See if you can guess what is printed. If you can, could you please explain
> to me exactly why it gives that result? What is the value returned by the
> right-most assignment?
> 
> Regards,
> Olav
> -- 
> Olav Reinert ~ oreinert@daimi.aau.dk ~ http://www.daimi.aau.dk/~oreinert

-- 
-Justin
vallon@bear.com


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

Date: 27 Feb 1998 15:23:52 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: What does this one-liner do?
Message-Id: <6d6lq8$2b7$2@info.uah.edu>

In article <34F6BB08.41C6@theo.phy.uni-bayreuth.de>,
	Eike Grote <eike.grote@theo.phy.uni-bayreuth.de> writes:
: Olav Reinert wrote:
: : 
: : Another guy trying to learn Perl, and I'm having trouble understanding what
: : the return value of the assignment operator is. Consider this statement:
: : 
: : print ( $x = ($a) = (7,8,9) );
:  
: First point to mention: associativity of '=' is "right" which
: means that the above is equivalent to
:  
:   print ( $x = ( ($a) = (7,8,9) ) );

What's even more fun is when you remove the parentheses that surround
$a.

Ain't context fun? :-)

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: 27 Feb 1998 15:11:37 GMT
From: "Bill Wilson" <atijapan@gol.com>
Subject: Re: Win95 - Running scripts from browser?
Message-Id: <01bd4390$ac2f1400$5a17d8cb@atijapan>

Why are you trying to "run" a script from a browser? Your dos 
command line will work fine. Unless you are talking about trying
to run a cgi which happens to be written in perl. CGIs, regardless of
what language you write them in, run behind web (httpd) servers. 
You can get one of these for Win32 at www.apache.org. 

Bill

Burt Lewis <burt@ici.net> wrote in article <6cv9dp$s1u$1@bashir.ici.net>...
> Hi,
> 
> I just installed Perl in Windows95 and all is great running from the DOS 
> prompt.
> 
> Problem is when I try to open a script in my browser, it wants to open it
in 
> Notepad.
> 
> I have the script in the bin directory. Is there something I'm missing or

> need to do to get this to execute via a browser.
> 
> Burt
> 
> 


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

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

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