[17408] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4828 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 7 06:05:33 2000

Date: Tue, 7 Nov 2000 03:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <973595110-v9-i4828@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 7 Nov 2000     Volume: 9 Number: 4828

Today's topics:
    Re: Backtick problems on Windows98 peter_lerup@my-deja.com
        Beginner need a clue on install (John)
    Re: CGI: How to save upload file by perl? <radar@jetstream.net>
    Re: die() ignores tied STDERR? (Paul Buder)
    Re: do you know why this doesn't work? <elephant@squirrelgroup.com>
    Re: do you know why this doesn't work? <jeff@vpservices.com>
    Re: do you know why this doesn't work? (Garry Williams)
    Re: Getting the Day of a Date <ubl@schaffhausen.de>
    Re: Getting the Day of a Date (Anno Siegel)
    Re: Getting the Day of a Date <sb@muccpu1.muc.sdm.de>
    Re: Hanging problem with IO::Socket::INET preetham@mailcity.com
    Re: Help - read from CSV (Martien Verbruggen)
    Re: Help again needed (not so ambitious this time)  :-) (Chris Fedde)
    Re: Help again needed (not so ambitious this time)  :-) <MiGuenther@lucent.com>
    Re: help w/linux RH6.2 perl script wmarvel@my-deja.com
    Re: help w/linux RH6.2 perl script (Chris Fedde)
        HELP Winows NT Mail::Sender <paul.g@cableinet.co.uk>
        Help with a script to parse Powerpoint files in unix (Richie Crews)
    Re: large file size (Richie Crews)
    Re: large file size (Garry Williams)
    Re: Log.pm did not return a true value (Anno Siegel)
    Re: Looking for idiom for getting value from @ARGV, or  (Abigail)
    Re: Looking for idiom for getting value from @ARGV, or  (Martien Verbruggen)
        Monitoring PIDs <davidmac@austin.rr.com>
    Re: pass by reference to C (Anno Siegel)
        Perl and mysql <vivekvp@spliced.com>
        perl document needed <wangwei18@163.net>
    Re: perl document needed (Steven Smolinski)
    Re: perl gallery script (Jon Ericson)
        Perl SendMessage() ? <toddm@waltz.rahul.net>
    Re: Problem reading a binary file (Anno Siegel)
        Q: Problem with CPAN.pm: Could not gzopen percl@my-deja.com
    Re: read last line only... <uri@sysarch.com>
    Re: Search engine woes... acroapl@my-deja.com
    Re: Splitting variable length fixed records (Garry Williams)
    Re: Why is my hash coming untied? <bart.lateur@skynet.be>
    Re: why it's called a "hash" (and a whole lot more) (Paul Buder)
    Re: why it's called a "hash" (and a whole lot more) <jeffp@crusoe.net>
    Re: why it's called a "hash" (and a whole lot more) (Damian Conway)
        Win32 question (MattBonness)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 07 Nov 2000 09:37:32 GMT
From: peter_lerup@my-deja.com
Subject: Re: Backtick problems on Windows98
Message-Id: <8u8igr$2cm$1@nnrp1.deja.com>

Well, the problem is that we have a lot of
scripts with excessive use of backticks and pipes
and these have up till now been working perfecly
on all Windows versions. The problem has appeared
on newer laptops. I've tried using the PER5SHELL
environment variable and that seems to work, that
is it would if there was an alternative standard
shell available for Windows 98. The old cmd32.exe
previously distributed with Perl for Win32
doesn't work.

BR
/Peter

In article
<slrn90emnn.7ck.mgjv@verbruggen.comdyn.com.au>,
  mgjv@tradingpost.com.au wrote:
> On Mon, 6 Nov 2000 21:55:24 +0100,
> 	Peter Lerup <peter.lerup@ecs.ericsson.se>
wrote:
> > Hi
> >
> > I have a strange phenomenon that I wonder if
someone else have seen and
> > hopefully have the solution for.
> >
> > The problem is that on some Windows 98
machines the redirection of stdout
> > doesn't seem to work. Whenever doing anything
like
> >
> > $a = `dir`;
>
> My recommendation would be to not use external
commands for this,
> since Perl is perfectly capable of doing this
internally with a
> minimum amount of fuss. You'll end up with code
which is faster and
> more portable.
>
> opendir DIR, '.' or die $!;
> my @files = readdir DIR;
> closedir DIR;
>
> my @files = glob '*';
>
> I'm not sure whether you really wanted
information on the files, but
> parsing the output of dir is probably not the
best way to get it. Use
> stat() for that.
>
> You might want to read the perlfunc
documentation, in particularthe
> entries for opendir(), readdir(), closedir(),
glob() and stat().
>
> Martien
> --
> Martien Verbruggen              |
> Interactive Media Division      | Begin at the
beginning and go on till
> Commercial Dynamics Pty. Ltd.   | you come to
the end; then stop.
> NSW, Australia                  |
>



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 6 Nov 2000 21:31:22 -0600
From: boite123@videotron.ca (John)
Subject: Beginner need a clue on install
Message-Id: <3a0776bf$0$44731$45beb828@newscene.com>

I installed the latest version of perl on NT 4, SP 6 iis 3, but when I try to 
run a script it does nothig for a while and then tell me the that NT has 
stoped the process because it wasn't getting any answer

I got no idea if this problem is related to iis or perl so I do not know wher 
to start.

