[18434] in Perl-Users-Digest
Perl-Users Digest, Issue: 602 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 2 21:11:16 2001
Date: Mon, 2 Apr 2001 18:10:52 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <986260251-v10-i602@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 2 Apr 2001 Volume: 10 Number: 602
Today's topics:
Re: Data::Dumper <tinamue@zedat.fu-berlin.de>
Re: Data::Dumper <uri@sysarch.com>
Re: Disguising Perl scripts (Tad McClellan)
Re: Disguising Perl scripts <julien.quint@imag.fr>
Does localtime() handle daylight savings <ramu_chidambaram@agilent.com>
Re: Email Gurus - Help! <wayne.keenan@ntlworld.com>
Re: Email Gurus - Help! <zkent@together.net>
Re: Free perl interpreter <fty@mediapulse.com>
Re: Free perl interpreter <bmb@ginger.libs.uga.edu>
Re: Free perl interpreter (Logan Shaw)
Re: Funny behavior? <uri@sysarch.com>
Re: Funny behavior? <mischief@velma.motion.net>
Re: Funny behavior? <mischief@velma.motion.net>
Re: Funny behavior? <uri@sysarch.com>
Re: Funny behavior? <webmaster@webdragon.unmunge.net>
Re: Funny behavior? <mischief@velma.motion.net>
GD::Graph again <bcoon@sequenom.com>
Re: Getting Character Codes <*@qz.little-neck.ny.us>
Getting Mod Time While Uploading <chaz.warriner@idesk.com>
Re: hashes keys case insensitive (Tad McClellan)
Re: hashes keys case insensitive <stephen.gray@internode.on.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 31 Mar 2001 00:25:30 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Data::Dumper
Message-Id: <9a385q$3cmqg$2@fu-berlin.de>
Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "TM" == Tina Mueller <tinamue@zedat.fu-berlin.de> writes:
> yep.
> TM> but somehow my example works if I set $Data::Dumper::Deepcopy to 1.
> TM> z: $VAR1 = [
> TM> [
> TM> 23
> TM> ],
> TM> [
> TM> 23
> TM> ]
> TM> ];
> but that is not the same. those anon arrays are not the same ref so it
> is different than the above example. deepcopy will do that for you. it
> makes complete fresh copies of a (sub)tree, instead of copying only the
> refs in common.
so the deepcopy functionality is like cloning the
whole variable?
> the proper way to get what you tried is to pass a variable name into
> Dumper (with the [ref], [name] syntax)
yeah, i thought about it, then i was just too lazy to try and
understand the syntax. but good to know, i'll try it out.
> and just eval it without
> assigning it to anything. or in the above case do:
> eval $x ;
> $z = $VAR1 ;
> print "z = ", Dumper( $z ), "\n" ;
aah, i see. but did you mean
eval Dumper $x; instaead of "eval $x"?
i get the following:
02:11am tina@linux:nap 687> perl -MData::Dumper -e'
$Data::Dumper::Purity = 1; # the same with 0
$x = [ ( [23] ) x 2 ];
print Dumper $x;
eval $x ;
$z = $VAR1 ;
print "z = ", Dumper( $z ), "\n" ;
'
$VAR1 = [
[
23
],
[]
];
$VAR1->[1] = $VAR1->[0];
z = $VAR1 = undef;
regards,
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanx
------------------------------
Date: Sat, 31 Mar 2001 03:51:28 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Data::Dumper
Message-Id: <x7hf0awq7y.fsf@home.sysarch.com>
>>>>> "TM" == Tina Mueller <tinamue@zedat.fu-berlin.de> writes:
TM> so the deepcopy functionality is like cloning the
TM> whole variable?
yep. consider it a complete clone of the data tree.
>> eval $x ;
>> $z = $VAR1 ;
>> print "z = ", Dumper( $z ), "\n" ;
TM> aah, i see. but did you mean
TM> eval Dumper $x; instaead of "eval $x"?
no, we already dumped it. we want to see what the value of $z is after
assigning $VAR1 to it. it should be the same as the original data tree.
TM> $Data::Dumper::Purity = 1; # the same with 0
TM> $x = [ ( [23] ) x 2 ];
note that is 2 copies of the same anon array ref.
TM> print Dumper $x;
TM> eval $x ;
well, you want to assign the output of dumper to a var and then eval
that. or you could eval the dumper output directly.
do this:
$y = Dumper $x; ;
eval $y ;
i may have assumed this but i wasn't clear about it.
TM> $z = $VAR1 ;
TM> z = $VAR1 = undef;
well, that was because $VAR1 was never assigned as we never evaled a
string with $VAR1 in it.
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: Mon, 2 Apr 2001 07:50:40 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Disguising Perl scripts
Message-Id: <slrn9cgpsf.852.tadmc@tadmc26.august.net>
Mark Warnes <mark.warnes@limecs.com> wrote:
>
>The problem I have is that I need to disguise the Perl
>source
Perl FAQ, part 3:
"How can I hide the source for my Perl program?"
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 02 Apr 2001 13:51:49 +0200
From: Julien Quint <julien.quint@imag.fr>
Subject: Re: Disguising Perl scripts
Message-Id: <khvofufr02y.fsf@imag.fr>
mark.warnes@limecs.com (Mark Warnes) writes:
> I have a Perl script that I have developed that is going to be sold
> commercially. The problem I have is that I need to disguise the Perl
> source so that it cannot be copied. Is this possible?
This is a FAQ. Try perldoc -q hide for instance. One of the paradoxes of
Perl is that some complain about the fact that a Perl program is unreadable,
and on the other hand there is no easy way to conceal your code...
--
Julien
------------------------------
Date: Mon, 02 Apr 2001 15:26:53 -0700
From: Your_Name_Here <ramu_chidambaram@agilent.com>
Subject: Does localtime() handle daylight savings
Message-Id: <3AC8FCAD.308F@agilent.com>
Hi,
Does anyone know whether localtime functions handles the daylight
savings correctly on WINNT 4.0
If I run the below two lines, I still see the old timings. Rebooting my
machine has not helped.
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
print "time $mday-$months[$mon]-$year.$hour:$min:$sec\n";
Thanks for the help,
chidam
------------------------------
Date: Mon, 02 Apr 2001 21:00:18 +0100
From: "wayne.keenan" <wayne.keenan@ntlworld.com>
Subject: Re: Email Gurus - Help!
Message-Id: <3AC8DA52.320E5FBA@ntlworld.com>
Zachary Kent wrote:
>
> I don't know what to do with the line:
> echo /usr/bin/mimencode $filename
>
use backticks to capture the output of the command, so it becomes:
print MAIL `/usr/bin/mimencode $filename`;
------------------------------
Date: Mon, 2 Apr 2001 16:49:40 -0400
From: "Zachary Kent" <zkent@together.net>
Subject: Re: Email Gurus - Help!
Message-Id: <4y5y6.1430$Cx5.398309@nntp3.onemain.com>
"wayne.keenan" <wayne.keenan@ntlworld.com> wrote in message
news:3AC8DA52.320E5FBA@ntlworld.com...
>
> Zachary Kent wrote:
>
> >
> > I don't know what to do with the line:
> > echo /usr/bin/mimencode $filename
> >
>
> use backticks to capture the output of the command, so it becomes:
>
> print MAIL `/usr/bin/mimencode $filename`;
>
Thanks wayne,
However, I am still having trouble with the script in general. The print
content-type statements are just printing and thats all. This is the body
of the email I am recieving from the program:
Content-Type: multipart/mixed;
Boundary="sendfile-attachment-boundary"--sendfile-attachment-boundaryContent
-Type: text/plain; charset=us-asciiThis is a MIME encoded message. If your
mail softwarecannot properly handle the attached file, you may needto get a
MIME-aware mailer.--sendfile-attachment-boundaryContent-Type:
application/octet-stream; name="test.log"Content-Transfer-Encoding:
base64Content-Disposition: attachment;
filename="test.log"--sendfile-attachment-boundary--
How do I print those content-types and boundaries so that sendmail *does
stuff* rather than *print stuff*?
And, please if there are other errors in the script, let me know. I do not
know much about sendmail (other than the basics) and not much about
mime-types.
Thanks Perl-gurus,
Zach
------------------------------
Date: Mon, 02 Apr 2001 15:15:44 GMT
From: "Jay Flaherty" <fty@mediapulse.com>
Subject: Re: Free perl interpreter
Message-Id: <AI0y6.25793$3J6.1711058@news2.aus1.giganews.com>
"Pierre-Alain Fayolle" <fayolle@enseirb.fr> wrote in message
news:9a9lsj$c9t$1@news.u-bordeaux.fr...
> If you are under mac try MacPerl, I think you will find it via
www.perl.com,
> the official web site of the perl mongers.
The official site of the perl mongers is http://www.pm.org/
jay
------------------------------
Date: Mon, 2 Apr 2001 11:19:21 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Free perl interpreter
Message-Id: <Pine.A41.4.21.0104021118530.19084-100000@ginger.libs.uga.edu>
On Sun, 1 Apr 2001, bowman wrote:
> Michael Farragher <mick@farragher77.freeserve.co.uk> wrote in message
> news:9a7uol$v0h$1@newsg3.svr.pol.co.uk...
> > Can anyone suggest where I can get a free perl interpreter from ?
>
> www.danglingpreposition.org
http://www.wsu.edu/~brians/errors/
Brad
------------------------------
Date: 1 Apr 2001 21:54:33 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Free perl interpreter
Message-Id: <9a8pl9$5r6$1@boomer.cs.utexas.edu>
In article <PhQx6.585$584.4410@newsfeed.slurp.net>,
bowman <bowman@montana.com> wrote:
>
>Michael Farragher <mick@farragher77.freeserve.co.uk> wrote in message
>news:9a7uol$v0h$1@newsg3.svr.pol.co.uk...
>> Can anyone suggest where I can get a free perl interpreter from ?
>
>www.danglingpreposition.org
"Ending a sentence with a preposition is something up with which we
will not put." (Winston Churchill)
Actually, supposedly the Oxford English Dictionary has now changed
their opinion, i.e. it's something they approve of.
- Logan
--
whose? my your his her our their _its_
who's? I'm you're he's she's we're they're _it's_
------------------------------
Date: Mon, 02 Apr 2001 20:15:36 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Funny behavior?
Message-Id: <x7snjrukgt.fsf@home.sysarch.com>
>>>>> "SRG" == Scott R Godin <webmaster@webdragon.unmunge.net> writes:
SRG> In article <slrn9cgnrv.852.tadmc@tadmc26.august.net>,
SRG> tadmc@augustmail.com (Tad McClellan) wrote:
SRG> | >where does the term come from, anyway?
SRG> |
SRG> |
SRG> | "here-docs" are borrowed from the shell.
SRG> |
SRG> | I think the name is too ingrained to be changed...
SRG> ...essentially because the 'document' in question is "right here" and
SRG> not somewhere else needing to be imported on the fly or built by the
SRG> script from an array of lines, or some other method, hence the name.
and in the shell, here docs were actually save in a file and then opened
and the handle attached to STDIN of the program. so they really were
documents in that sense. perl changed that to be just another string
quoting mechanism but kept the name for historical reasons. so perl and
shell here docs are very different animals except for a similar syntax
(and even there perl expanded the syntax in several ways).
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: Sat, 31 Mar 2001 02:02:22 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Funny behavior?
Message-Id: <tcaelepb43a1c2@corp.supernews.com>
Philip Lees <pjlees@ics.forthcomingevents.gr> wrote:
> On Fri, 30 Mar 2001 07:28:14 GMT, pjlees@ics.forthcomingevents.gr
> (Philip Lees) wrote:
>>On Fri, 30 Mar 2001 01:51:16 -0000, Chris Stith
>><mischief@velma.motion.net> wrote:
>>
>>>perldoc -q HERE
>>>
>>>You are supposed to check the FAQ before posting.
>>
>>Have you actually tried this? Sure, the here doc faq is in there, but
>>way, way down towards the end after a number of totally irrelevant
>>things such as:
>>
>> Where can I get a list of Larry Wall witticisms?
>>
>>If I tried that first off I would assume that perldoc was broken.
> Furthermore, looking back I see that the OP didn't even _know_ what
> here docs are called, so how's he supposed to search the FAQ?
This is a good point. Although HERE documents are used commonly
I'm not sure where they are documented in the standard docs. The
Camel and most other books on Perl mention them, but the only
place in the standard docs that I'm certain has an mention by that
name is in the FAQ. It's time for a little search:
In the directory /usr/src/perl-5.6.0/pod:
# grep HERE *
perlcygwin.pod: *** WHOA THERE!!! ***
perlcygwin.pod: *** WHOA THERE!!! ***
perldata.pod: # SYNTAX ERROR HERE.
perlfaq.pod:=item * Why don't my <<HERE documents work?
perlfaq4.pod:=head2 Why don't my <<HERE documents work?
perlfaq4.pod: ($VAR = <<HERE_TARGET) =~ s/^\s+//gm;
perlfaq4.pod: HERE_TARGET
perlfaq4.pod:But the HERE_TARGET must still be flush against the margin.
perlfaq8.pod: # DO YOUR OPERATION HERE #
perlmod.pod: ## YOUR CODE GOES HERE
perlmodlib.pod: $ALL_CAPS_HERE constants only (beware clashes
with Perl vars)
perlos390.pod:You may see a "WHOA THERE!!!" message for
$d_shmatprototype
perlstyle.pod: $ALL_CAPS_HERE constants only (beware clashes
with perl vars!)
perltoc.pod:always quoting "$vars"?, Why don't my <<HERE documents
work?, What is the
perltoc.pod:=item Why don't my <<HERE documents work?
perlvms.pod:Perl will print C<ONCE UPON A TIME THERE WAS>, assuming,
of course,
It seems that perltoc, perlfaq, and perlfaq4 are the only places where
HERE docs are mentioned in the standard docs. I would have guessed them
to be in perldata, perlsyn, or perlfunc (a reference to their use with
the func `print' in that function's section could be nice).
If I remember, I may bring this up on the p5p list next week. I'm
sure patches giving HERE docs mention in appropriate places would
be given some consideration.
> Or am I just humour impaired today?
I'm not trying to be funny. Forgive me if I'm a little offf today.
I'm rest impaired, having put in 137 (no, that figure's not off, one
hundred thirty-seven) hours work in the last two weeks, plus family
and side projects.
Chris
--
Christopher E. Stith
Even in the worst of times, there is always someone who's
never had it better. Even in the best of times, there is
always someone who's never had it worse.
------------------------------
Date: Mon, 02 Apr 2001 23:57:05 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Funny behavior?
Message-Id: <tci4ehjihs4c4d@corp.supernews.com>
[ snipped quoted text at bottom of message... I'll not get into
that in this thread. ;-) ]
Bryan Coon <bcoon@sequenom.com> wrote:
> As the original poster of this thread, first I want to thank Chris for
> his helpful advice. He answered my question perfectly, and I appreciate
> him taking his time to help out, as I see he does with so many people
> here.
:-) You're welcome, and thank you in return.
> Just a note as to the whole 'you are supposed to check the faq' topic...
> The problem with perl for me (as a programmer in another language) is
> simply where to find information. Not because there is so little of it
> of course, but because there is a flood of it. Between the perl docs for
> each module, the core perl docs, the usenet groups, mailing lists, and
> the perl faq (those are just the ones I know of) it is sometimes a
> challenge to sort and sift to find the information you are looking for.
> And it is even more difficult if you are not even sure WHAT you are
> looking for!
I understand this. I didn't mean the `supposed to check the FAQ' in
a nasty way. If I had, I wouldn't have posted much else - or rather,
I likely would not have responded at all.
> It is probably fair to say that 95% or more of what people ask here is in
> some documentation somewhere. So in that respect, most people should
> RTFM, or check the faq, etc. But for some (including myself) of us who
> are embedded in the learning curve of perl, there are of course a
> gazillion things we dont know. For example, I had no idea that 'perldoc
> -q '<<'' was the answer to my question. Perhaps it was obvious to
> everyone else out there, but not me.
It wasn't obvious to me to give you '<<' as the search key. ;-) I gave
what I could think to give off the top of my head, and I looked to make
sure what it found contained what was needed.
> So in this case how am I 'supposed to check the faq'? Chris's response
> was very helpful, and I appreciate that. But telling me that I am
> supposed to check the faq, when in essense the questiion is how to find
> this in the faq is not helpful. Clearly, if I had known how to find it
> in the faq, I would not have posted it.
Not to pick nits, but the group as a whole seems to appreciate it when
someone states specifically, "I know this must be in the docs, but can't
find it. I've already searched the docs on x, y, and z, but didn't see
it. Could someone please point me in the right direction?" I imagine I
sound like a jerk to some for bringing that up, but it just seems to me
to be a true statement.
Often, when I tack on `you are supposed to' sorts of statements to my
posts I do so because some people in the group would simply make a
separate `you are supposed to' post if they didn't see someone already
saying it, whether they offer any help on how to do something or not.
I do think it'd be easier on all of us if people asking questions
listed where they have already looked for answers and if those ready
to restate rules were ready to give a little help, and those who help
answer a FAQ also point out where in the docs the answers can be found.
> But this is par for the course. I expect to see a 'RTFM' or 'you are
> supposed to check the FAQ' on my posts. I am not a perl guru (yet).
> I may miss information that is painfully obvious to everyone else, even
> after searching for hours. I will try to learn as much as I can from any
> other sources before resorting to usenet. But if I can't find something,
> usenet is where I have to go.
> Thanks,
> Bryan
--
Christopher E. Stith
Where there's a will, there's a lawyer.
------------------------------
Date: Sat, 31 Mar 2001 04:04:33 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Funny behavior?
Message-Id: <x7elvewpm6.fsf@home.sysarch.com>
>>>>> "CS" == Chris Stith <mischief@velma.motion.net> writes:
CS> This is a good point. Although HERE documents are used commonly
CS> I'm not sure where they are documented in the standard docs. The
CS> Camel and most other books on Perl mention them, but the only
CS> place in the standard docs that I'm certain has an mention by that
CS> name is in the FAQ. It's time for a little search:
why do you assume that the term 'here' will be capitalized?
CS> # grep HERE *
CS> perlfaq.pod:=item * Why don't my <<HERE documents work?
HERE is in all caps because it is the here doc token which is
traditionally in all caps.
here (sic) is the way to figure out where here docs are documented. what
type of thingy is a here doc? it is a piece of data. in fact it is just
another form of a quoted string. so where is all the forms of perl data
documented? (hint, the answer is in that question).
so here documents are documented here.
perldata.
and a grep ' <<' *.pod shows:
perldata.pod: print <<"foo", <<"bar"; # you can stack them
perldata.pod: myfunc(<<"THIS", 23, <<'THAT');
perlfaq4.pod: ($quote = <<' FINIS') =~ s/^\s+//gm;
perlop.pod: **= += *= &= <<= &&=
perlop.pod: $_ = <<'EOL';
which makes it pretty obvious where it is.
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: 2 Apr 2001 16:49:03 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Funny behavior?
Message-Id: <9aaahv$7ku$0@216.155.32.18>
In article <slrn9cgnrv.852.tadmc@tadmc26.august.net>,
tadmc@augustmail.com (Tad McClellan) wrote:
| >where does the term come from, anyway?
|
|
| "here-docs" are borrowed from the shell.
|
| I think the name is too ingrained to be changed...
...essentially because the 'document' in question is "right here" and
not somewhere else needing to be imported on the fly or built by the
script from an array of lines, or some other method, hence the name.
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: Sat, 31 Mar 2001 01:47:29 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Funny behavior?
Message-Id: <tcadphlnv86p44@corp.supernews.com>
Philip Lees <pjlees@ics.forthcomingevents.gr> wrote:
> On Fri, 30 Mar 2001 01:51:16 -0000, Chris Stith
> <mischief@velma.motion.net> wrote:
>>perldoc -q HERE
>>
>>You are supposed to check the FAQ before posting.
> Have you actually tried this? Sure, the here doc faq is in there, but
> way, way down towards the end after a number of totally irrelevant
> things such as:
Yes.
I guess since you quote my perldoc invocation, you mean that.
Whether you mean that or the code, the answer is yes. I tried
both.
> Where can I get a list of Larry Wall witticisms?
> If I tried that first off I would assume that perldoc was broken.
A substring search can show all sorts of things. Anyone moderately
interested in programming should be aware of this fact. Anyone planning
to program heavily in Perl _must_ become accustomed to this fact, since
a simple form of regex match is a substring search (when one uses just
text and no regex metas).
I could have narrowed perldoc's search further, but I also could
have given only a curt answer that `it is in the docs'. Since I offered
my time for free, I think I was within reason to limit the time I
invested in the problem. I gave a reference to where in the docs
the answer could be found, even if it was not a perfect reference.
I also gave an example at a point earlier in the post.
I don't consider it rude to remind someone how to help one's self
after offering some help and a pointer to more information. As a
matter of personal taste, I try not to be rude unless I have good
reason. ;-)
Chris
--
Christopher E. Stith
The purpose of a language is not to help you learn the
language, but to help you learn other things by using the
language. --Larry Wall, The Culture of Perl, August 1997
------------------------------
Date: Mon, 02 Apr 2001 15:29:39 -0700
From: Bryan Coon <bcoon@sequenom.com>
Subject: GD::Graph again
Message-Id: <3AC8FD53.9FFB8368@sequenom.com>
I am trying to accomplish this goal:
1. Draw something on an image using GD (successful)
2. Use same image to plot a graph on (also successful)
3. Have the graph have a certain format (not successful)
Ideally, I would like to plot a kind of density graph (I was using bars
because I thought it would be the most visible). I have 40 increments,
each increment has a value. I am trying to plot these 40 increments on
the y axis, and plot each corresponding value horizontally. A cartoon:
1 xxxx
2 xx
3 xxxxxxxxx
4 xx
5 xxxxx
I would like to have no labels, just visualization of which row has a
greater value, in this format.
Here is a chunk of my code, where the first dataset is the number of
increments, the second is the values:
#!/usr/bin/perl -w
use CGI qw(:standard);
use GD;
use GD::Graph::mixed;
use strict;
my $im = new GD::Image(500, 500);
my $white = $im->colorAllocate(255, 255, 255);
my $red = $im->colorAllocate(255, 0, 0);
my $black = $im->colorAllocate(0, 0, 0);
$im->interlaced('true');
my @data = ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 2, 5, 2, 0, 1, 0, 6,
1, 4]);
my $graph = new GD::Graph::bars(500, 500);
$graph->set( y_max_value=>40,
x_max_value=>50,
y_tick_number=>40,
y_label_skip=>2,
cumulate=>1);
my $gd = $graph->plot(\@data);
$im->copy($gd, 0, 0, 0, 0, 500, 500);
open(OUT, "> /home/dev/out.png");
print OUT $im->png;
close OUT;
I have read the GD::Graph manual and looked at all the examples, so Im
not sure this can be done with this package. If so, does anyone have
suggestions how, or if not, perhaps an alternative package that can do
this?
Thanks,
Bryan
------------------------------
Date: 2 Apr 2001 20:45:57 GMT
From: Eli the Bearded <*@qz.little-neck.ny.us>
Subject: Re: Getting Character Codes
Message-Id: <eli$0104021644@qz.little-neck.ny.us>
In comp.lang.perl.misc, <peter.reid2000@ntlworld.com> wrote:
> I'm writing a server-side login script which gets passwords from a file. This
> file won't be properly encrypted as it's not exactly that important if it
> gets 'hacked', but I'd like to do a little bit of character scrambling.
Why pretend to have security?
> Is there anyway in Perl to get the character code (Asc) of a letter and also
> return a letter from the character code (Chr)??? I would be most grateful if
> anyone could e-mail me with an answer.
ord() can get you the character code; chr() can get you a character
from a code; "\N{}" can get you a character from a name.
#!/usr/bin/perl -w
use strict;
require 5.006;
use vars qw( $chr1 $chr2 $ord );
use charnames qw( :full );
format =
char @||||| number @>>>>> chr(number) @|||||
$chr1, $ord, $chr2
.
$chr1 = "\N{LATIN CAPITAL LETTER J}";
$ord = ord($chr1);
$chr2 = chr($ord);
write;
$chr1 = "\N{SKULL AND CROSSBONES}";
$ord = ord($chr1);
$chr2 = chr($ord);
write;
__END__
char J number 74 chr(number) J
char 靠 number 9760 chr(number) 靠
Elijah
------
unicode for fun and profit
------------------------------
Date: Mon, 02 Apr 2001 23:24:00 +0100
From: Chaz Warriner <chaz.warriner@idesk.com>
Subject: Getting Mod Time While Uploading
Message-Id: <3AC8FC00.E37F299@idesk.com>
Hello,
I am trying to build a script which allows a user to upload a file to a
server via a web browser and at the same time get the file's last
modification time.
At the moment what I am doing is using a form on a web page with the
attribute 'ENCTYPE="multipart/form-data"' to upload the file to a
temporary directory on the server with the help of a Perl script.
The Perl script includes this code:-
my $buffer;
my $bytesread;
open (FHANDLE,"> $temppath$filename")or die "There has been a problem
with file creation!";
binmode(FHANDLE);
while ($bytesread=read($attachment,$buffer,1024)) {
print FHANDLE $buffer;
}
close(FHANDLE);
..and takes the $filename from the user's input via the file upload
widget in the form.
This works fine and the file is uploaded to the directory specified in
$temppath.
I can then use the -M function to get the modification time. The
problem is that the file's modification time is changed when it is
uploaded and I really want the modification time as it was on the user's
computer before being uploaded.
So, I guess my question is twofold:-
Is there any way using Perl I can get the modification time of a file on
a user's computer directly (I've tried using stat() but this only works
for files already on the server)?
OR
Is there any way to preserve the modification time of a file while
uploading it?
I'm sorry if I am attempting the impossible and missing the point in
some way but I'd be really grateful for any input on this. I am using
Perl 5.004 by the way.
Cheers from Chaz Warriner
------------------------------
Date: Mon, 2 Apr 2001 11:20:47 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: hashes keys case insensitive
Message-Id: <slrn9ch66f.8kb.tadmc@tadmc26.august.net>
Federico Abascal <fabascal@MailAndNews.com> wrote:
>
> I think I have read this in some place but I cannot remember where. Is
>there
>a way of having a hash with case insensitive keys?
Force keys to lower case when you populate the hash.
$hash{ lc $somekey } = $somevalue;
Force keys to lower case when you do a lookup:
if ( exists $hash{ lc $somekey } ) { # found it
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 3 Apr 2001 00:25:26 +0930
From: "Stephen Gray" <stephen.gray@internode.on.net>
Subject: Re: hashes keys case insensitive
Message-Id: <3ac891e8@duster.adelaide.on.net>
Hi,
Not easy I believe. The only way I have found is to lc() everything as you
read it into the hash, then use the Tie::RefHash module to tie the hash.
Once you have done this you can then use FETCH function to lc() the hash key
being requested and match the result against the hash.
Note that if the hash has other hashes nested in it you need to individually
tie each one.
I have an eg if you want it, just email me.
Regards,
Steve
"Federico Abascal" <fabascal@MailAndNews.com> wrote in message
news:3AD2B225@MailAndNews.com...
> Hello,
>
> I think I have read this in some place but I cannot remember where. Is
> there
> a way of having a hash with case insensitive keys?
>
> Thanks in advance,
>
> Federico
>
> ------------------------------------------------------------
> Get your FREE web-based e-mail and newsgroup access at:
> http://MailAndNews.com
>
> Create a new mailbox, or access your existing IMAP4 or
> POP3 mailbox from anywhere with just a web browser.
> ------------------------------------------------------------
>
------------------------------
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 V10 Issue 602
**************************************