[17535] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4955 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 23 09:05:34 2000

Date: Thu, 23 Nov 2000 06:05:11 -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: <974988310-v9-i4955@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 23 Nov 2000     Volume: 9 Number: 4955

Today's topics:
    Re: (newB): What would cause line 1 fail? (Eric Bohlman)
        Any good perl tutorial online? <paul@bnospaammb.cc>
    Re: Any good perl tutorial online? <thg@users.sourceforge.net>
        CGI.pm upload problems mikhailgee@my-deja.com
    Re: CGI.pm upload problems (Andy Smith)
        Coloured text in Win32 CMD window <jamesmckay@MailAndNews.com>
        easiest way to annotate .jpgs? dtbaker_dejanews@my-deja.com
    Re: External run under diffrend user. (Martien Verbruggen)
    Re: How do i use head($url)? <nospam@david-steuber.com>
        How do you determine the current stack frame depth? <c.manley@chello.nl>
    Re: How do you determine the current stack frame depth? <W.Hielscher@mssys.com>
    Re: If/else problem. <johngros@Spam.bigpond.net.au>
    Re: Making data persist under modperl? <philipg@atl.mediaone.net>
        newbie question <m.r.davies@virgin.net>
    Re: Problem r/w binary files toby_m_kramer@hotmail.com
    Re: Problem reading/writing binary file toby_m_kramer@hotmail.com
        problem with pipes in system calls <hugo@fractalgraphics.com.au>
    Re: problem with pipes in system calls (Rafael Garcia-Suarez)
    Re: Signals <bart.lateur@skynet.be>
    Re: Simple Question :) <geoff-at-farmline-dot-com@127.0.0.1>
        Socket connection - TCP client. <kalinabears@hdc.com.au>
    Re: Sort strings before numbers <bart.lateur@skynet.be>
    Re: splitting a word <sumus@aut.dk>
        Subroutine Stuff??? <vidulats@yahoo.co.uk>
    Re: Subroutine Stuff??? <sumus@aut.dk>
        text::wrap richard_dobson@my-deja.com
    Re: text::wrap (Tony L. Svanstrom)
    Re: Tom Christiansons' 'style' <sumus@aut.dk>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 23 Nov 2000 07:19:23 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: (newB): What would cause line 1 fail?
Message-Id: <8vigdr$q79$1@bob.news.rcn.net>