Anyone has an idea ?
John
 boite123@videotron.ca


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

Date: Mon, 06 Nov 2000 18:17:44 -0800
From: "Dragonia Radar Freedom, C.S." <radar@jetstream.net>
Subject: Re: CGI: How to save upload file by perl?
Message-Id: <3A076648.2B5C1117@jetstream.net>

Thanks for the code.  I've managed to get things working for the most part, but have one problem:
filenames with spaces will create an error and not upload.  Can anyone help get past this problem?

Thanks.

--
Michel.

Petri Oksanen wrote:
<snip>

> This stuff runs on ActivePerl V5.005_03 build 522 and NT4+IIS4+SP6a, the
> platform of choice in the most MS friendly country on this planet; Sweden.
>
> # ---8<---
> use strict;
> use CGI qw/:standard/;
> use CGI::Carp qw/fatalsToBrowser/;
>
> my $path = "x:/local/path/on/server/";
> print header, start_html("Upload files to server"),
>       h2("Upload files to server"),
>       start_multipart_form,
>       filefield(-name => 'file'),
>       submit(-value => 'Upload'),
>       endform;
> my $file = param('file');
> my $fn = $file; # $file is used as an FH, probably don't wanna change it.
> $fn =~ s,^.*(\\|/)(.+)$,$2,; # Extract filename from client path.
>
> if ($fn =~ /^([-\@\w.]+)$/) { # From perlsec.
>     $fn = $1; # $fn now untainted.
> } else {
>     if($fn ne undef) { # Ignore if undef, probably first run.
>         die "'$fn' is an illegal filename.";
>     }
> }
>
> if (ref $file) {
>     open (OUT, ">$path$fn") or die "Could not write file '$path$fn': $!\n";
>     binmode(OUT);
>     while (my $bytesread=read($file,my $buffer,1024)) {
>         print OUT $buffer;
>     }
>     print "'$fn' has been successfully sent to server."
> }
> print end_html;
> # ---8<---
>
> Petri

--
Michel.




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

Date: Tue, 07 Nov 2000 05:25:07 GMT
From: paulb@shell1.aracnet.com (Paul Buder)
Subject: Re: die() ignores tied STDERR?
Message-Id: <TmMN5.7787$Qz2.278047@typhoon.aracnet.com>

mgjv@tradingpost.com.au (Martien Verbruggen) writes:

>Ok, apart from pointer abuse with unpack and passing bad stuff to
>syscall, can anyone think of other things one can do from Perl (not XS
>or using the Inline stuff) that causes perl to segfault?

I don't use signals in perl since they caused seg faults in 5.00404 
and I haven't heard that that has changed up to and including 5.60.
I know there was a patch for 5.005.  I haven't heard the same for 5.6.



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

Date: Tue, 7 Nov 2000 14:59:02 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: do you know why this doesn't work?
Message-Id: <MPG.14722910307c62cc98987d@localhost>

Garry Williams wrote ..
>On Tue, 7 Nov 2000 09:39:07 +1100, jason <elephant@squirrelgroup.com>
>wrote:
>>Garry Williams wrote ..
>>>On Wed, 1 Nov 2000 13:38:16 +1100, jason <elephant@squirrelgroup.com> wrote:
>>>>jt_2000_ky@my-deja.com wrote ..
>>>>>I'm trying to write a simple script to check to make sure a box is up.
>>>>>I thought the easy part would be to get the Ping module to work
>>>>>correctly but the script below doesn't work. Any suggestions?
>>>>...
>>>>thus endeth the first lesson in testing functions that have command line 
>>>>equivalents
>>>
>>>What makes you think there's a command line equivalent to the
>>>functionality in Net::Ping?  Did you read the Net::Ping manual page?  
>>
>>pinging microsoft.com always times out because it doesn't respond to 
>>pings .. it is the simplest functionality possible that needs to be 
>>tested because that's all that the originator's code uses from Net::Ping
>>
>>I'm guessing (because the originator never stated it) that the "doesn't 
>>work" they were talking about was probably because they expected a 
>>response from microsoft.com and yet it doesn't respond .. because other 
>>than that there is nothing unexpected about the code or its output - it 
>>correctly pings www.virginrecords.com
>
>The real point is that the command line ping program sends icmp echo
>requests and the default protocol used by Net::Ping is udp: 
>
>    $ cat x      
>    #!/usr/local/bin/perl -w
>    use strict;
>    use Net::Ping;
>    my $h = 'www.virginrecords.com';
>    my $p = Net::Ping->new;
>    $p->ping($h)
>	? print "$h responded to udp echo\n"
>	: print "$h no answer to udp echo\n";
>
>    $p = Net::Ping->new('icmp');
>    $p->ping($h)
>	? print "$h responded to icmp echo\n"
>	: print "$h no answer to icmp echo\n";
>    $ sudo perl x
>    www.virginrecords.com no answer to udp echo
>    www.virginrecords.com responded to icmp echo
>    $
>
>Not all hosts are configured to respond to any echo request, but very
>few these days are configured to respond to udp or tcp echo requests.  

ahh .. I see - thanks for the info (hope the originator is still 
watching)

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Mon, 06 Nov 2000 20:16:49 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: do you know why this doesn't work?
Message-Id: <3A078231.35275610@vpservices.com>

