[9450] in Perl-Users-Digest
Perl-Users Digest, Issue: 3045 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 3 15:07:18 1998
Date: Fri, 3 Jul 98 12:04:05 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 3 Jul 1998 Volume: 8 Number: 3045
Today's topics:
Bar and Line Charts in Perl (Kevin Kelly)
Re: Bar and Line Charts in Perl (Aaron B. Dossett)
Re: Bar and Line Charts in Perl (Mark-Jason Dominus)
Re: Bar and Line Charts in Perl (Albert W. Dorrington)
Re: Bar and Line Charts in Perl (Michael J Gebis)
Re: Bar and Line Charts in Perl (Larry Rosler)
Re: Bar and Line Charts in Perl (Michael J Gebis)
Re: beginner looking for example perl scripts (Sitaram Chamarty)
Beginner needs help <toml@mediacity.com>
Re: Beginner needs help (brian d foy)
Re: Beginner needs help (Craig Berry)
Boycott Amazon (was Re: Perl manuals) (Chip Salzenberg)
Bug? die() return value 5.003 vs. 5.0040[14] (Tad McClellan)
Calling c++ CookBookB::CCsimple->DESTROY from perl <sasha.romanosky@telus.com>
can glob do pattern matching like */*.c <re36648@deere.NOSPAM.com>
Re: can glob do pattern matching like */*.c <foth@informatik.uni-hamburg.de>
Re: Can't kill telnet process with Comm.pl close_it() r <spamsux-tex@habit.com>
capturing STDOUT ouput from a child process (John Kelly)
Re: capturing STDOUT ouput from a child process (Matt Knecht)
CGI, Perl and the Internet Explorer schlecno@my-dejanews.com
Re: CGI, Perl and the Internet Explorer <chris.wareham@blackwell.co.uk>
Re: CGI, Perl and the Internet Explorer <quednauf@nortel.co.uk>
Re: CGI, Perl and the Internet Explorer <quednauf@nortel.co.uk>
Re: CGI, Perl and the Internet Explorer (Bob Trieger)
changing shell <dikmen@cadence.com>
Chopping a String <azman@bnex.com>
Re: Chopping a String (Craig Berry)
Re: Chopping a String <parksh5@hanimail.com>
Re: Chopping a String (Abigail)
Re: Chopping a String (Bob Trieger)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 2 Jul 1998 16:59:42 GMT
From: kelly@whitman.edu (Kevin Kelly)
Subject: Bar and Line Charts in Perl
Message-Id: <6nge9u$s5d29@alice.whitman.edu>
I would like to make bar or line graphs that I can update daily and put on a
web page. I know about the GD.pm module, but is there anything that will
create a basic line or bar chart. I have been making these charts using
Excel, but there is no way to automate the process.
Kevin Kelly
Systems/Operations Manager
Whitman College
kelly@whitman.edu
------------------------------
Date: 2 Jul 1998 17:38:02 GMT
From: aarond@alpha.ewl.uky.edu (Aaron B. Dossett)
Subject: Re: Bar and Line Charts in Perl
Message-Id: <6ngghq$aq3$1@service3.uky.edu>
Kevin Kelly (kelly@whitman.edu) wrote:
> I would like to make bar or line graphs that I can update daily and put on a
> web page. I know about the GD.pm module, but is there anything that will
> create a basic line or bar chart. I have been making these charts using
> Excel, but there is no way to automate the process.
>
The GIFgraph module is what you need.
-Aaron
--
Aaron B. Dossett | Finger aarond@london.cslab.uky.edu for PGP key
dossett@bigfoot.com|
Comp. Sci. Senior | http://www.ewl.uky.edu/~aarond
University of Kentucky 1996 & 1998 NCAA Basketball Champions
------------------------------
Date: 2 Jul 1998 14:34:56 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Bar and Line Charts in Perl
Message-Id: <6ngjsg$aqr$1@monet.op.net>
Keywords: bouncy mangle melodramatic Nairobi
In article <6nge9u$s5d29@alice.whitman.edu>,
Kevin Kelly <kelly@whitman.edu> wrote:
>I would like to make bar or line graphs that I can update daily and put on a
>web page. I know about the GD.pm module, but is there anything that will
>create a basic line or bar chart. I have been making these charts using
>Excel, but there is no way to automate the process.
I like to use `gnuplot' for this. gnuplot accepts data on the
standard input in a very simple format, and it is easy to have Perl
open up a pipe to `gnuplot' and feed it the data. It has lots of
options for laying out the chart with dots or lines or whatever you
prefer, and for dumping the chart into a GIF file or whatever.
------------------------------
Date: 2 Jul 1998 15:17:38 -0500
From: awdorrin@mail.delcoelect.com (Albert W. Dorrington)
Subject: Re: Bar and Line Charts in Perl
Message-Id: <6ngpt2$3mf@ws051eng.ictest.delcoelect.com>
In article <6nge9u$s5d29@alice.whitman.edu>, kelly@whitman.edu (Kevin Kelly) writes:
:> I would like to make bar or line graphs that I can update daily and put on a
:> web page. I know about the GD.pm module, but is there anything that will
:> create a basic line or bar chart. I have been making these charts using
:> Excel, but there is no way to automate the process.
:>
:> Kevin Kelly
Kevin,
Check out 'pgplot' package for Perl I've been using
that for about two years now (along with the Statistics::Descriptive
module) to generate historgrams in GIF format. Engineers at my site
can then view the GIF files via a web browser.
If you'd like more details, let me know.
- Al
--
Al Dorrington
FIRMS & Web Admin, Oracle DBA Phone: 765-451-9655
IC-DELCO CIM, Delphi Delco Electronics Systems Fax: 765-451-8230
------------------------------
Date: 2 Jul 1998 20:33:06 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Bar and Line Charts in Perl
Message-Id: <6ngqq2$m36@mozo.cc.purdue.edu>
aarond@alpha.ewl.uky.edu (Aaron B. Dossett) writes:
}Kevin Kelly (kelly@whitman.edu) wrote:
}> I would like to make bar or line graphs that I can update daily and put on a
}> web page. I know about the GD.pm module, but is there anything that will
}> create a basic line or bar chart. I have been making these charts using
}> Excel, but there is no way to automate the process.
}>
}The GIFgraph module is what you need.
Oh sure, in this age of "icons" and "windows", it's perfectly
reasonable to throw a gif at the problem. But bar graphs?
<pre>
111111111111111111111111111111111
111111111111111111111111111111111 Cats
111111111111111111111111111111111
222222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222222222 Dogs
222222222222222222222222222222222222222222222222222222222222222222
333333333
333333333 Lizards
333333333
</pre>
Do you want to hear my idea about how to do pie graphs?
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Thu, 2 Jul 1998 14:01:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Bar and Line Charts in Perl
Message-Id: <MPG.1005950ab1d594b49896e3@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <6ngqq2$m36@mozo.cc.purdue.edu> on 2 Jul 1998 20:33:06 GMT,
Michael J Gebis <gebis@albrecht.ecn.purdue.edu> says...
...
> Oh sure, in this age of "icons" and "windows", it's perfectly
> reasonable to throw a gif at the problem. But bar graphs?
>
> <pre>
> 111111111111111111111111111111111
> 111111111111111111111111111111111 Cats
> 111111111111111111111111111111111
>
> 222222222222222222222222222222222222222222222222222222222222222222
> 222222222222222222222222222222222222222222222222222222222222222222 Dogs
> 222222222222222222222222222222222222222222222222222222222222222222
>
> 333333333
> 333333333 Lizards
> 333333333
> </pre>
>
> Do you want to hear my idea about how to do pie graphs?
Yes.
As long as we are talking HTML, I do this prettier by (trick!) varying
the WIDTH=... parameter of a solid-colored rectangular gif.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 2 Jul 1998 22:58:48 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Bar and Line Charts in Perl
Message-Id: <6nh3b8$p6a@mozo.cc.purdue.edu>
lr@hpl.hp.com (Larry Rosler) writes:
}In article <6ngqq2$m36@mozo.cc.purdue.edu> on 2 Jul 1998 20:33:06 GMT,
}Michael J Gebis <gebis@albrecht.ecn.purdue.edu> says...
}...
}> Oh sure, in this age of "icons" and "windows", it's perfectly
}> reasonable to throw a gif at the problem. But bar graphs?
}>
}> Do you want to hear my idea about how to do pie graphs?
}Yes.
The "You've got to fill in a lot of blanks explination:"
You've got a 48x24 grid. For each point on the grid, calculate the
polar co-ordinates. If it's inside the proper radius, color it based
upon the angle.
My brother actually wrote one of these back in the perl4 days. What
can I say? It was pretty cool.
Actually, the RIGHT way to do this is to create a 2-d ray-tracer, that
has primitives such as "polygon", "elipse", "plane", and allow all the
standard things that ray-tracers allow. Then the graph would be nothing
more than a few elipses clipped by half-planes.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: 3 Jul 98 18:32:54 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: beginner looking for example perl scripts
Message-Id: <slrn6pq8hh.7ep.sitaram@ltusitaram.diac.com>
On 29 Jun 1998 17:22:05 GMT, Tom Christiansen <tchrist@mox.perl.com> wrote:
>#!/usr/bin/perl
># lst - list sorted directory contents (depth first)
[snip]
Wow - thanks!
May I suggest a minor patch? The aliasing for $name and $_ should
be independant of $opt_i, IMHO, since a plain
lst.pl -l
gets just the "." entry, with the info for the last file found by
find.pm, and not that for "." itself.
--- lst.pl Fri Jul 3 12:15:58 1998
+++ lst.pl Fri Jul 3 12:15:53 1998
@@ -40,14 +40,15 @@
*name = \$File::Find::name; # forcibly import that variable
# the $opt_i flag tricks wanted into taking
# its filenames from ARGV instead of being
+# ^^^^ should be STDIN, maybe??
# called from find.
+*name = *_; # $name now alias for $_
if ($opt_i) {
- *name = *_; # $name now alias for $_
while (<>) { chomp; &wanted; } # ok, not stdin really
} else {
find(\&wanted, @ARGV);
}
------------------------------
Date: Thu, 02 Jul 1998 09:32:04 -0700
From: Tom Leitner <toml@mediacity.com>
Subject: Beginner needs help
Message-Id: <359BB604.A5DA1156@mediacity.com>
Send e-mail to toksovo@hotmail.com
I really need help a script index.cgi
that will redirect users to specific sites based on their IP address.
ips and urls should be stored in a file. the script will match the ip
to the ip in file and redirect to corresponding site.
I know how to do it in C not in perl.
I need someone to help me with syntax.
1:
load ips and urls from files in 2 arrays.
loop the array of ips looking for the visitors ip, if match found
direct to the correspondent page. if not give a message.
Thanx in advance
------------------------------
Date: Thu, 02 Jul 1998 12:53:23 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Beginner needs help
Message-Id: <comdog-ya02408000R0207981253230001@news.panix.com>
Keywords: from just another new york perl hacker
In article <359BB604.A5DA1156@mediacity.com>, Tom Leitner <toml@mediacity.com> posted:
>I really need help a script index.cgi
>that will redirect users to specific sites based on their IP address.
>ips and urls should be stored in a file. the script will match the ip
>to the ip in file and redirect to corresponding site.
>I know how to do it in C not in perl.
>I need someone to help me with syntax.
>load ips and urls from files in 2 arrays.
why arrays? seems perfect for a hash.
salt to taste :)
#!/usr/bin/perl -w
use strict;
#this comes from the CGI, so you won't need to assign to it.
$ENV{'REMOTE_ADDR'} = '166.84.185.27';
my $address = "http://www.americanexpress.com";
my %where_to_you_want_to_go_today;
#there are all sorts of things you could do for this part.
while( <DATA> )
{
chomp;
my($ip, $url) = split;
#store the IP -> URL mapping in a hash
$where_to_you_want_to_go_today{$ip} = $url;
}
#choose the redirection address
$address = $where_to_you_want_to_go_today{ $ENV{REMOTE_ADDR} }
if defined $where_to_you_want_to_go_today{ $ENV{REMOTE_ADDR} };
#send along the redirection response
print <<"HTTP";
Status: 302 Come Back Here Next Time
Location: $address
Content-type: text/html
<a href="$address">It's everywhere you want to be.</a>
HTTP
__DATA__
166.84.185.27 http://www.movielink.com/
18.85.40.23 http://www.redsox.com/
206.67.186.65 http://www.bassale.com/
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>
------------------------------
Date: 2 Jul 1998 16:53:56 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Beginner needs help
Message-Id: <6ngdv4$39p$1@marina.cinenet.net>
Tom Leitner (toml@mediacity.com) wrote:
: Send e-mail to toksovo@hotmail.com
Nope. Ask here, get answer here. Unless you're interested in my
attractive private-consultation rates... :)
: I really need help a script index.cgi
: that will redirect users to specific sites based on their IP address.
: ips and urls should be stored in a file. the script will match the ip
: to the ip in file and redirect to corresponding site.
: I know how to do it in C not in perl.
OK, then, your problem is one of taking an algorithm you understand and
implementing it in Perl. That, quite frankly, involves learning Perl.
The 'Llama book' (_Learning Perl_, Schwartz & Christiansen) is (IMO) the
best resource for doing this.
: I need someone to help me with syntax.
You're far more likely to get help if you learn enough Perl to try it on
your own, then post here with questions or problems that arise in the
process. Be sure to include code snippets that illustrate what you're
talking about.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Fri, 03 Jul 1998 09:08:27 GMT
From: chip@pobox.com (Chip Salzenberg)
Subject: Boycott Amazon (was Re: Perl manuals)
Message-Id: <6ni754$b1$1@cyprus.atlantic.net>
According to nospam@cableinet.co.uk:
>"The Bookseller" (in association with Amazon.com)
Amazon.com spams (and, no, I don't just mean the referenced article).
I don't plan to patronize them until they renounce opt-out bulk mail.
See news.admin.net-abuse.email for discussion if you're inclined.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"I brought the atom bomb. I think it's a good time to use it." //MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: Thu, 2 Jul 1998 22:54:44 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Bug? die() return value 5.003 vs. 5.0040[14]
Message-Id: <4mkhn6.8g7.ln@localhost>
I get different results from the below scripts when 'inner' uses
perl5.003 vs. perl5.0040[14].
die() does not seem to be doing what perlfunc says it will do...
-------------------- test_driver --------------------
#!/bin/sh
# test_driver
echo "using 5.00404 in both scripts:"
echo
outer
perl -p -i -e 's/perl5.00404/perl5.00401/' inner
echo "-----"
echo "using 5.00401 in inner:"
echo
outer
perl -p -i -e 's/perl5.00401/perl5.003/' inner
echo "-----"
echo "using 5.003 in inner:"
echo
outer
# put inner back to 5.00404
perl -p -i -e 's/perl5.003/perl5.00404/' inner
-------------------- output (annotated) --------------------
using 5.00404 in both scripts:
./outer: calling inner
./inner: calling fail.sh
fail.sh'ing
./inner: fail.sh errno ($!) was: 0x00
./inner: fail.sh return status ($?) was: 0x01
./inner: dieing because fail.sh died
./outer: inner errno ($!) was: 0x00
./outer: inner return status ($?) was: 0x00
./outer: succeeding because inner succeeded.
-----
using 5.00401 in inner:
./outer: calling inner
./inner: calling fail.sh
fail.sh'ing
./inner: fail.sh errno ($!) was: 0x00
./inner: fail.sh return status ($?) was: 0x01
./inner: dieing because fail.sh died
./outer: inner errno ($!) was: 0x00
./outer: inner return status ($?) was: 0x00 <=====
./outer: succeeding because inner succeeded.
-----
using 5.003 in inner:
./outer: calling inner
./inner: calling fail.sh
fail.sh'ing
./inner: fail.sh errno ($!) was: 0000
./inner: fail.sh return status ($?) was: 0x01
./inner: dieing because fail.sh died
./outer: inner errno ($!) was: 0x00
./outer: inner return status ($?) was: 0x01 <=====
./outer: dieing because inner died
-------------------- fail.sh --------------------
#!/bin/sh
# fail.sh
echo " fail.sh'ing"
exit 1
-------------------- outer --------------------
#!/usr/bin/perl5.00404 -w
# outer
print "$0: calling inner\n";
system('inner');
$err = ($? >> 8);
$errno = $!;
printf("$0: inner errno (\$!) was: %#04x\n", $errno);
printf("$0: inner return status (\$?) was: %#04x\n", $err);
$err && die "$0: dieing because inner died\n";
print "$0: succeeding because inner succeeded.\n";
exit 0;
-------------------- inner --------------------
#!/usr/bin/perl5.00404 -w
# inner
print " $0: calling fail.sh\n";
system('fail.sh');
$err = ($? >> 8);
$errno = $!;
printf(" $0: fail.sh errno (\$!) was: %#04x\n", $errno);
printf(" $0: fail.sh return status (\$?) was: %#04x\n", $err);
$err && die " $0: dieing because fail.sh died\n";
print " $0: succeeding because fail.sh succeeded.\n";
exit 0;
-------------------- perl5.003 -V --------------------
Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration:
Platform:
osname=linux, osver=2.0.18, archname=i586-linux
uname='linux porky 2.0.18 #1 sun sep 8 16:03:06 edt 1996 i586 '
hint=recommended, useposix=true, d_sigaction=define
Compiler:
cc='cc', optimize='-O2', gccversion=2.7.2
cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
stdchar='char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=4, usemymalloc=n, randbits=31
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lndbm -lgdbm -ldb -ldl -lm -lc
libc=/lib/libc.so.5.3.12, so=so
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
@INC: /usr/lib/perl5/i386-linux/5.003 /usr/lib/perl5 /usr/lib/perl5/site_perl/i586-linux /usr/lib/perl5/site_perl .
-------------------- perl5.00404 -V --------------------
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
Platform:
osname=linux, osvers=2.0.27, archname=i586-linux
uname='linux magna 2.0.27 #4 thu dec 26 12:34:51 cst 1996 i586 '
hint=recommended, useposix=true, d_sigaction=define
bincompat3=y useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-O2', gccversion=2.7.2.1.f.1
cppflags='-Dbool=char -DHAS_BOOL'
ccflags ='-Dbool=char -DHAS_BOOL'
stdchar='char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lndbm -lgdbm -ldb -ldl -lm -lc
libc=/lib/libc.so.5.4.7, so=so
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Built under linux
Compiled at Jun 30 1998 11:25:54
@INC:
/usr/lib/perl5/i586-linux/5.00404
/usr/lib/perl5
/usr/lib/perl5/site_perl/i586-linux
/usr/lib/perl5/site_perl
.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 03 Jul 1998 10:10:31 -0600
From: Sasha Romanosky <sasha.romanosky@telus.com>
Subject: Calling c++ CookBookB::CCsimple->DESTROY from perl
Message-Id: <359D0276.C788C832@telus.com>
I have a simple question surrounding the DESTROY method of the
perl CookBookB::CCSimple package: how can you properly DESTROY
a newly instantiated object?
Let me explain:
My package is called 'sasha'. (what else? :)
It compiles and runs fine, normally.
It is essentially the same as the standard CookBookB::CCsimple package
available from
http://theory.uwinnipeg.ca/CPAN/data/CookBookB/DevelPeek.html
typemap:
TYPEMAP
color* O_OBJECT
# O_OBJECT -> link an opaque C or C++ object to a blessed Perl
object.
OUTPUT
O_OBJECT
sv_setref_pv( $arg, CLASS, (void*)$var );
INPUT
O_OBJECT
if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
$var = ($type)SvIV((SV*)SvRV( $arg ));
else{
warn( \"${Package}::$func_name() -- $var is not a
blessed SV reference\" );
XSRETURN_UNDEF;
}
-------------------------------------
sasha.xs
#ifdef __cplusplus
extern "C" {
#endif
#include <iostream.h>
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#ifdef __cplusplus
}
#endif
class color {
private:
int col;
public:
color() : col(0) { cout << "Constructing color" << endl; }
~color() { col = 0; cout << "Destructing color" << endl; }
void set_color(int invar) { col = invar; }
get_color() { return col; }
};
MODULE = sasha PACKAGE = sasha
color *
color::new()
void
color::DESTROY()
CODE:
delete THIS;
int
color::get_color()
void
color::set_color(invar)
int invar
-------------------------------------
test.pl:
#!/usr/local/bin/perl
use sasha;
$a = sasha->new;
$a->set_color(55);
$val = $a->get_color();
print "Color value is [$val]\n";
sasha->DESTROY;
-------------------------------------
The only significant changes are in the sasha.xs file;
void
color::DESTROY()
CODE:
delete THIS;
and in the test.pl file;
sasha->DESTROY;
All I need to do is have the perl program create the new object ($a) of
type 'color' - which it does. Then to set a color and get the color -
which
it does also. Great. Now, I want it to specifically destroy the object
and
exit the program.
Note:It does destroy the object - but only once the program exists. I
don't
want this. I want perl to destroy the object when I tell it (with
sasha->DESTROY).
When I run a make test, I get the following result:
[~/code]$ make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl -I./blib/arch -I./blib/lib
-I/usr/local/lib/perl5/sun4-solaris/5.00401 -I/usr/local/lib/perl5
test.pl
Constructing color
Color value is [55]
sasha::DESTROY() -- THIS is not a blessed SV reference at test.pl line
10.
Destructing color
I have tried many variations on the code with no more success than
different
error messages. I am hopping that this is a trivial error and easily
fixed.
How can I specifically call the color destructor and destroy this object
without
having to exit the program?????
Anyassistance is greatly appreciated!
cheers,
Sasha Romanosky
sasha.romanosky@telus.com
------------------------------
Date: Thu, 2 Jul 1998 15:28:44 -0500
From: "Dave Smart" <re36648@deere.NOSPAM.com>
Subject: can glob do pattern matching like */*.c
Message-Id: <6ngqhp$n91@proxy1.dpn.deere.com>
can glob do pattern matching like that shown below?
@files = glob("*.c"); # This works
@files = glob("*/*.c"); # This does not work to iterate all next level
sub-dirs.
I'm thinking the answer is no, but perhaps it's possible, but not with
v5.004_02 on NT.
Is there an elegant way to do this?
thanks,
------------------------------
Date: 3 Jul 1998 17:50:51 GMT
From: Kilian Foth <foth@informatik.uni-hamburg.de>
Subject: Re: can glob do pattern matching like */*.c
Message-Id: <6nj5lr$90m$1@rzsun02.rrz.uni-hamburg.de>
Dave Smart <re36648@deere.NOSPAM.com> wrote:
> can glob do pattern matching like that shown below?
> @files = glob("*/*.c"); # This does not work to iterate all next level
Try: perl -we 'for (<*/*>) {print "$_\n"}'
------------------------------
Date: Wed, 01 Jul 1998 23:59:03 +0800
From: Austin Schutz <spamsux-tex@habit.com>
Subject: Re: Can't kill telnet process with Comm.pl close_it() routine
Message-Id: <359A5CC7.1DE2@habit.com>
> > I'm trying to use Net::Telnet and Comm.pl to build a script that
> > will log on another computer with telnet, then hand over the telnet
> > session to me so I can work interactively on the other computer.
You might try using Expect.pm instead of Comm.pl. It has some
nice features like working on non-Sun Unixes. (Just not HP-UX yet :-P )
>
> Well if you're using X, why not just use Net::Telnet to login, set the
> environment variables you want, and start an xterm displayed on the X
> server where you're working?
>
Net::Telnet would be more portable as well.
Austin
------------------------------
Date: Thu, 02 Jul 1998 19:14:55 GMT
From: john.kelly@citicorp.com (John Kelly)
Subject: capturing STDOUT ouput from a child process
Message-Id: <359ddbde.20824514@news.citicorp.com>
I'm having a problem getting results back from a child process.
The following script does not have anything returned into @return, the
messages I get are echoed to STDOUT. I thought at least a pipe would
have solved this problem. I can get the output from commands like ls,
date etc but there are other utilities that it wont work. How can I
capture a child process output all the time?
Thanks,
John
snip from perl script
print "dd tape\n";
# I have used either
@return=`dd if=/dev/rmt/0m of=/dev/null`;
# or
open (PIPE,"dd if=/dev/rmt/0m of=/dev/null bs=1024 | ") or die
"Cant create pipe $!";
@return=<PIPE> ;
# and nothing is returned to @return
print "RETURN of dd was @return \n";
# when the script is run I get
rewinding tape
dd tape
The following comes from dd not perl
1+0 records in
1+0 records out
The perl program does not have anything in return
RETURN of dd was
------------------------------
Date: Thu, 02 Jul 1998 19:49:20 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: capturing STDOUT ouput from a child process
Message-Id: <4vRm1.89$Du.948694@news2.voicenet.com>
John Kelly <john.kelly@citicorp.com> wrote:
>the
>messages I get are echoed to STDOUT.
Are you sure about that?
The default behaviour of dd is to take a file on STDIN and copy it to
STDOUT. Using 'if' and 'of' overides this, but doesn't change where
dd's diagnostic messages go (to STDERR).
> @return=`dd if=/dev/rmt/0m of=/dev/null`;
Try this instead:
@return=`dd if=/dev/rmt/0m of=/dev/null 2>&1`;
Which does the trick under bash.
--
Matt Knecht - <hex@voicenet.com>
"496620796F752063616E207265616420746869732C20796F7520686176652066
617220746F6F206D7563682074696D65206F6E20796F75722068616E6473210F"
------------------------------
Date: Fri, 03 Jul 1998 12:53:49 GMT
From: schlecno@my-dejanews.com
Subject: CGI, Perl and the Internet Explorer
Message-Id: <6nik8t$2ba$1@nnrp1.dejanews.com>
I have a newbie-question which was surely asked many times before, but
i was not able to fix that problem, yet.
I try to run a Perl program with CGI under WinowsNT 4.0. A Personal WebServer
is installed and i created a directory named cgi-bin in that server directory.
My HTML script is a simple form:
<form action="formtest1.pl" method="POST">
Name:
<input type="text" name="Telefon"><P>
<input type="submit">
</form>
and my Perl Script named formtest1.pl:
print "Content-type: text/html\n\n";
print "<html>";
print "<head>";
print "</head>";
print "<body>";
print "Hello, World!\n";
print "</body>";
print "</html>";
But every time i start it, it opens a window to download that file or an error
405 is displayed.
A method is not allowed and i should check the mame type.
Where is the mistake?
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 03 Jul 1998 13:57:26 GMT
From: Chris Wareham <chris.wareham@blackwell.co.uk>
Subject: Re: CGI, Perl and the Internet Explorer
Message-Id: <359CE3DB.EBBADD5B@blackwell.co.uk>
schlecno@my-dejanews.com wrote:
>
> I have a newbie-question which was surely asked many times before, but
> i was not able to fix that problem, yet.
>
If you're pretty sure it's been asked many times before, then please check
the FAQ or buy a good book on CGI programming (the O'Reilly one?).
>
> <form action="formtest1.pl" method="POST">
> Name:
> <input type="text" name="Telefon"><P>
> <input type="submit">
> </form>
>
CGI questions are best asked on a CGI newsgroup. However, at a guess I'd
say you want to move the script to your CGI directory, not your HTML
directory. This is were the webserver allows a client to execute stuff.
<form action"/cgi/formtest1.pl method="POST">
I recall that IIS (and maybe Personal Web Server) needs some obscure
registry setting to execute Perl CGI scripts.
Chris
--
chris.wareham@blackwell.co.uk
+44 (0)1865 792792 ext. 3381
------------------------------
Date: Fri, 03 Jul 1998 15:08:00 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: CGI, Perl and the Internet Explorer
Message-Id: <359CE5C0.4A14FFBC@nortel.co.uk>
schlecno@my-dejanews.com wrote:
>
> I have a newbie-question which was surely asked many times before, but
> i was not able to fix that problem, yet.
>
> I try to run a Perl program with CGI under WinowsNT 4.0. A Personal WebServer
> is installed and i created a directory named cgi-bin in that server directory.
This a webserver issue. Luckily you can refer to the win32 for perl FAQ, which
addresses issues related to the dreaded Personal Webserver, or rather the IIS,
which in many respects should be similar. You'll find a link to the faq
somewhere at
<click me, click me> http://www.perl.com </click me, click me>
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Fri, 03 Jul 1998 15:16:45 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: CGI, Perl and the Internet Explorer
Message-Id: <359CE7CD.ABA7A8B7@nortel.co.uk>
F.Quednau wrote:
>
>
> Luckily you can refer to the win32 for perl FAQ, ...
^^^^^^^^^^^^^^
Oh my God, I think I have to re-evaluate my world-view...:)
------------------------------
Date: Fri, 03 Jul 1998 17:14:01 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: CGI, Perl and the Internet Explorer
Message-Id: <6nj3ko$en4$1@ligarius.ultra.net>
[ posted and mailed ]
schlecno@my-dejanews.com wrote:
-> I have a newbie-question which was surely asked many times before, but
-> i was not able to fix that problem, yet.
Not a newbie question, a Frequently Asked Question. For answers to FAQs,
people should check the appropriate FAQs. If you checked the perl FAQs, you
would have noticed nothing like this and figure out that it has nothing to do
with perl.
>>>>> HTML snipped <<<<<
->
-> But every time i start it, it opens a window to download that file or an
-> error
-> 405 is displayed.
-> A method is not allowed and i should check the mame type.
That is an HTTP server error, not a perl error. Check the documentation for
your server or the newsgroup(s) that deal with HTTP servers.
-> Where is the mistake?
Mistake is looking in wrong place for help.
try:
news:comp.infosystems.www.servers.ms-windows
news:microsoft.public.inetserver.misc
http://www.microsoft.com
HTH
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-286-0591
and let the jerk that answers know that his
toll free number was sent as spam. "
------------------------------
Date: Thu, 02 Jul 1998 18:31:36 -0400
From: Ozkan Dikmen <dikmen@cadence.com>
Subject: changing shell
Message-Id: <359C0A48.7AE95777@cadence.com>
Hi guys,
I'm a pretty new Perl programmer and have a problem about shell
change:
In the script that I wrote, I execute a few comands and then the next
command
causes the current shell to change (there is no way to get around this
command)
Then, the script stops running. If I manually press ^D, I exit the shell
and the rest of
script is executed.
What I want is: after changing the shell, the script should continue
executing
in the new shell.
How can I achieve this?
Please send your answers to my mailing address too
Ozkan Dikmen
dikmen@cadence.com
------------------------------
Date: Thu, 02 Jul 1998 12:51:40 +0800
From: Azman Shariff <azman@bnex.com>
Subject: Chopping a String
Message-Id: <359B11DC.378A6760@bnex.com>
I have a question and hope any good soul out here would help me. (FYI I
am an amuture in PERL)
I have a string that is about 500 characters long.
I need to chop it to a few other strings that is limited to about 50
characters. How do i go about it?
Azman
------------------------------
Date: 3 Jul 1998 05:16:30 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Chopping a String
Message-Id: <6nhpfe$ju8$1@marina.cinenet.net>
Azman Shariff (azman@bnex.com) wrote:
: I have a string that is about 500 characters long.
:
: I need to chop it to a few other strings that is limited to about 50
: characters. How do i go about it?
Here's one way:
@pieces = $string =~ /(.{1,50})/g;
That will put 50-character chunks of $string into successive elements of
@pieces until there's less than 50 chars remaining; all those leftover
chars go into the last element of @pieces.
Add the s option to the match if $string can have embedded newlines.
If you want to split the string up 'intelligently' (say, at the last
whitespace before 50 chars), see Text::Wrap.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 3 Jul 1998 07:23:31 GMT
From: Sunhyo Park <parksh5@hanimail.com>
Subject: Re: Chopping a String
Message-Id: <6ni0tj$f42$1@news.kornet.nm.kr>
In article <359B11DC.378A6760@bnex.com> Azman Shariff <azman@bnex.com>wrote
I am an amateur in English.
I suggest that you use 'substr($_,<start position>,<offset>)'
If your string is
------------------------------
Date: 3 Jul 1998 09:52:22 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Chopping a String
Message-Id: <6ni9km$dg5$3@client3.news.psi.net>
Azman Shariff (azman@bnex.com) wrote on MDCCLXVI September MCMXCIII in
<URL: news:359B11DC.378A6760@bnex.com>:
++ I have a question and hope any good soul out here would help me. (FYI I
++ am an amuture in PERL)
++
++ I have a string that is about 500 characters long.
++
++ I need to chop it to a few other strings that is limited to about 50
++ characters. How do i go about it?
substr, //g, or even split.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
------------------------------
Date: Fri, 03 Jul 1998 13:23:11 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Chopping a String
Message-Id: <6nim3u$8oq$1@strato.ultra.net>
[ posted and mailed ]
Azman Shariff <azman@bnex.com> wrote:
-> I have a question and hope any good soul out here would help me. (FYI I
-> am an amuture in PERL)
->
-> I have a string that is about 500 characters long.
->
-> I need to chop it to a few other strings that is limited to about 50
-> characters. How do i go about it?
->
-> Azman
->
If it is a text string with spaces, check out the Text::Wrap module.
Else @array = split /(.{50})/,$your_string;
HTH
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-286-0591
and let the jerk that answers know that his
toll free number was sent as spam. "
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 3045
**************************************