Chris Stith <mischief@velma.motion.net> wrote:
> Any CGI (this is a FAQ, BTW, and isn't a Perl issue) needs to return
> HTTP headers according to the HTTP specifications. An HTTP header

Actually, it needs to return CGI headers according to the CGI
specification.  CGI headers are similar to, and in *some* cases the same
as, HTTP headers, but there are subtle differences.  It's important to
remember that we're talking about two distinct interfaces here: HTTP is an
interface between a server and a user agent (such as a browser); CGI is an
interface between a server and another program that effectively extends
the server.


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

Date: Thu, 23 Nov 2000 03:05:27 -0800
From: Paul <paul@bnospaammb.cc>
Subject: Any good perl tutorial online?
Message-Id: <4fup1toiig32boscbmadis1341hhns30u5@4ax.com>

Any good perl tutorial online?
Thanks.




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

Date: 23 Nov 2000 15:02:28 +0100
From: Thomas Geffert <thg@users.sourceforge.net>
Subject: Re: Any good perl tutorial online?
Message-Id: <jd66lerdl7.fsf@eric.huygens.org>

Paul <paul@bnospaammb.cc> writes:

> Any good perl tutorial online?
> Thanks.

Have a look at perl.com

http://www.perl.com/pub/2000/10/begperl1.html

Success

  Thomas


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

Date: Thu, 23 Nov 2000 06:37:24 GMT
From: mikhailgee@my-deja.com
Subject: CGI.pm upload problems
Message-Id: <8vidv5$t73$1@nnrp1.deja.com>

I was wondering if anyone knows why my upload script using CGI.pm is
changing the uploaded filename whenever there are single quotes in the
filename. For instance a filename like "Billie's Song.mp3" is coming up
as "Billie::s Song.mp3".

Thanks,
M G


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


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

Date: Thu, 23 Nov 2000 12:51:51 GMT
From: asmith@hsonline.net (Andy Smith)
Subject: Re: CGI.pm upload problems
Message-Id: <3a1d114a$0$35389$7bbe8f7d@news.hsonline.net>

It could be getting hosed in the http encoding. Check to see if the
single quote is allowed.

Andy 

On Thu, 23 Nov 2000 06:37:24 GMT, mikhailgee@my-deja.com wrote:

>I was wondering if anyone knows why my upload script using CGI.pm is
>changing the uploaded filename whenever there are single quotes in the
>filename. For instance a filename like "Billie's Song.mp3" is coming up
>as "Billie::s Song.mp3".
>
>Thanks,
>M G
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.



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

Date: Thu, 23 Nov 2000 06:24:51 -0500
From: James <jamesmckay@MailAndNews.com>
Subject: Coloured text in Win32 CMD window
Message-Id: <3A27AA14@MailAndNews.com>

Hi all,
      Does anyone know of a way of outputing coloured text to a Dos window 
on 
WinNT via ActivePerl?
Thanks in advance
James



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

Date: Thu, 23 Nov 2000 05:40:17 GMT
From: dtbaker_dejanews@my-deja.com
Subject: easiest way to annotate .jpgs?
Message-Id: <8viak1$r8c$1@nnrp1.deja.com>

I have been attempting to use Image::Magick to do some re-sizing and
annotation of .jpgs and having some limited success. I have found the
Magick module powerful, but a real pain to install and even harder to
use becaus of limited documentation and dependancies on external
programs.

I would like to know if there are other perl modules that people would
recommend that can do re-size and annotations on .jpg images. all I am
trying to do is insert a simple copyright text....

If ImageMagick is the only known solution, can anyone explain from start
to finish with a simple example, of what downloads are required to get
the annotate() method to work correctly. I have installed the 5.2.4
version of ImageMagick, and the resize is working fine, but it dies
whenever I attempt annotate().

thanx,

Dan


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


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

Date: Thu, 23 Nov 2000 18:18:08 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: External run under diffrend user.
Message-Id: <slrn91ph5g.imr.mgjv@martien.heliotrope.home>

On Thu, 23 Nov 2000 05:38:01 +0100,
	Daniel <fire@fshosting.net> wrote:
> Hello as most people here i got a question to ;o)
> 
> i want to run EXTERNAL script ( shell scripts ) under a system USER.
> how do i do this ?

Use some system specific method to do this. It depends on which system
you're on. You probably should ask on a group that talks about your OS.

Perl has some support for Unices. Read the perlsec documentation, and
about three or four other postson this group over the last few days.

But, I'll tell you what I told the others: Do NOT do it if you need to
ask this question. 

Just

don't

 .

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: Thu, 23 Nov 2000 13:09:09 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: How do i use head($url)?
Message-Id: <m3aeaqrg23.fsf@solo.david-steuber.com>

"EM" <me@privacy.net> writes:

' Under LWP Simple on CPAN i found this
' 
' head($url)
 ...
' how exactly do i use this?
' i tried this
 ...
' $url = "http://www.ericscgi.com/?debug";
' $file = "./debug.html";
' $response = head($url);

Two things.  The docs say head() returns a list.  You are storing the
return value in a scaler.  So you are just getting a success code.  Or
should be.  You should look at what the actual response is to that
particular request:

david@solo:> telnet www.ericscgi.com 80
Trying 216.74.72.211...
Connected to www.ericscgi.com.
Escape character is '^]'.
HEAD /?debug HTTP/1.0
Host: www.ericscgi.com

HTTP/1.1 200 OK
Date: Thu, 23 Nov 2000 13:01:26 GMT
Server: Apache/1.3.12 (Unix) PHP/4.0.0 mod_perl/1.24 mod_frontpage/3.0.4.3
Connection: close
Content-Type: text/html

Connection closed by foreign host.
david@solo:>