Garry Williams wrote:
> 
> The real point is that the command line ping program sends icmp echo
> requests and the default protocol used by Net::Ping is udp:

However the default Protocol for Net::Ping can easily be changed by
passing a parameter in the call to new:

   my $p=Net::Ping->new($protocol);

Where $protocol can be any of "tcp", "udp" or "icmp".  Although the
"tcp" ping is implemented using alarm() so won't work properly on
systems that don't have alarm() implemented.

-- 
Jeff


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

Date: Tue, 07 Nov 2000 05:21:21 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: do you know why this doesn't work?
Message-Id: <ljMN5.810$FG.48231@eagle.america.net>

On Mon, 06 Nov 2000 20:16:49 -0800, Jeff Zucker <jeff@vpservices.com>
wrote:
>Garry Williams wrote:
>> 
>> The real point is that the command line ping program sends icmp echo
>> requests and the default protocol used by Net::Ping is udp:
>
>However the default Protocol for Net::Ping can easily be changed by
>passing a parameter in the call to new:
>
>   my $p=Net::Ping->new($protocol);

Of course, that's exactly what I posted after the bit you quoted.  

-- 
Garry Williams


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

Date: Tue, 07 Nov 2000 09:02:44 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Getting the Day of a Date
Message-Id: <3A07B724.2AC0A5A4@schaffhausen.de>

Clay Irving schrieb:
> 
> On Mon, 06 Nov 2000 14:16:39 GMT, jamesmagnus@my-deja.com
> <jamesmagnus@my-deja.com> wrote:
> 
> >Can anyone tell me how to take a date (eg, 6 Nov 2000) and get the day
> >(eg, Monday)?
> >
> >Any help or pointers appreciated - Thanks, James.
> 
>   #!/usr/local/bin/perl -w
> 
>   use Date::Calc qw/Day_of_Week/;
> 
>   my %day = (
>       '0' => 'Sunday',
>       '1' => 'Monday',
>       '2' => 'Tuesday',
>       '3' => 'Wednesday',
>       '4' => 'Thursday',
>       '5' => 'Friday',
>       '6' => 'Saturday'
>       );


this is uneccessary and wrong. Sunday's index is 7


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

Date: 7 Nov 2000 10:10:11 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Getting the Day of a Date
Message-Id: <8u8ke3$v2b$1@lublin.zrz.tu-berlin.de>

Malte Ubl  <ubl@schaffhausen.de> wrote in comp.lang.perl.misc:
>Clay Irving schrieb:
 
>>   my %day = (
>>       '0' => 'Sunday',
>>       '1' => 'Monday',
>>       '2' => 'Tuesday',
>>       '3' => 'Wednesday',
>>       '4' => 'Thursday',
>>       '5' => 'Friday',
>>       '6' => 'Saturday'
>>       );
>
>
>this is uneccessary and wrong. Sunday's index is 7

Huh?  From perldoc -f localtime:

               $wday is the day of the week, with 0 indicating
               Sunday...

Please check before making public claims.

Anno


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

Date: 7 Nov 2000 10:47:58 GMT
From: Steffen Beyer <sb@muccpu1.muc.sdm.de>
Subject: Re: Getting the Day of a Date
Message-Id: <8u8mku$iht$1@solti3.sdm.de>

In article <8u8ke3$v2b$1@lublin.zrz.tu-berlin.de>, Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:

>>>   my %day = (
>>>       '0' => 'Sunday',
>>>       '1' => 'Monday',
>>>       '2' => 'Tuesday',
>>>       '3' => 'Wednesday',
>>>       '4' => 'Thursday',
>>>       '5' => 'Friday',
>>>       '6' => 'Saturday'
>>>       );
>>this is uneccessary and wrong. Sunday's index is 7

> Huh?  From perldoc -f localtime:
>     $wday is the day of the week, with 0 indicating Sunday...
> Please check before making public claims.

Please do so yourself, i.e., please read the thread before posting to it! ;-)

We were talking about Date::Calc, not localtime, where Sunday is indeed
7 and not 0 (as opposed to localtime).

Regards,
-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/ (Who am I)
    http://www.engelschall.com/u/sb/gallery/ (Fotos Brasil, USA, ...)
    http://www.engelschall.com/u/sb/download/ (Free Perl and C Software)


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

Date: Tue, 07 Nov 2000 10:33:29 GMT
From: preetham@mailcity.com
Subject: Re: Hanging problem with IO::Socket::INET
Message-Id: <8u8lpp$4hf$1@nnrp1.deja.com>

try using timeouts

 $socket = IO::Socket::INET->new( PeerAddr => $host,
                                  PeerPort => 63333,
                                  Proto => "tcp",
                                  Timeout=>10,
                                  Type => SOCK_STREAM);

or
$socket->timeout(10);

for more info see documentation of IO::Socket







In article <a9FM5.14936$Cn4.168754@typhoon.ne.mediaone.net>,
  "Bruce Pennypacker" <bruce@pennypacker.org> wrote:
> Hi all,
>
> We have NT servers running a very simple monitoring program that
listens on
> a TCP port for connections.  I'm trying to write a perl script on a
RedHat
> Linux 6.2 machine to connect and issue a command that will result in a
> single line of text being sent back.  I'm using Socket.pm with Perl
> 5.005_03, and for the most part everything is working fine.  Here's a
> snippet of what I have:
>
> $socket = IO::Socket::INET->new( PeerAddr => $host,
>                                  PeerPort => 63333,
>                                  Proto => "tcp",
>                                  Type => SOCK_STREAM);
>
> if (defined($socket)) {
>   print $socket "ping";
>
>   $result = <$socket>;
>
>   if ($result =~ "^pong") {
>     print "server ok\n";
>   }
> }
>
> 99% of the time this script works like a champ. However if it happens
to run
> at the approximate time that the NT server it's connecting to is
shutting
> down (for whatever reason) this script hangs on the call to new and
never
> returns.  I've been trying a number of ways to prevent it from
hanging in
> this situation but haven't had any consistant luck.  I've tried
setting a
> SIGALRM handler but it never seems to get called.  I've tried
creating the
> socket manually but then the <$socket> read never returns.  I'm about
ready
> to fork another process and kill it after a few seconds if it doesn't
> succeed on it's own but that's really messy...
>
> Any suggestions on how to handle this problem?  Since this script will
> eventually be run automatically from a cron job I don't want any
chance of
> it getting hung like it is....
>
> -Bruce
>
>

