[17598] in Perl-Users-Digest
Perl-Users Digest, Issue: 5018 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Dec 3 00:05:36 2000
Date: Sat, 2 Dec 2000 21:05:07 -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: <975819907-v9-i5018@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 2 Dec 2000 Volume: 9 Number: 5018
Today's topics:
Re: Anonymous Array Reference ?? (Tom Hoffmann)
Re: Anonymous Array Reference ?? (OTR Comm)
Re: Anonymous Array Reference ?? <ron@savage.net.au>
Re: Anonymous Array Reference ?? <VincentMurphy@mediaone.net>
Re: Anonymous Array Reference ?? (Tad McClellan)
Re: array of unique random numbers <sgp22@ipartner.net>
Re: Does comp.lang.perl exist? (Ilya Zakharevich)
Re: Grappling wth space (Martien Verbruggen)
Re: Help needed: how to get information (path) where Pe <oooo@ooooooo.com>
I'm looking for a feature rich, visually stunning Chat <karl@nsal.com>
MD5 or crypt()? fallenang3l@my-deja.com
Re: MD5 or crypt()? (Alan Barclay)
need help with warnings <jdhunter@nitace.bsd.uchicago.edu>
Newbie questions on MOVE (B.A.)
Re: Newbie questions on MOVE <krahnj@acm.org>
Re: one question about perl return value <wangwei18@163.net>
Re: one question about perl return value fallenang3l@my-deja.com
Re: perl and javascript <ron@savage.net.au>
Re: Pie Chart Font Size r_hao@hotmail.com
Re: Using goto (Shawn Smith)
Re: Using goto (Shawn Smith)
Re: Using goto (Martien Verbruggen)
Re: Using goto (Tad McClellan)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 02 Dec 2000 23:44:55 GMT
From: tom.hoffmann@worldnet.att.net (Tom Hoffmann)
Subject: Re: Anonymous Array Reference ??
Message-Id: <slrn92j25f.li.tom.hoffmann@localhost.localdomain>
On Sat, 02 Dec 2000 22:25:42 GMT, OTR Comm wrote:
>Hello,
>
>This is probably a strange question, but I need to figure something out.
>
>I have some code:
>
>$card_values = [qw(one two three four)];
>$card_default = qq(one);
>%card_types = ('one'=>'Visa','two'=>'Master Card','three'=>'Discover','four'=>'American Express');
>
>print out "\ncard_values = $card_values, card_values0 = @$card_values[0]\n\n" if ($DEBUG gt 0);
>
>print $query->popup_menu(-name=>'card_type',
> -values=>$card_values,
> -default=>$card_default,
> -labels=>\%card_types),
>
>that works fine.
>
>However, I would like to be able to read in $card_values from an external configuration file and the
>have the popup_menu contain the correct 'values'.
>
>I have an external configuration file where I DO predefine variables (i.e., $var1 = "something') and
>then can access the value of $var1 in my script. However, when I include $card_values = [qw(one two
>three four)]; in my configuration file and try to access $card_values in my script, I just get the
>string [qw(one two three four)], not the reference to the anonymous array.
>
>Does anyone know how perl interprets the statement:
>
>$card_values = [qw(one two three four)];
Why don't you print out the value of $card_values, then you would know
how perl interprets the statement. Here is what I got:
++++++++++++++++++++++++++++++++++++
#!/usr/bin/perl -w
use strict;
my $cards = [qw(one two three four)];
print "$cards\n";
+++++++++++++++++++++++++++++++
[tom@localhost other]$ ./test.pl
ARRAY(0x80f86e0)
+++++++++++++++++++++++++++++++
So $cards is a reference to an anonymous array, no?
$cards->[0]=one
$cards->[1]=two
$cards->[2]=three
$cards->[3]=four
Does this help?
------------------------------
Date: Sun, 03 Dec 2000 01:13:03 GMT
From: otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net (OTR Comm)
Subject: Re: Anonymous Array Reference ??
Message-Id: <3a299af7.3645312903@news.wildapache.net>
On Sat, 02 Dec 2000 23:44:55 GMT, tom.hoffmann@worldnet.att.net (Tom Hoffmann) wrote:
>On Sat, 02 Dec 2000 22:25:42 GMT, OTR Comm wrote:
>>Hello,
>>
>>This is probably a strange question, but I need to figure something out.
>>
>>I have some code:
>>
>>$card_values = [qw(one two three four)];
>>$card_default = qq(one);
>>%card_types = ('one'=>'Visa','two'=>'Master Card','three'=>'Discover','four'=>'American Express');
>>
>>print out "\ncard_values = $card_values, card_values0 = @$card_values[0]\n\n" if ($DEBUG gt 0);
>>
>>print $query->popup_menu(-name=>'card_type',
>> -values=>$card_values,
>> -default=>$card_default,
>> -labels=>\%card_types),
>
>Why don't you print out the value of $card_values, then you would know
>how perl interprets the statement. Here is what I got:
>
>++++++++++++++++++++++++++++++++++++
>#!/usr/bin/perl -w
>use strict;
>
>my $cards = [qw(one two three four)];
>print "$cards\n";
>+++++++++++++++++++++++++++++++
>[tom@localhost other]$ ./test.pl
>ARRAY(0x80f86e0)
>+++++++++++++++++++++++++++++++
>
>So $cards is a reference to an anonymous array, no?
>
>$cards->[0]=one
>$cards->[1]=two
>$cards->[2]=three
>$cards->[3]=four
>
>Does this help?
No, I have done this already!
What I need to do I guess is know how to expand [qw(one two three four)] into a variable when it is
embedded in a string and then have perl intrepret the resultant variable into a hash.
For example, say I have a string "This is the hash: [qw(one two three four)]", how can I parse [qw(one
two three four) out of the string into a variable, say $card_values and then use $card_values in my
popup_menu structure?
Thanks,
Murrah Boswell
------------------------------
Date: Sun, 3 Dec 2000 13:27:34 +1100
From: "Ron Savage" <ron@savage.net.au>
Subject: Re: Anonymous Array Reference ??
Message-Id: <HkhW5.781$K02.26457@ozemail.com.au>
Tested code:
#!perl
use integer;
use strict;
use warnings;
# -------------------------------------------
my(@id, %name);
while (<DATA>)
{
chomp;
my($id, $name) = split(/\s*=>\s*/, $_);
push(@id, $id);
$name{$id} = $name
}
print "Ids: \n";
print map{"\t$_. \n"} @id;
print "\n";
print "Names: \n";
print map{"\t$_ => $name{$_}. \n"} sort {$name{$a} cmp $name{$b} } keys
%name;
print "\n";
__END__
one=>Visa
two=>Master Card
three=>Discover
four=>American Express
--
Cheers
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html
OTR Comm <otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net> wrote in message
news:3a297046.3634383928@news.wildapache.net...
> Hello,
>
> This is probably a strange question, but I need to figure something out.
>
> I have some code:
>
> $card_values = [qw(one two three four)];
> $card_default = qq(one);
> %card_types = ('one'=>'Visa','two'=>'Master
Card','three'=>'Discover','four'=>'American Express');
>
> print out "\ncard_values = $card_values, card_values0 =
@$card_values[0]\n\n" if ($DEBUG gt 0);
>
> print $query->popup_menu(-name=>'card_type',
> -values=>$card_values,
> -default=>$card_default,
> -labels=>\%card_types),
>
> that works fine.
>
> However, I would like to be able to read in $card_values from an external
configuration file and the
> have the popup_menu contain the correct 'values'.
>
> I have an external configuration file where I DO predefine variables
(i.e., $var1 = "something') and
> then can access the value of $var1 in my script. However, when I include
$card_values = [qw(one two
> three four)]; in my configuration file and try to access $card_values in
my script, I just get the
> string [qw(one two three four)], not the reference to the anonymous array.
>
> Does anyone know how perl interprets the statement:
>
> $card_values = [qw(one two three four)];
>
> and how I can get it to interpret:
>
> $card_values = "[qw(one two three four)]";
>
> the same way?
>
> I hope this make some sense.
>
> Thanks,
> Murrah Boswell
------------------------------
Date: Sun, 03 Dec 2000 01:36:01 GMT
From: Vinny Murphy <VincentMurphy@mediaone.net>
Subject: Re: Anonymous Array Reference ??
Message-Id: <m3bsuu2pw0.fsf@vmurphy-hnt1.athome.net>
>>>>> "OTR" == OTR Comm <otrcomm> writes:
OTR> On Sat, 02 Dec 2000 23:44:55 GMT, tom.hoffmann@worldnet.att.net
OTR> (Tom Hoffmann) wrote:
>> On Sat, 02 Dec 2000 22:25:42 GMT, OTR Comm wrote:
>>> Hello,
>>>
>>> This is probably a strange question, but I need to figure something
>>> out.
>>>
>>> I have some code:
>>>
>>> $card_values = [qw(one two three four)]; $card_default = qq(one);
>>> %card_types = ('one'=>'Visa','two'=>'Master
>>> Card','three'=>'Discover','four'=>'American Express');
>>>
>>> print out "\ncard_values = $card_values, card_values0 =
>>> @$card_values[0]\n\n" if ($DEBUG gt 0);
>>>
>>> print $query->popup_menu(-name=>'card_type', -values=>$card_values,
>>> -default=>$card_default, -labels=>\%card_types),
>> Why don't you print out the value of $card_values, then you would
>> know how perl interprets the statement. Here is what I got:
>>
>> ++++++++++++++++++++++++++++++++++++ #!/usr/bin/perl -w use strict;
>>
>> my $cards = [qw(one two three four)]; print "$cards\n";
>> +++++++++++++++++++++++++++++++ [tom@localhost other]$ ./test.pl
>> ARRAY(0x80f86e0) +++++++++++++++++++++++++++++++
>>
>> So $cards is a reference to an anonymous array, no?
>>
>> $cards->[0]=one $cards->[1]=two $cards->[2]=three $cards->[3]=four
>>
>> Does this help?
OTR> No, I have done this already!
OTR> What I need to do I guess is know how to expand [qw(one two three
OTR> four)] into a variable when it is embedded in a string and then
OTR> have perl intrepret the resultant variable into a hash.
OTR> For example, say I have a string "This is the hash: [qw(one two
OTR> three four)]", how can I parse [qw(one two three four) out of the
OTR> string into a variable, say $card_values and then use $card_values
OTR> in my popup_menu structure?
I not sure this is what you want. If you want to embed a reference to an
array in a string than this may be what you are looking for:
my $string = 'This is the hash: [qw(one two three four)]';
# how you get the [ qw(one two ..) is up to you. TMTOWTDI
my $value = (split ': ', $string)[-1];
my $ra = eval $value; # reference to array.
print join(", ", @$ra), ".\n"; # show array.
HTH,
--vjm
------------------------------
Date: Sat, 2 Dec 2000 18:06:32 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Anonymous Array Reference ??
Message-Id: <slrn92j03o.dbj.tadmc@magna.metronet.com>
[ Please limit your line lengths to the conventional 70-72
characters, else they get hard to read after being quoted
a few times. Thanks.
]
OTR Comm <otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net> wrote:
>
>This is probably a strange question, but I need to figure something out.
>
>I have some code:
>
>$card_values = [qw(one two three four)];
[snip]
>that works fine.
>I have an external configuration file where I DO predefine
>variables (i.e., $var1 = "something') and
>then can access the value of $var1 in my script.
^^^^^^^^^^ ^^^^^^^^^^^^
How do you do that?
"use"? "require"? "do"? ...
>However, when I include $card_values = [qw(one two
>three four)]; in my configuration file and try to
>access $card_values in my script, I just get the
>string [qw(one two three four)], not the reference to the anonymous array.
Sounds like you have code and data mixed up. You think it
is code, perl thinks it is data.
So you are not using any of the above methods, because they
are how you include code.
Data is usually accessed via some form of input.
Are you open()ing a reading the "configuration file"?
If so, then perl is right. You have data, not code.
>Does anyone know how perl interprets the statement:
>
>$card_values = [qw(one two three four)];
Yes, but you already know how perl interprets that one, you
have that part working.
It assigns a reference to an anonymous array to $card_values.
>and how I can get it to interpret:
>
>$card_values = "[qw(one two three four)]";
>the same way?
They cannot be interpreted the same way.
This second one assigns a string to $card_values.
"a reference to an array" and "a string" are fundamentally
different things.
There is a way of executing code held in a string, but it is
so dangerous that I'm not going to tell you how to do it that
way. You can get what you want easily without it.
See the Perl FAQ, part 8:
What's the difference between require and use?
Perl offers several different ways to include code from one file into
another...
One of the 3 ways described there would do the job.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 03 Dec 2000 01:07:04 GMT
From: Scott Wiersdorf <sgp22@ipartner.net>
Subject: Re: array of unique random numbers
Message-Id: <3A299BBB.11CF43C6@ipartner.net>
Dela Lovecraft wrote:
> Dear All,
>
> I need to produce an array of random numbers, but each of them needs
> to be unique ie. if I have an array of 50 values, none can be replicated.
>
> As far as I can see, the way to do this would be:
> * set an array of n members
> * put a random number in slot 1
> * create another random number, and check to see that it doesn't appear
> in any of the preceeding elements - if it does, create a different number
> until it does
> * repeat the above set until all n are filled.
>
> Is this the only way to do it? If someone has a better idea, could you give
> perl pointers to show how it would be done?
This is a classic problem solved by using a hash. Hash keys are by definition
unique, so you could do something like this:
my %random_numbers = ();
while( scalar keys %random_numbers < 50 ) {
my $rnd = rand();
$random_numbers{$rnd}++;
}
print "Here are the numbers:\n";
foreach my $number ( sort keys %random_numbers ) {
print $number, "\n";
}
Scott
------------------------------
Date: 3 Dec 2000 01:58:23 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Does comp.lang.perl exist?
Message-Id: <90c9bv$k43$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Randal L. Schwartz
<merlyn@stonehenge.com>],
who wrote in article <m18zpywz83.fsf@halfdome.holdit.com>:
> Jan> No - it does exist - check with your news-provider.
>
> No, it authoritatively DOES NOT EXIST.
Do not think that your choice of verbs is authoritative enough.
Existence of newsgroups is a very delicate subject: you view it from
one side, and it exists, you view it from another one, and it does not.
So "it should not exist" may be a better wording. Or "it has no right
to exist". BTW, what percentage of US population "has no right to
exist" in US? ;-)
Ilya
------------------------------
Date: Sun, 3 Dec 2000 14:00:25 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Grappling wth space
Message-Id: <slrn92jdq9.20m.mgjv@martien.heliotrope.home>
On 2 Dec 2000 12:09:34 -0800,
Mark Ferguson <mefergus@Stanford.EDU> wrote:
> Blstone77 <blstone77@aol.com> writes:
>>
>>Hello, can anyone help me with this problem I am having with spaces in a
>>string? I have a string which contains keywords. I get rid of spaces from the
>>beginning and end using this:
>>
>> for ($Keywords) {
>> s/^\s+//;
>> s/\s+$//;
>> }
Excellent. Precisely what the FAQ advises.
>>I also get rid of commas between keywords the same substitution way. The
>>problem is, some people put multiple spaces between keywords, and
>>rather than a string like
>>
>>Big Furry things and fruit
>>
>> I get..
>>
>>Big Fuzzy things and fruit
>>
>>What I am looking for is a way to eliminate all spaces that take up more than
>>one character postition. How can I do this and can it besimply incorporated
>>into the code above? Thanks for any help on this.
>>
If it's only spaces, tr/ //s; If you need to compress any sequence of
whitespace into a single space: s/\s+/ /g;
> How about
>
> s/^\s+|\s+$//g; # leading and trailing space in one go
The FAQ specifically states that it is much faster to do this in two
steps. The OP has a better solution than yours for this.
> s/[,\s+]+/ /g; # commas and more than one space get one space
This doesn't answer the OP's question. What are that comma and plus
doing in there, and why are you getting rid of them? Besides that, your
comment is misleading. The above substitution will replace every
sequence of 1 or more commas, whitespace or the plus character with a
single space.
$ perl
$_ = '+, ,+ ,+';
s/[,\s+]+/ /g;
print "'$_'\n";
__END__
' '
I doubt very much that that was what was wanted.
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | What's another word for Thesaurus?
NSW, Australia |
------------------------------
Date: Sat, 2 Dec 2000 16:08:24 -0800
From: "DS" <oooo@ooooooo.com>
Subject: Re: Help needed: how to get information (path) where Perl script is located?
Message-Id: <t2j3hqegtvmqc0@corp.supernews.com>
Michael,
Thanks a lot! Did find module cwd (and docs) and it worked!
DS
Michael Carman wrote in message <3A2665CD.57DED0A2@home.com>...
>Again, no mention of CGI, but the Cwd module may help him. He should
>also look at the FindBin module.
>
>-mjc
------------------------------
Date: Sat, 2 Dec 2000 23:12:27 -0000
From: Karl <karl@nsal.com>
Subject: I'm looking for a feature rich, visually stunning Chat CGI - Do you know of one?
Message-Id: <MPG.14939233d29e7d15989688@news.usenet.com>
Hi.
Like I said I'm looking for a really good chat cgi script for UNIX, it
needs to be visually stunning too and easy to use for users with lots of
features, do you know of one??
I have looked at a demo of V-Chat (another V-Chat, not the well known V-
Chat) by Armada and although it looks wonderful, it seems pretty slow,
and thats with just a few users, we could be talking 30 a channel at peak
with the one I'm setting up.. So I'm worried its not up to it.. I have
taken a look at E-Chat a modified Matt Hahnfeld's excellent EveryChat, it
isn't very customisable and looks, well dull.. But its quick. So maybe
I'm hoping for too much but if its out there please show me the way and
email me below.
Thanks in advance,
Karl.
karl@nsal.com
P.S. If you run the Armada chat I would love to hear from you..Get some
feedback.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
------------------------------
Date: Sun, 03 Dec 2000 03:42:10 GMT
From: fallenang3l@my-deja.com
Subject: MD5 or crypt()?
Message-Id: <90cfei$8qr$1@nnrp1.deja.com>
Which one encrypts better, the Digest::MD5 module or the built-in crypt
() function?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 3 Dec 2000 04:11:18 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: MD5 or crypt()?
Message-Id: <975816666.990635@elaine.furryape.com>
In article <90cfei$8qr$1@nnrp1.deja.com>, <fallenang3l@my-deja.com> wrote:
>Which one encrypts better, the Digest::MD5 module or the built-in crypt
>() function?
Neither one encrypts, they're both forms of hashing algorythmns.
crypt has built in variation, in that the salt lets there be more than
one hash for each password. For MD5 you have to do this yourself. crypt
ignores the 9th or greater character, but can accept longer passwords,
but on the flip side, MD5 is going to produce a longer hash. If you need
it for compatability, or if there is a reason to minimize the space,
then I'd use crypt, otherwise use MD5.
------------------------------
Date: 02 Dec 2000 18:08:29 -0600
From: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
Subject: need help with warnings
Message-Id: <1r3dg6wema.fsf@video.bsd.uchicago.edu>
I am using HTML::Parser to parse and convert some web pages and am
getting some warnings that I don't understand the source. Any
suggestions as to how I can fix the code below to fix these warnings?
Warnings:
c715466-a:~/Perl/Bin> myhtml2texi temp.html > temp.texi
Prototype mismatch: sub main::tag (@_) vs none at myhtml2texi line 28.
Subroutine tag redefined at myhtml2texi line 14.
The line numbers correspond to the begin and end of the sub 'tag'.
Thanks,
John Hunter
Code:
#!/usr/bin/perl -w
# Convert html to texinfo (I know about html2texi, but it doesn't work
# like I want it to!)
use strict;
use HTML::Parser 3.00 ();
use Mysubs::Misc;
use Text::Autoformat;
my %inside;
use vars qw($output);
sub tag { ### <- line 14
my($tag, $num) = @_;
$inside{$tag} += $num;
my $string;
if ($tag =~ m/^i$/) {
$string = ($num==1) ? "\@emph\{" : "}";
}
elsif ($tag =~ m/^b$/) {
$string = ($num==1) ? "\@strong\{" : "}" ;
}
elsif ($tag =~ m/^p$/) {
$string = "\n";
}
$output .= $string if defined($string);
} ### <- line 28
sub text {
return if $inside{script} || $inside{style};
$output .= texinfosafe($_[0]);
}
my $p = HTML::Parser->new(api_version => 3,
handlers => [start => [\&tag, "tagname, '+1'"],
end => [\&tag, "tagname, '-1'"],
text => [\&text, "dtext"],
],
marked_sections => 1,
);
$p->parse_file(shift) || die "Can't open file: $!\n";
$output =~ s/\n[\r\n]+/\n\n/gs;
print autoformat $output, { left=>0, right=>72, all=>1, fill=>1 };
------------------------------
Date: Sat, 2 Dec 2000 19:23:17 -0700
From: silvius@uswest.net (B.A.)
Subject: Newbie questions on MOVE
Message-Id: <MPG.14935c8332477389989680@news.uswest.net>
How do you move directories? I'm trying to learn Perl on Win32. TIA
I tried using the
use File::Copy;
move ("dir1", "dir2");
and
move ("/dir1", "/dir2");
------------------------------
Date: Sun, 03 Dec 2000 04:27:02 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Newbie questions on MOVE
Message-Id: <3A29CC43.5CE9B6C4@acm.org>
"B.A." wrote:
>
> How do you move directories? I'm trying to learn Perl on Win32. TIA
>
> I tried using the
>
> use File::Copy;
>
> move ("dir1", "dir2");
>
> and
>
> move ("/dir1", "/dir2");
$ perldoc -f rename
=item rename OLDNAME,NEWNAME
Changes the name of a file. Returns C<1> for success, C<0> otherwise.
Behavior of this function varies wildly depending on your system
implementation. For example, it will usually not work across file
system
boundaries, even though the system I<mv> command sometimes compensates
for this. Other restrictions include whether it works on directories,
open files, or pre-existing files. Check L<perlport> and either the
rename(2) manpage or equivalent system documentation for details.
John
------------------------------
Date: Sat, 02 Dec 2000 22:28:15 -0500
From: WEI WANG <wangwei18@163.net>
Subject: Re: one question about perl return value
Message-Id: <3A29BDCF.AAC3CF0D@163.net>
OK, www.time.gov,but how to do it? I know it is maybe a silly question, but
I am a newbie on perl.
Bill
dtbaker_dejanews@my-deja.com wrote:
> In article <3A252FFE.844E14B9@hotmail.com>,
> Bill Wang <wangbill18@hotmail.com> wrote:
> > This is a multi-part message in MIME format.
> > --------------2102C99B27BF6879706C3859
> > Content-Type: text/plain; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
> >
> > How to use perl to return server time, then treat the time as a start
> > time, so I can use javascript to display a clock.
> --------------
>
> server time may not be very accurate.... try www.time.gov
>
> dan
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Sun, 03 Dec 2000 04:14:34 GMT
From: fallenang3l@my-deja.com
Subject: Re: one question about perl return value
Message-Id: <90chb9$a2g$1@nnrp1.deja.com>
In article <3A252FFE.844E14B9@hotmail.com>,
Bill Wang <wangbill18@hotmail.com> wrote:
> This is a multi-part message in MIME format.
> --------------2102C99B27BF6879706C3859
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> How to use perl to return server time, then treat the time as a start
> time, so I can use javascript to display a clock.
>
> --------------2102C99B27BF6879706C3859
> Content-Type: text/x-vcard; charset=us-ascii;
> name="wangbill18.vcf"
> Content-Transfer-Encoding: 7bit
> Content-Description: Card for Bill Wang
> Content-Disposition: attachment;
> filename="wangbill18.vcf"
>
> begin:vcard
> n:Hurston;Pam
> tel;fax:850 644 9763
> tel;work:850 644 5772
> x-mozilla-html:FALSE
> adr:;;;;;;
> version:2.1
> email;internet:hurston@lis.fsu.edu
> fn:Pam Hurston
> end:vcard
>
> --------------2102C99B27BF6879706C3859--
>
>
A: You can use Perl to send a cookie with the time so that javascript
can retrieve it and do some processing and display a clock.
B: Have Perl print a JavaScript snippet with a variable containg the
server time so that JavaScript can get that value and display the clock.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 3 Dec 2000 13:41:39 +1100
From: "Ron Savage" <ron@savage.net.au>
Subject: Re: perl and javascript
Message-Id: <UxhW5.789$K02.27452@ozemail.com.au>
Here is a tutorial on moving data from JavaScript to Perl, as you drag items
around the screen.
http://savage.net.au/Perl-tutorials.html#tut-30
--
Cheers
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html
Alex Thomas <alex.thomas@mindspring.com> wrote in message
news:90a6oj$hu2$2@slb1.atl.mindspring.net...
> is there a way to use perl and JavaScript so that an array created in perl
> can be accessed by JavaScript and vice-versa?
>
> -Alex
>
>
------------------------------
Date: Sun, 03 Dec 2000 01:43:32 GMT
From: r_hao@hotmail.com
Subject: Re: Pie Chart Font Size
Message-Id: <90c8g4$42h$1@nnrp1.deja.com>
Martien;
It turned out that it was hard coded to gif format instead of png.
After I changed to png format, it works very well.
Thanks a lot.
Randy
In article <slrn926c44.br5.mgjv@verbruggen.comdyn.com.au>,
mgjv@tradingpost.com.au wrote:
> On Mon, 27 Nov 2000 21:53:50 -0500,
> Randy <r_hao@hotmail.com> wrote:
> > "Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
> > news:slrn92643q.br5.mgjv@verbruggen.comdyn.com.au...
>
> [reordered post to be more chronological]
>
> >> On Mon, 27 Nov 2000 20:34:25 -0500,
> >> Randy <r_hao@hotmail.com> wrote:
> >> > We have create a Pie Chart according to GD::Graph::Pie module.
> >> > However, we can't make font size on the pie chart bigger by using
> >> > $graph->set_value_font('arial', 20). Anyone has idea?
> >>
> >> Is the font displayed at all? Can 'arial.ttf' be found by the
program?
> >> The tiny bit of code you submit is demonstrated in sample92.pl in
the
> >> source distribution, and it works fine there.
> >>
> >> What exactly is the problem you're seeing? Nothing at all? Too
small a
> >> font, but the correct one? The wrong font?
> >
> > I also tested 'gdMediumBoldFont', it does not work either.
> > It displays the percentage, like '66%', and so small, I can not
tell it is
> > right font or not.
>
> That is very odd...
>
> I suspect that arial.ttf cannot be found. In that case, the font for
> the values on the pie will default to gdinyFont (I believe), which is
> pretty small, and ugly. To fix, set TTF_FONT_PATH or FONT_PATH in your
> environment before running your program, or do it in your program.
> I'll include an adapted version of the sample92.pl file distributed
> with the original source archive, with some comments.
>
> For more information see the GD::text documentation, somewhere at the
> end.
>
> BEGIN{
> # Set this environment variable for your fonts. It's in a BEGIN{}
> # block, because it has to be set before GD::Text gets loaded by
> # GD::Graph. See the GD::Text documentation for details.
> #
> # Instead of using this, we'll use the method documented later:
> # $ENV{FONT_PATH} = '/usr/share/fonts/ttfonts';
> }
>
> use GD::Graph::pie;
> use GD; # For gdMediumBoldFont
>
> # This is where my fonts live. Normally you'd set the FONT_PATH or
> # TTF_FONT_PATH to this value in your shell environment. See the
> # GD::Text documentation.
> GD::Text->font_path('/usr/share/fonts/ttfonts');
>
> @data = (
> ["1st","2nd","3rd","4th","5th","6th"],
> [ 4, 2, 3, 4, 3, 3.5]
> );
>
> $my_graph = new GD::Graph::pie( 250, 200 );
>
> $my_graph->set(
> title => 'A Pie Chart',
> label => 'Label',
> axislabelclr => 'white',
> dclrs => [ 'lblue' ],
> accentclr => 'lgray',
> );
>
> # Set the font of the title above the pie
> $my_graph->set_title_font('arial', 18);
> # Set the font of the label below the pie
> $my_graph->set_label_font(gdMediumBoldFont);
> # Set the font of the values printed on the pie
> $my_graph->set_value_font('arial', 20);
>
> $my_graph->plot(\@data);
> open(OUT, '>foo.png') or die $!;
> binmode OUT;
> print OUT $my_graph->gd->png;
> close OUT;
>
> Martien
> --
> Martien Verbruggen |
> Interactive Media Division | Unix is user friendly. It's just
> Commercial Dynamics Pty. Ltd. | selective about its friends.
> NSW, Australia |
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 03 Dec 2000 01:54:47 GMT
From: SPAM_loginprompt@yahoo.com (Shawn Smith)
Subject: Re: Using goto
Message-Id: <3a29a77d.28810367@netnews.worldnet.att.net>
On Sat, 2 Dec 2000 09:34:09 -0500, tadmc@metronet.com (Tad McClellan)
wrote:
>(But perl is really a compile-and-go thingie. It is _both_
> a compiler and an interpreter. A floor wax and a dessert
> topping.
>)
Ted can you point me to a doc that covers the compile-ang-go thingie.
I am guessing that perl interprets the script, and then perl does not
run the code, but instead makes an exe that it loads into memory, and
it never saves the exe to file?
__
Shawn Smith
My freeware: http://sites.netscape.net/shawnspad
------------------------------
Date: Sun, 03 Dec 2000 01:56:01 GMT
From: SPAM_loginprompt@yahoo.com (Shawn Smith)
Subject: Re: Using goto
Message-Id: <3a2aa84b.29016097@netnews.worldnet.att.net>
On Sat, 2 Dec 2000 09:41:24 -0700, "bowman" <bowman@montana.com>
wrote:
>If you want to attack anything, the pages long functions are the place to
>start.
>I violate my own rule constantly, but ideally I like to see the entire
>function in the
>fifty lines I usually have displayed in gvim.
Thanks for your great advice.
__
Shawn Smith
My freeware: http://sites.netscape.net/shawnspad
------------------------------
Date: Sun, 3 Dec 2000 13:52:07 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Using goto
Message-Id: <slrn92jdan.20m.mgjv@martien.heliotrope.home>
On Sun, 03 Dec 2000 01:54:47 GMT,
Shawn Smith <SPAM_loginprompt@yahoo.com> wrote:
> On Sat, 2 Dec 2000 09:34:09 -0500, tadmc@metronet.com (Tad McClellan)
> wrote:
>
>
>>(But perl is really a compile-and-go thingie. It is _both_
>> a compiler and an interpreter. A floor wax and a dessert
>> topping.
>>)
>
> Ted can you point me to a doc that covers the compile-ang-go thingie.
(pssst... His name is Tad. With an a :))
> I am guessing that perl interprets the script, and then perl does not
> run the code, but instead makes an exe that it loads into memory, and
> it never saves the exe to file?
I can't actually easily find a good spot in the documentation that goes
into detail on this. The Camel (Programming Perl) goes into quite some
detail in chapter 18 (third edition).
The perlcompile documentation goes into some detail, albeit a bit
unstructured.
It's not really important to know how exactly this works to work with
Perl. As long as you understand that there is a compilation and a run
phase, you're happy. Some things happen during compilation, some during
run.
Just to clarify one thing: The compilation phase does not compile Perl
into machine code. That never happens in the normal life cycle of a perl
program.
If you want to know the details, read perlcompile, and get access to a
copy of Programming Perl.
Martien
--
Martien Verbruggen | Since light travels faster than
Interactive Media Division | sound, isn't that why some people
Commercial Dynamics Pty. Ltd. | appear bright until you hear them
NSW, Australia | speak?
------------------------------
Date: Sat, 2 Dec 2000 20:54:21 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Using goto
Message-Id: <slrn92j9ud.deh.tadmc@magna.metronet.com>
Shawn Smith <SPAM_loginprompt@yahoo.com> wrote:
>On Sat, 2 Dec 2000 09:34:09 -0500, tadmc@metronet.com (Tad McClellan)
>wrote:
>
>
>>(But perl is really a compile-and-go thingie. It is _both_
>> a compiler and an interpreter. A floor wax and a dessert
>> topping.
>>)
>
>Ted
Yes Shaun?
>can you point me to a doc that covers the compile-ang-go thingie.
It is the same one I already pointed you to, perlrun:
------------------------------
After locating your program, Perl compiles the entire program to an
internal form. If there are any compilation errors, execution of the
program is not attempted. (This is unlike the typical shell script,
which might run part-way through before finding a syntax error.)
If the program is syntactically correct, it is executed. If the program
runs off the end without hitting an exit() or die() operator, an implicit
C<exit(0)> is provided to indicate successful completion.
------------------------------
>I am guessing that perl interprets the script, and then perl does not
>run the code, but instead makes an exe that it loads into memory, and
>it never saves the exe to file?
Kinda sorta.
perl _is_ the binary (I cannot bring myself to use "exe").
It first compiles your entire program (and modules, if any)
and makes an internal representation, called byte codes.
Then in runs the byte codes as an interpreter, all within
the perl binary. perl is a kind of "virtual machine" there
is no "other" binary. This is similar to how Pascal compilers
and Java work also.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
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 5018
**************************************