-- 
David Steuber | Perl apprentice.  The axe did not stop the
NRA Member    | mops and buckets from flooding my home.
ICQ# 91465842
***         http://www.david-steuber.com/          ***


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

Date: Thu, 23 Nov 2000 12:36:44 +0100
From: Craig Manley <c.manley@chello.nl>
Subject: How do you determine the current stack frame depth?
Message-Id: <3A1D014C.56BD95D3@chello.nl>

Hi,

For logging purposes (using indentations) I'ld like to know the current
stack frame depth. Is this possible in Perl?

For example:

# depth = 0;
&bla();

sub bla {
 # depth = 1
 &foo();
}

sub foo {
 # depth = 0
}

-Craig Manley.


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

Date: Thu, 23 Nov 2000 13:20:02 +0100
From: Wolfgang Hielscher <W.Hielscher@mssys.com>
Subject: Re: How do you determine the current stack frame depth?
Message-Id: <3A1D0B72.F911240@mssys.com>

Craig Manley wrote:
> For logging purposes (using indentations) I'ld like to know the current
> stack frame depth. Is this possible in Perl?

You should read the documentation of the function  caller().
Searching CPAN for "stack" you'll find modules like Devel-StackTrace.

Cheers
   Wolfgang


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

Date: Thu, 23 Nov 2000 06:46:48 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: If/else problem.
Message-Id: <s33T5.460$GW5.3300@news-server.bigpond.net.au>

Well $pass should be the password mailed to the user when the file is
written. I want to compare the value written to the file with what they
entered when they activate the account. The data I am trying to read is the
value of the time function that was written to the file.
Hopefully all this will be clearer with more of the surrounding code.
$pass = $form_data{'pass'};
$pass =~ tr/A-Z/a-z/;
$path = "C:/Program Files/G6FTP/";
$datapath = "ftpdatabase/";
$file = $path.$datapath.$form_data{'login'}.".txt";
$pwd = time;
if ($form_data{'action'} eq "new")
 {
 &sendmail;
 &oops("Unable to write to FTP database.<p>Please re-create account") unless
open BOGUS,"+>>$file" or die "Cannot open file: $!";
 print BOGUS $pwd;
        close BOGUS;

 }else{
  &verifyuser;
 }