--
(--------------------------)               {((((((
(      Preetham.M          )              /_  _  )
( preetham@rocketmail.com  )             ( .  .   )
(      What a life !!!     )              ( /   )
(----------------------------------oOOo------------oOOo---)
(---------------------------------------------------------)
(---------------------------------------------------------)


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 07 Nov 2000 02:06:07 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Help - read from CSV
Message-Id: <slrn90eosh.7ck.mgjv@verbruggen.comdyn.com.au>

On Tue, 07 Nov 2000 01:25:42 -0000,
	mischief@velma.motion.net <mischief@velma.motion.net> wrote:
> Simon E. John <simon@suit-u-sir.com> wrote:
>> I'm trying to write a poll in Perl, I've got most of it done, but would like
>> to read in the results from a flat file e.g. CSV or pipe-delimited.
> 
>> The format would only consist of two fields with each record separated by a
>> newline, e.g.
> 
>> Bush|1
>> Gore|2
>> Homer Simpson|100
> 
>> I'd like to be able to setup a loop so that the file is read into an array
>> until EOF and the number of records counted and put into a variable,
>> processed and then written back to the file.
> 
> Here's a script that does more than what you explicitly asked:

Your script can do with a few enhancements.

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

-w, good. no strict? bad.

use strict;

> open(poll, 'poll.txt');

File handles in Perl are normally uppercased.

open(POLL, 'poll.txt') or die "Cannot open poll.txt: $!";

> %votes = ();
> $numrecords = 0;

my %votes;
my $numrecords = 0;

> while(<poll>) {
>     chop;

chomp() is better

>     ($foo, $bar) = split(/\|/, $_);

my ($foo, $bar) = split /\|/;

>     $votes{$foo} = $bar;
>     $numrecords++;
> }
> close(poll);
> open(poll, '>>poll.txt');

open(POLL, '>>poll.txt') or die "Cannot open poll.txt for append: $!";

You're now appending to the file, rather than replacing the contents.
I doubt that that was what was intended. But then, the specification
was vague enough.

> print(poll "$numrecords\n");
> close(poll);

There was talk about 'processing' the lines. I'd probably have chosen a
different strategy than you did.


open input file for read
open output file for write
for each line in input file
	count
	process
	write to output file
close input and output files
rename output file to input file

Of course, there's a bit of a run-on sentence in the specification,
whcih could mean that the only thing written out would be the count.
Or maybe the count and the processed lines. Or maybe something else.
But I don't see a need for a hash anywhere.

Of course, the number of records can be directly determined, either by
examining $. at the end of the loop, or by just doing something like:

my $n_lines = scalar (<POLL>);

unless the file is large.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd.   | from a rich salesperson.
NSW, Australia                  | 


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

Date: Tue, 07 Nov 2000 04:49:34 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Help again needed (not so ambitious this time)  :-)
Message-Id: <yRLN5.220$Bf7.188636672@news.frii.net>

In article <slrn90e6d0.495.tadmc@magna.metronet.com>,
Tad McClellan <tadmc@metronet.com> wrote:
>On Mon, 06 Nov 2000 21:38:04 GMT, Chris Fedde 
>   <cfedde@fedde.littleton.co.us> wrote:
>
>>alternately put a '#' in front of the use strict line.
>
>
>I turn up the volume of my car radio to fix "funny noises"
>that the car makes. Seems to work good...
>
>:-)
>
>

When I was 18 a friend had an old Fiat 128 sedan. There was this funny
light on the dash that kept comming on that said "Press." Every time the
light came on he would press the gas and the light went off. 

Why solve the problem when there is an easy quick fix? ;-)
-- 
    This space intentionally left blank


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

Date: Tue, 7 Nov 2000 10:48:13 +0100
From: "Michael Guenther" <MiGuenther@lucent.com>
Subject: Re: Help again needed (not so ambitious this time)  :-)
Message-Id: <8u8j47$mk5@nntpb.cb.lucent.com>


>while(<TEST>) {
>  chomp;
>  my($first_name, $middle_initial, $last_name) = split /\|/;
>  print "Hi, my name is $first_name $middle_initial $last_name\n";
>}


As cool as it is to work with implicit variables
You should always think about for what your code is used for.
 1 for your own on way use never looks at and no one else will see it.
    There do what you want.


Whenever the code shall be uses for a second time make the code readable an
understandable. have a look at

http://www.perl.com/pub/doc/manual/html/pod/perlstyle.html

have fun ...





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

Date: Tue, 07 Nov 2000 03:28:28 GMT
From: wmarvel@my-deja.com
Subject: Re: help w/linux RH6.2 perl script
Message-Id: <8u7ssm$hhs$1@nnrp1.deja.com>

In article <pynN5.190$Bf7.170932224@news.frii.net>,
  cfedde@fedde.littleton.co.us (Chris Fedde) wrote:
> In article <8u1mbr$oc8$1@nnrp1.deja.com>,  <wmarvel@my-deja.com>
wrote:
> >/home/me/foo
> >
> >#!/usr/bin/perl
> >print("this and that\n");
> >
> >Gives the bash interpreter.
> >Yet the "> perl foo" works.
> >
> >HELP, TIA.
> >
>
> did you set the execute bit?
>
> --
>>
>> Yes, chmod +x foo in the PWD
>>
>> Solution: in RH6.2 the /etc/profile does not concatonate the
>>           PWD (ie: ./) in the standard PATH variable. So I added
>>           the statement
>>           PATH="$PATH:/usr/X11R6/bin:."
>>           so that the command of "foo" would find the correct
>>           executable.
>>
>>           Thanks for your help.
>>
>> W.Marvel


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 07 Nov 2000 04:27:56 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: help w/linux RH6.2 perl script
Message-Id: <gxLN5.219$Bf7.189989376@news.frii.net>

In article <8u7ssm$hhs$1@nnrp1.deja.com>,  <wmarvel@my-deja.com> wrote:
>In article <pynN5.190$Bf7.170932224@news.frii.net>,
>> did you set the execute bit?
>>
>> --
>>>
>>> Yes, chmod +x foo in the PWD
>>>
>>> PATH="$PATH:/usr/X11R6/bin:."

Personally I don't like having dot on my path. I've just gotten used to
typing ./foo and the like.  But if you must do it, putting it at the end
is safest.
-- 
    This space intentionally left blank


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

Date: Tue, 07 Nov 2000 04:41:06 GMT
From: "Paulgee" <paul.g@cableinet.co.uk>
Subject: HELP Winows NT Mail::Sender
Message-Id: <CJLN5.9882$aT1.924969@news3.cableinet.net>

Hi all
       I am trying to get script.pl to send mail from a NT server it has
activestate installed but perl cannot find the dir where sender.pm is
installed, is the answer to push another search location onto the @INC array
and if so can anyone tell me the default directory or a clue where sender.pm
is usualy installed.

I wanted to check that I am not missing something before I contact my ISP.

thanks

paul

p.s
I am using the following from cpan.
        use Mail::Sender;

        $sender = new Mail::Sender {smtp => 'mail.yourdomain.com', from =>
'your@address.com'};
        $sender->MailFile({to => 'some@address.com', subject => 'Here is the
file',
                       msg => "I'm sending you the list you wanted.",
                           file => 'filename.txt'});







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

Date: Tue, 07 Nov 2000 02:45:08 GMT
From: pyrodex@knology.net (Richie Crews)
Subject: Help with a script to parse Powerpoint files in unix
Message-Id: <U0KN5.1211$2X3.210862@news-east.usenetserver.com>

I am using OLE::Storage (a unix module) to read the streams of the pictures 
stored inside of a powerpoint presentation. However the images come out in 
one huge binary file. Anyone have any suggestion on a better way to do this 
or a method to split the file into seperate images?


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

Date: Tue, 07 Nov 2000 02:48:24 GMT
From: pyrodex@knology.net (Richie Crews)
Subject: Re: large file size
Message-Id: <Y3KN5.1221$2X3.210862@news-east.usenetserver.com>

josef.moellers@fujitsu-siemens.com (Josef Moellers) wrote in 
<3A06D55E.DCBC2DF1@fujitsu-siemens.com>:

>Dave's box wrote:
>> 
>> I have a 4 gb file that I can't open with   "open(LOG, "$log") || die
>> "Unable to open $log\n";
>> Does perl have a file size limitation?   When I split the file in 2 it
>> will work .  Thanks
>
>Perl may not, but the underlying OS may ...
>

I know in solaris 2.6 there is a 2.14 gig limit with the shells provided 
for root... Ive run into it myself and called sun about it and they said 
wow a new bug... not sure in solaris 2.7 But try tcsh only way i could go 
over 2gig


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

Date: Tue, 07 Nov 2000 03:52:18 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: large file size
Message-Id: <S%KN5.781$FG.47144@eagle.america.net>

On Tue, 07 Nov 2000 02:48:24 GMT, Richie Crews <pyrodex@knology.net> wrote:
>josef.moellers@fujitsu-siemens.com (Josef Moellers) wrote in 
><3A06D55E.DCBC2DF1@fujitsu-siemens.com>:
>
>>Dave's box wrote:
>>> 
>>> I have a 4 gb file that I can't open with   "open(LOG, "$log") || die
>>> "Unable to open $log\n";
>>> Does perl have a file size limitation?   When I split the file in 2 it
>>> will work .  Thanks
>>
>>Perl may not, but the underlying OS may ...
>
>I know in solaris 2.6 there is a 2.14 gig limit with the shells provided 
>for root... Ive run into it myself and called sun about it and they said 
>wow a new bug... not sure in solaris 2.7 But try tcsh only way i could go 
>over 2gig

The original poster didn't say he had a problem with the shell.  The
original poster also made it clear that the underlying OS handles
large files just fine.  The problem is with perl.  That was pointed
out in this thread already by another poster.  

-- 
Garry Williams

$ perl -V
 ...
Characteristics of this binary (from libperl): 
  Compile-time options: USE_LARGE_FILES


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

Date: 7 Nov 2000 09:30:16 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Log.pm did not return a true value
Message-Id: <8u8i38$uti$1@lublin.zrz.tu-berlin.de>

Jeff Zucker  <jeff@vpservices.com> wrote in comp.lang.perl.misc:
>dick dijk wrote:

>> How can I make it work?
>
>By following the instructions as listed in perldiag: put "1;" at the end
>of the file to be included (without the quotes).

As it happens, it even works with the quotes.

Anno


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

Date: 7 Nov 2000 08:39:46 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Looking for idiom for getting value from @ARGV, or a default
Message-Id: <slrn90ffui.ctp.abigail@tsathoggua.rlyeh.net>

On Tue, 07 Nov 2000 01:24:03 GMT, Martien Verbruggen (mgjv@tradingpost.com.au) wrote in comp.lang.perl.misc <URL: news:<slrn90emdm.7ck.mgjv@verbruggen.comdyn.com.au>>:
++ On Mon, 06 Nov 2000 23:59:03 GMT,
++ 	Uri Guttman <uri@sysarch.com> wrote:
++ >>>>>> "BL" == Bart Lateur <bart.lateur@skynet.be> writes:
++ > 
++ >  BL> Uri Guttman wrote:
++ >  >> $s = defined( $ARGV[0] ) ? shift : 'default' ;
++ > 
++ >  BL> @ARGV is a special case, an array for which it's garanteed that no
++ >  BL> existing item can be undefined. If an element exists, it is defined. So
++ >  BL> you can do:
++ > 
++ >  BL> 	$s = @ARGV ? shift : 'default';
++ > 
++ > i note that in another post. normally you can't have an undefined value
++ > in @ARGV from the shell, but someone could be messing around with @ARGV
++ > in a BEGIN block.
++ 
++ Yes, I read that after sending this post as well. But then, anyone
++ doingthat gets what they deserve :). Or at least, anyone doing that
++ probably knows what they are doing.

But only a handful of people never download something from CPAN and use it.




Abigail


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

Date: Tue, 7 Nov 2000 21:36:06 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Looking for idiom for getting value from @ARGV, or a default
Message-Id: <slrn90fmom.boe.mgjv@martien.heliotrope.home>

On 7 Nov 2000 08:39:46 GMT,
    Abigail <abigail@foad.org> wrote:
> On Tue, 07 Nov 2000 01:24:03 GMT, Martien Verbruggen 
>   (mgjv@tradingpost.com.au) wrote:
> ++ On Mon, 06 Nov 2000 23:59:03 GMT,
> ++    Uri Guttman <uri@sysarch.com> wrote:
> ++ > 
> ++ > i note that in another post. normally you can't have an undefined value
> ++ > in @ARGV from the shell, but someone could be messing around with @ARGV
> ++ > in a BEGIN block.
> ++ 
> ++ Yes, I read that after sending this post as well. But then, anyone
> ++ doingthat gets what they deserve :). Or at least, anyone doing that
> ++ probably knows what they are doing.
> 
> But only a handful of people never download something from CPAN and use it.

I'm sorry.. I don't get what you mean...

or do you mean that many people download stuff from CPAN, without
knowing how it works, internally? Maybe. But anyone deliberately
assigning something to @ARGV is something different from using a CPAN
module. And, anyone copying code without knowing what it does, still
gets what they deserve. Or do you mean that you know of CPAN modules
that modify @ARGV? I'm a bit confused.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd.   | make up 3/4 of the population.
NSW, Australia                  | 


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

Date: Tue, 07 Nov 2000 01:11:33 GMT
From: David McMullen <davidmac@austin.rr.com>
Subject: Monitoring PIDs
Message-Id: <3A0755C9.46E28D8B@austin.rr.com>

I am trying to monitor a process and have it notify me when it is
finished.  I'm either missing something or close and don't know it.  Any
help is appreciated.



$i = (system "ps -ef | grep find | grep -v grep")
print $i

returns 0 while process is running and 256 when it is not running.
What is the best way to monitor the process.


TIA

davidmac
newbie


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

Date: 7 Nov 2000 10:57:26 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: pass by reference to C
Message-Id: <8u8n6m$v55$1@lublin.zrz.tu-berlin.de>

 <vidulats@yahoo.co.uk> wrote in comp.lang.perl.misc:
>My Perl file is like this:
>#!/usr/bin/perl -w
>use bytes;
>@a = (1, 2, 3);
>location (\@a);
>
>In the "xs" file I wrote the location function which prints the address 
>and value of its passed elements:
>
>#include "EXTERN.h"
>#include "perl.h"
>#include "XSUB.h"
>
>location(char *x)
>{
>	int i;
>	for (i=0; i<=2; i++,x++)
>		printf ("%d element = %c, address=%d, address = %
>x\n",i,*x,x);
>}
>
>MODULE = bytes		PACKAGE = bytes		
>
>void
>location(x)
>	char *x
>
>When I execute this program that C function prints some junk values.

Yes, because what Perl passes to you is not the string itself, but
a data structure known as a scalar value (sv) that contains the string
(and other things associated with a Perl scalar).  To access the
actual string you will need (one of) the SvPV macro(s).  perldoc perlguts
explains that in detail.  Other pertinent man pages are perlxs, perlxstut,
and perlapi.

Anno


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

Date: Tue, 07 Nov 2000 10:40:52 GMT
From: vivekvp <vivekvp@spliced.com>
Subject: Perl and mysql
Message-Id: <8u8m7k$4vh$1@nnrp1.deja.com>

 Hello,

I am not very familiar with perl let alone mysql.

What I am trying to do is create an html form that gets, a unique ID,
name, phone number and email - store that data, and be able to retrieve
that data via any query.

But I am not sure what any syntax would be used?  How do I pass the
data?  How do I retrieve it?

Any help or direction?

Thanks,

V


--
He who fights and runs away, lives to run another day!


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 06 Nov 2000 23:34:48 -0500
From: Bill Wang <wangwei18@163.net>
Subject: perl document needed
Message-Id: <3A078668.F5A9BFE2@163.net>

hi, perl veterans, I want a perl reference/guide, could you tell me
where to find them or email to me? my email address is
www0028@garnet.acns.fsu.edu .

Bill



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

Date: Tue, 07 Nov 2000 05:14:36 GMT
From: sjs@yorku.ca (Steven Smolinski)
Subject: Re: perl document needed
Message-Id: <slrn90f7ph.746.sjs@ragnar.stevens.gulch>

Bill Wang <wangwei18@163.net> wrote:
> hi, perl veterans, I want a perl reference/guide, could you tell me
> where to find them

I would install perl, and use the online docs.  They are the most complete
reference, are the most up to date, and will be local so you won't have to 
suffer through "flipping web crud."

You headers claim you run Windows.  You can get a shiny new perl with all
the docs included at http://www.activestate.com.

If you must, you can find the flipping web crud at 
http://www.perl.com/pub/v/documentation

>                    or email to me? my email address is
> www0028@garnet.acns.fsu.edu .

Done.

Steve


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

Date: 7 Nov 2000 02:48:47 GMT
From: Jonathan.L.Ericson@jpl.nasa.gov (Jon Ericson)
Subject: Re: perl gallery script
Message-Id: <8FE4BB352JonathanLEricsonjpln@137.78.50.25>

edward_whittaker@bigfoot.com (Ed Whittaker) wrote:
>I am looking for a perl script to improve the running of a photo gallery
>at www.swan.ac.uk/AU/hiking (see photos).  The ideal script would be
>free, generate thumbs (ideal but not essential), be easy to run,
>annotate images and be able to sort / search due to the number of
>images. 

If you are interested in obtaining a script rather than writing it, you 
should use a search engine.  If are looking for examples of how to write 
such a script, I suggest http://www.stonehenge.com.

Jon


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

Date: 7 Nov 2000 04:08:21 GMT
From: Todd McLaughlin <toddm@waltz.rahul.net>
Subject: Perl SendMessage() ?
Message-Id: <8u7v7l$sc1$1@samba.rahul.net>


Is there a Win32 library that has FindWindow() and SendMessage()?  Looked on 
ActiveState's site but didn't see anything.

Thanks!
Todd


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

Date: 7 Nov 2000 10:36:39 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Problem reading a binary file
Message-Id: <8u8lvn$v3q$1@lublin.zrz.tu-berlin.de>

 <fgont@my-deja.com> wrote in comp.lang.perl.misc:
>Hi!
>
>I have an executable file named "genvoto.exe", and tried to read its
>contents in a variable.
>
>I do it this way:
>
>$thebin= "genvoto.exe";
>open(thebin);
>sysread(thebin, $binoutput, 19968);
>
>
>The problem is that the variable $binoutput only gets 1600 bytes instead
>of 19968. The 1600 bytes it gets are Ok _(I compared them with the
>contents of the original file), but I don't know why I get only 1600
>bytes, and not the 19968 I should get.
>
>P.S.: I tried using read, but the same problem appears...

While I managed to remain in blissful ignorance of all things Windowish,
there's been enough mumble about binmode() in the group for me to mumble
along: You want binmode().

Anno


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

Date: Tue, 07 Nov 2000 08:56:59 GMT
From: percl@my-deja.com
Subject: Q: Problem with CPAN.pm: Could not gzopen
Message-Id: <8u8g4p$oi$1@nnrp1.deja.com>

Maybe a real newbie question this, please dot flame me, as I have tried
to find the answer with no success.

Trying to install additional modules with the CPAN module. First it
worked OK, but after configuring the module, I got "Could not
gzopen ..." on every module. After removing Config.pm and starting over
again, it all worked fine.

What am I doing wrong here?

Yours
Per Christian Lied


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 07 Nov 2000 04:00:10 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: read last line only...
Message-Id: <x74s1kh1o6.fsf@home.sysarch.com>

>>>>> "YC" == Yanick Champoux <yanick@babyl.sympatico.ca> writes:

  YC> Enjoyer <enjoyer@aol.com> wrote:
  YC> : I'm trying to read the last line of a file only, using print, any ideas ?

  YC> 	perl -ne'print if eof' yourfile

use File::ReadBackwards ;

$fh = File::ReadBackwards( 'foo' ) ;

print $fh->readline() ;


uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Tue, 07 Nov 2000 03:08:37 GMT
From: acroapl@my-deja.com
Subject: Re: Search engine woes...
Message-Id: <8u7rni$gju$1@nnrp1.deja.com>

In article <t0emjp3qcc3ee0@corp.supernews.com>,
  <mischief@velma.motion.net> wrote:
> acroapl@my-deja.com wrote:
> > how can you match strings w/o capitaliztion being checked?  Is there
a
> > function like in C?
>
> $string = lc($string);
>
> Does that work for ya?
>
> --
> Christopher E. Stith
> mischief@motion.net
>

thanks


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 07 Nov 2000 05:18:16 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Splitting variable length fixed records
Message-Id: <sgMN5.809$FG.48231@eagle.america.net>

On Mon, 6 Nov 2000 16:48:57 +1300, Peter Sundstrom
<peter.sundstrom@eds.com> wrote:
>I have a file of fixed records of variable length (newline
>terminated), eg:
>
>F1F2..F120
>
>Where
>
>F1 is 120 bytes F2 up to F120 is 60 bytes.

 perl -lne'$"="\n";s/(.{6})//;@x=$1;push(@x,/.{3}/g);print"@x"'

-- 
Garry Williams


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

Date: Tue, 07 Nov 2000 10:35:31 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Why is my hash coming untied?
Message-Id: <2lmf0tgqh9vr47gv998vo1afdd1m07g9vi@4ax.com>

Daniel Berger wrote:

>sub getHash{
>   tie %myHash, "Tie::IxHash";
>   %myHash = whatever...;
>
>   #return \%myHash;    - retains tie
>   return %myHash;      - comes untied
>}

Of course it becomes untied. You are not returning a hash, you are
returning a key/value pairs list.

Same situation here:

	%copy = %tied_hash;

Even though %tied_hash may be a tied hash, %copy will be a
straightforward, untied copy of that hash.

-- 
	Bart.


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

Date: Tue, 07 Nov 2000 04:55:36 GMT
From: paulb@shell1.aracnet.com (Paul Buder)
Subject: Re: why it's called a "hash" (and a whole lot more)
Message-Id: <cXLN5.7786$Qz2.277782@typhoon.aracnet.com>

Jeff Pinyan <jeffp@crusoe.net> writes:

>The key 'jeff', for instance, has a hash value of 4045365.  In a hash with
>8 buckets, it would be placed in bucket 5.  (Perl's hash tables have
>buckets in powers of 2.)

I'm no complex algorithms wiz which may be where this is going but am
curious...

What happens when Perl decides 8 buckets aren't enough? Does it have 
to recalculate all of the existing values to place them into new buckets?



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

Date: Tue, 7 Nov 2000 00:35:36 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: why it's called a "hash" (and a whole lot more)
Message-Id: <Pine.GSO.4.21.0011070035010.25313-100000@crusoe.crusoe.net>

[posted & mailed]

On Nov 7, Paul Buder said:

>Jeff Pinyan <jeffp@crusoe.net> writes:
>
>>The key 'jeff', for instance, has a hash value of 4045365.  In a hash with
>>8 buckets, it would be placed in bucket 5.  (Perl's hash tables have
>>buckets in powers of 2.)
>
>What happens when Perl decides 8 buckets aren't enough? Does it have 
>to recalculate all of the existing values to place them into new buckets?

It needn't recalculate the hash value -- that's a constant.  All it has to
do is take that hash value modulus the NEW number of buckets.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/



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

Date: 7 Nov 2000 06:30:15 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: why it's called a "hash" (and a whole lot more)
Message-Id: <8u87hn$945$1@towncrier.cc.monash.edu.au>

I'm late to this thread, so apologies in advance if this has already been
covered...

Jeff Pinyan <jeffp@crusoe.net> writes:
>>> (Perl's hash tables have buckets in powers of 2.)
>>
>> What happens when Perl decides 8 buckets aren't enough? Does it have 
>> to recalculate all of the existing values to place them into new buckets?
>
>It needn't recalculate the hash value -- that's a constant.  All it has to
>do is take that hash value modulus the NEW number of buckets.

 ...and the choice of multiples-of-two for bucket sizes means that this
modulus operation is very efficient. If you're currently using
2**N buckets, the modulus with respect to that number is just the lowest
N bits of the hash value itself.

That is: the bucket index for $hashval is given by: $hashval & $mask,
where $mask has the -- unsigned -- value (1<<N)-1. So the bucket look-up
can be very fast, because it requires only bitwise operations.

Damian


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

Date: 07 Nov 2000 03:17:28 GMT
From: mattbonness@aol.com (MattBonness)
Subject: Win32 question
Message-Id: <20001106221728.11504.00000076@ng-df1.aol.com>

Does anyone know if it's possible to run multiple different versions of Perl on
the same Windows NT server simultaneously?  I have software applications that
are only compatible with either Perl version 5.2 or 5.6, respectively.  Is
there a way to do this without configuring another server or rewriting all my
code?  I would create another partition on my hard drive but that doesn't
address the system registry issue.  Any ideas, Perl gurus?

-Matt


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 4828
**************************************


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