sub verifyuser
{
&oops("Unable to open FTP User database") unless open BOGUS,"+>>$file" or
die "Cannot open file: $!";

 if ($pass eq <BOGUS>){
  goto success;
  }else{





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

Date: Thu, 23 Nov 2000 05:44:07 GMT
From: "Philip Garrett" <philipg@atl.mediaone.net>
Subject: Re: Making data persist under modperl?
Message-Id: <H82T5.9624$XX6.1805207@typhoon.southeast.rr.com>

William Gray <smiths@alumni.cse.ucsc.edu> wrote in message
news:slrn91p0ir.8dm.smiths@alumni.cse.ucsc.edu...
> I have a function which selects the same data from the DB over and over.
> I'm running under mod_perl and I would like to select the data once
> when the function is first called and then use the copy in memory after
> that.  I am confused about how to define a variable under mod_perl which
> will not get destroyed when my function returns.  This must be obvious,
> but I haven't found any docs that explain it yet.

Just use an explicit package name to reference it.  Ex:
$MyApp::greeting = "Hello, world";

Once it's set, it won't go away until you undef if.  You probably want to
initialize it in your mod_perl startup script, that way the data is
generated once, and then inherited by the children processes.

hth,
p




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

Date: Thu, 23 Nov 2000 11:37:07 -0000
From: "Mark" <m.r.davies@virgin.net>
Subject: newbie question
Message-Id: <Ih7T5.7037$17.107625@stones>

Hi

I'm after a free form2mail script for a unix server that has about 17 boxes
for submital (all at the same time)
it's basically a quotation form but loads of varibles depend the cost of the
quote,

all the ones i've found are 3 boxes , name , address, and comments
a dropdown box would be handy as well but not neccessary,

am i asking too much or are there any ones like this?

Mark




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

Date: Thu, 23 Nov 2000 06:11:31 GMT
From: toby_m_kramer@hotmail.com
Subject: Re: Problem r/w binary files
Message-Id: <8vicej$s8i$1@nnrp1.deja.com>


> > Subject: Re: Problem r/w binary files
>
> [ snip code with no binmode() ]
>
> >                                ...on Win32.
>
> perldoc -f binmode
>

I used binmode and the script is working now.  Thanks!

Toby


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


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

Date: Thu, 23 Nov 2000 06:09:50 GMT
From: toby_m_kramer@hotmail.com
Subject: Re: Problem reading/writing binary file
Message-Id: <8vicbe$s6n$1@nnrp1.deja.com>


> > I have problem reading/writing binary files.
>
> >open (O,">test.dat") or die "Can't open file for writing!\n";
>
> binmode O;
>
> >open (R,"+<test.dat") or die "Can't open file!\n";
>
> binmode R;
>
> > I am using ActivePerl on Win32,
>
> You have my sympathy.
> Read up on this, you'll need it:
> perldoc -f binmode
>
> Petri Oksanen

It works now.  I will read up on binmode.  Thanks!

-Toby


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


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

Date: Thu, 23 Nov 2000 17:39:13 +0800
From: Hugo Bouckaert <hugo@fractalgraphics.com.au>
Subject: problem with pipes in system calls
Message-Id: <3A1CE5C1.469AAB53@fractalgraphics.com.au>

Hi 

I have written a perl program that allows people to convert images files
to postscript and then prints the postscript.
The problem is that I have to make a unix system call (to a SGI machine
running Irix 6.5.8) which does not work. 
The system call is this: 

system ("sgitopnm $filename | pnmtops | lpr -Ptek680");

where 

- sgitopnm converts a Silicon Graphics rgb image to a portable anymap 
- pnmtops converts the anymap image into a postscript and 
- lpr -Ptek780 prints to our printer

This command works perfect in a shell script that I have, but not from a
perl system call.

Then I read that "system" sends everything to standard output, and
indeed I get a lot of text (presumaby the output of the first
conversion) coming to the screen. So I tried it differently, by
capturing the command as a string: 

$printing =`sgitopnm $filename | pnmtops | lpr -Ptek680`;

which works in principle ie 

$ls = `ls`   executes the ls command without problems. 

However, 

$printing =`sgitopnm $filename | pnmtops | lpr -Ptek680`;

does not work - the error is something like "unexpected | at line 2". 

How can I get the above command to work?

Thanks

Hugo  
 


-- 
Dr Hugo Bouckaert
R&D Support Engineer, Fractal Graphics 
39 Fairway, Nedlands Western Australia 6009
Tel: +618 9386 7917
Email:hugo@fractalgraphics.com.au
Web: http://www.fractalgraphics.com.au


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

Date: Thu, 23 Nov 2000 09:55:37 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: problem with pipes in system calls
Message-Id: <slrn91pqdv.mri.rgarciasuarez@rafael.kazibao.net>

Hugo Bouckaert wrote in comp.lang.perl.misc:
> 
> I have written a perl program that allows people to convert images files
> to postscript and then prints the postscript.
> The problem is that I have to make a unix system call (to a SGI machine
> running Irix 6.5.8) which does not work. 
> The system call is this: 
> 
> system ("sgitopnm $filename | pnmtops | lpr -Ptek680");

This is not a system call (at UNIX defines this word), this is the
execution of an external program (in this case, the shell, that will
itself execute your command line).

[snip]
> $printing =`sgitopnm $filename | pnmtops | lpr -Ptek680`;
> 
> does not work - the error is something like "unexpected | at line 2". 

Hmm, its probable that your $filename ends with a \n. You've forgotten
to chomp() it. This error is returned by the underlying shell.

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
print length $^S ? "Just another " : "Perl hacker,\n"; require $0;


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

Date: Thu, 23 Nov 2000 11:53:32 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Signals
Message-Id: <9v0q1tkspbgs9tmnlhlrt8un0fhu605gcg@4ax.com>

fallenang3l@my-deja.com wrote:

>What is HUP signal for? Thank you.

Wrong newsgroup. But, now we're both here: "HUP" is short for "Hang UP".
Now there's a piece of useless information. ;-) It is typically a way to
tell a daemon program to restart, i.e. reread it's configuration files,
through the command "kill".

-- 
	Bart.


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

Date: Thu, 23 Nov 2000 09:17:44 -0000
From: "Geoff Winkless" <geoff-at-farmline-dot-com@127.0.0.1>
Subject: Re: Simple Question :)
Message-Id: <8vinbe$rv6$1@soap.pipex.net>

"Peter Sundstrom" <peter.sundstrom@eds.com> wrote in message
news:8vheqp$3jh$1@hermes.nz.eds.com...
:
: Ron Hartikka <ronh@iainc.com> wrote in message
: news:3A1BDD8B.3B9437B0@iainc.com...
: > First, you need to read perlfaq's and perlre and perlop.
: >
: > Here is one of many ways:
: >
: > $old = "tn_shortname.jpg";
: > ($new = $old) =~ s/^...(.*)/$1/;
:
: Which is the same as doing
:
: ($new = $old) =~ s/^...//;

Why does everyone apparently insist on using regexes for the simplest of
string manipulations?

Surely this has to be slower than substr($old, 3) ? Or am I missing
something?

Geoff




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

Date: Thu, 23 Nov 2000 18:48:44 +1100
From: "Rob" <kalinabears@hdc.com.au>
Subject: Socket connection - TCP client.
Message-Id: <H14T5.2$nT1.564@vic.nntp.telstra.net>

Hi,
Can anyone tell me why the following script always dies at line 10 ?
$@ gives a 'bad service http' error and $! returns an 'unknown error'.
If I change "http(80)" to "daytime(13)" it works fine - as long as I
restrict $host to being either www.hdc.com.au (our proxy server) or
www.kalinabears.com.au (our website, hosted by hdc) - can't connect to the
outside world at any port. BTW, I have other standard scripts (using Socket)
that will open, write to and close connections at port 80 (kalinabears & hdc
only), but will hang if  set to receive anything .
Is this a proxy server problem - if so, how to circumvent it. I can find
nothing in the docs or books that suggests that this might be the problem.
All I wanted to do was to simply see what goes on with these things - 2
weeks later and all I can do is fetch the time. Another guy ran this script
for me (different ISP) and said it returned a heap of html, just like it
should.
Here it is:
#!C:/perl/bin/perl -w
    use IO::Socket;
    $host = "www.kalinabears.com.au";
    $EOL = "\015\012";
    $BLANK = $EOL x 2;
        $remote = IO::Socket::INET->new( Proto     => "tcp",
                                         PeerAddr  => $host,
                                         PeerPort  => "http(80)",
                                        );
        unless ($remote) { die "cannot connect to http daemon on $host: $@
$!" }
        $remote->autoflush(1);
        print $remote "GET /index.html HTTP/1.0" . $BLANK;



        while ( <$remote> ) { print }
        close $remote;

Any ideas welcome.
Cheers,
Rob

--
Visit our website at http://www.kalinabears.com.au




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

Date: Thu, 23 Nov 2000 10:20:21 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Sort strings before numbers
Message-Id: <f3rp1tovjcid2c0umbt53np9746g10fin3@4ax.com>

Holger wrote:

>I'd like to sort the keys of an hash like the following example:
>3a - 45bla - 4vier - Anton - Emil - Zwei - berta - drei - 1 - 2 - 6 - 9 -
>10 - 12 - 35
>Thus, everything that contains a character lexically sorted followed by the
>numbers numerically sorted.
>
>My try looks like this (and seems to work):
>foreach my $key (sort { (($a =~ m/^(\d+)$/) && ($b =~ m/^(\d+)$/)) ?
>$a <=> $b : (($a =~ m/\D/) xor ($b =~ m/\D/)) ?
>$b cmp $a : $a cmp $b } (keys %config) )
>{...}
>
>But it is a little slow, and I guess there might be a way to improve the
>performance?

Yeah. Schwartzian Transform. Ever heard of it? If not, here's a
tutorial.

	<http://www.5sigma.com/perl/schwtr.html>

And I'm not sure your /\D/ is a reliable test. Or isn't 1.25 a number?

My test would involve:

 * test for each item if it's a string (0) or a number number (1)
 * join this with the original item into an anonymous array;
 * compare first these above values. Strings come before numbers.
 * second, if it's  both numbers, do numerical comparison; if it's both
strings, compare alphabetically.
 * Of the sorted list, extract the original item.

In the Schwartzian Transform, you write this upside down: last thing
first.

	@sorted = map { $_->[1] }
	   sort { $a->[0] <=> $b->[0] || ($a->[0] ? $a->[1] <=> $b->[1]
	     : $a->[1] cmp $b->[1] ) }
	   map { [ (/^-?\d+\.?\d*$/ ? 1 : 0), $_ ] } @unsorted;

-- 
	Bart.


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

Date: 23 Nov 2000 14:20:56 +0100
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: splitting a word
Message-Id: <hf4yvn7r.fsf@macforce.sumus.dk>

tadmc@metronet.com (Tad McClellan) writes:

> Why generate 3 leading null fields to discard when you need to discard 4?

As I understand the OP he wanted to split on the first dot:

while ( <STDIN> ) {
    my $temp;
    ( undef, $temp ) = split /\./, $_, 2;
    print $temp;
}

to stay in the splittin mood - or as I would state it:

while ( <STDIN> ) {
    s/.*?\.//;
    print;
}


-- 
Jakob Schmidt
http://aut.dk/orqwood
etc.


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

Date: Thu, 23 Nov 2000 12:30:05 -0000
From: <vidulats@yahoo.co.uk>
Subject: Subroutine Stuff???
Message-Id: <t1q3edeko1k55c@corp.supernews.com>

Hi PerlExperts,

My question is:
I want to write one subroutine like
Receive ($Val1, %Elements, $Time);

Inside the Receive function :
sub Receive
{
   ($myv, %mye, $myt) = @_;
   # Here I want to modify the values of the "mye" hash
   and I want that the same values to the reflected back to the calling    
function.
   #But I don't want
   %Elements = Receive ($Val1, %Elements, $Time)
   # How do I do that

}

I tried in the following way:
In the following program:

#!/usr/bin/perl5 -wl
use Tie::IxHash;
tie( %Message, 'Tie::IxHash',
	'Message_Type' => 0,
	'Message_discriminator' => 0,
	'Message_Value' => 0,
	'Message_Data' => 0
	);
$Status = Receive1(%Message);

foreach $val (sort keys %Message)
{ print "\n $val , $Message{$val}";}
print "\nStatus = ", $Status;

$Status = Receive2(%Message);
foreach $val (sort keys %Message)
{	print "\n $val , $Message{$val}"; }
print "\nStatus = ", $Status;

sub Receive1
{	$i = 1;
	foreach $val (sort keys %$_)
	{	$$_{$val} = $i;
		$i++;
	}
	return 0;
}

sub Receive2
{	$i = 1;
	foreach $val (sort keys %Message)
	{	$Message{$val} = $i;
		$i++;
	}
	return 0;
}

When I'm printing the values of the Hash after Receive1 subroutine I'm 
getting output as all zero's.
And After the Receive2 subroutine I'm getting output as per my requirement.
I know in Receive2 subroutine I used the same name of the passed paramter, 
that's why I'm getting the values.

Will any one guide me.

Thanks in advance,
Regards,
Vidula

--
Posted via CNET Help.com
http://www.help.com/


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

Date: 23 Nov 2000 15:00:36 +0100
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: Subroutine Stuff???
Message-Id: <em02vldn.fsf@macforce.sumus.dk>

<vidulats@yahoo.co.uk> writes:

> I want to write one subroutine like
> Receive ($Val1, %Elements, $Time);
> 
> Inside the Receive function :
> sub Receive
> {
>    ($myv, %mye, $myt) = @_;
>    # Here I want to modify the values of the "mye" hash
>    and I want that the same values to the reflected back to the calling    
> function.
>    #But I don't want
>    %Elements = Receive ($Val1, %Elements, $Time)
>    # How do I do that
> 
> }

I haven't reviewed all of your code carefully but the answer to your question
is "by passing it by reference".

check the perlreftut if you want to really know what you're doing, but here's
a quick template:

The call:

receive( $x, \%message, $y );
 ...

The sub

sub receive
{
  my ( $some, $hashref, $other ) = @_;

  $hashref->{ key_1 } = "Hello!"; # this sets $message{ key_1 }
  print $hashref->{ key_2 };      # this prints $message{ key_2 }
  ...
}

HTH

-- 
Jakob Schmidt
http://aut.dk/orqwood
etc.


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

Date: Thu, 23 Nov 2000 11:49:28 GMT
From: richard_dobson@my-deja.com
Subject: text::wrap
Message-Id: <8vj088$8ls$1@nnrp1.deja.com>

Hello,
i am trying to wrap text for a cell of a table using text::wrap.
I am including the following within my script:

$huge = 'wrap';
$columns = 50;

use Text::Wrap qw(wrap $columns $huge);


while (my ($rate,$date,$descr,$who) = splice @array,0,4 ) {
  $hash{$rate}=[$date,wrap("", "", $descr),$who];
}

The table is then produced using the hash %hash. I want the cell that
contains $descr to be wrapped. It is wrapped but the value that I use
as $column doesn't effect the column width. It just wraps according to
the width of the browser that the data is written out to. Can anyone
tell me why it seems to be using a default value for $column and not
the value I specify?

thanks in advance
Richard

p.s has anybody else lost all of the entries for 22/11/00 in this
newsgroup?


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


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

Date: Thu, 23 Nov 2000 12:23:48 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: text::wrap
Message-Id: <1ekjx3n.rlnowpvppz7eN%tony@svanstrom.com>

<richard_dobson@my-deja.com> wrote:

> Hello,
> i am trying to wrap text for a cell of a table using text::wrap.
> I am including the following within my script:
> 
> $huge = 'wrap';
> $columns = 50;
> 
> use Text::Wrap qw(wrap $columns $huge);
> 
> 
> while (my ($rate,$date,$descr,$who) = splice @array,0,4 ) {
>   $hash{$rate}=[$date,wrap("", "", $descr),$who];
> }
> 
> The table is then produced using the hash %hash. I want the cell that
> contains $descr to be wrapped. It is wrapped but the value that I use
> as $column doesn't effect the column width. It just wraps according to
> the width of the browser that the data is written out to. Can anyone
> tell me why it seems to be using a default value for $column and not
> the value I specify?

Here's something for you to think about... How does the browser know
what value you you've set?

Think hard about that one, where is the value actually sent to the
webbrowser... ?


     /Tony
PS here's a hint for ya: this isn't really a problem with perl...
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
   on the verge of frenzy - i think my mask of sanity is about to slip
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©99-00 <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: 23 Nov 2000 14:50:26 +0100
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: Tom Christiansons' 'style'
Message-Id: <g0kivlul.fsf@macforce.sumus.dk>

Chris Stith <mischief@velma.motion.net> writes:

> [snip]  a very important distinction between an OS that is
> Insanely Great and one that's just insane. ;)

While it's utterly true that Windows must be insane and even though I'm a
rather faithful Mac user I guess we have to admit that seen as an OS the
MacOS isn't exactly great. It was great some years ago and it's still more
reliable than Windows but alas the features are limited.

As a user experience though the Macintosh still makes just about everything
else look like a piece of crap. And with UNIX under the hood in OS X we
might just be back in business. We'll have "real" Perl, you see :-D

So - this _is_ a Perl related post :-) (from LinuxPPC on a Mac :-/ )

Oh and by the way MacPerl is great - but it's just not the same...

-- 
Jakob Schmidt
http://aut.dk/orqwood
etc.


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

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


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