Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Creating Graphs Dynamically with Perl

2 views
Skip to first unread message

Hi

unread,
Mar 13, 2006, 10:10:26 AM3/13/06
to
How do I create graphs that look like MRTG dynamically with perl? Are there
any easy ways to do that?

Matt


A. Sinan Unur

unread,
Mar 13, 2006, 10:30:07 AM3/13/06
to
"Hi" <no@spam> wrote in news:121b2r8...@corp.supernews.com:

> How do I create graphs that look like MRTG dynamically with perl? Are
> there any easy ways to do that?

What is MRTG?

Have you seen the posting guidelines for this group?

Sinan
--
A. Sinan Unur <1u...@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

xho...@gmail.com

unread,
Mar 13, 2006, 10:43:27 AM3/13/06
to
"Hi" <no@spam> wrote:
> How do I create graphs that look like MRTG dynamically with perl? Are
> there any easy ways to do that?

I had no idea what MRTG was, so I googled on it. The first hit said "MRTG
is written in perl and works on Unix/Linux as well as Windows and even
Netware systems". So my guess would be that to do something like MRTG in
Perl, you would use MRTG. If you already tried that and encountered
problems, then what were the problems?

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB

Dr.Ruud

unread,
Mar 13, 2006, 10:55:55 AM3/13/06
to
Hi schreef:

> How do I create graphs that look like MRTG dynamically with perl?
> Are there any easy ways to do that?

Search for RRD in CPAN?

--
Affijn, Ruud

"Gewoon is een tijger."
echo 014C8A26C5DB87DBE85A93DBF |perl -pe 'tr/0-9A-F/JunkshoP cartel,/'

John Bokma

unread,
Mar 13, 2006, 11:01:11 AM3/13/06
to
"A. Sinan Unur" <1u...@llenroc.ude.invalid> wrote:

> MRTG

http://www.google.com/search?q=MRTG

--
John Experienced Perl programmer: http://castleamber.com/

John Bokma

unread,
Mar 13, 2006, 11:02:57 AM3/13/06
to
"Hi" <no@spam> wrote:

> How do I create graphs that look like MRTG dynamically with perl? Are
> there any easy ways to do that?

If you mean http://www.stat.ee.ethz.ch/mrtg/
yes.

http://search.cpan.org/search?query=GD-Graph&mode=module
might be an option.

John Bokma

unread,
Mar 13, 2006, 11:04:02 AM3/13/06
to
xho...@gmail.com wrote:

> "Hi" <no@spam> wrote:
>> How do I create graphs that look like MRTG dynamically with perl?
>> Are there any easy ways to do that?
>
> I had no idea what MRTG was, so I googled on it. The first hit said
> "MRTG is written in perl and works on Unix/Linux as well as Windows
> and even Netware systems".

Aargh, overlooked that small fact (written in Perl).

A. Sinan Unur

unread,
Mar 13, 2006, 12:04:10 PM3/13/06
to
John Bokma <jo...@castleamber.com> wrote in
news:Xns978565EB34...@130.133.1.4:

> "A. Sinan Unur" <1u...@llenroc.ude.invalid> wrote:
>
>> MRTG
>
> http://www.google.com/search?q=MRTG

What is your point?

John Bokma

unread,
Mar 13, 2006, 1:25:02 PM3/13/06
to
"A. Sinan Unur" <1u...@llenroc.ude.invalid> wrote:

> John Bokma <jo...@castleamber.com> wrote in
> news:Xns978565EB34...@130.133.1.4:
>
>> "A. Sinan Unur" <1u...@llenroc.ude.invalid> wrote:
>>
>>> MRTG
>>
>> http://www.google.com/search?q=MRTG
>
> What is your point?

Did you read the posting guidelines, especially

"Do not use these guidelines as a "license to flame" or other
meanness. It is possible that a poster is unaware of things
discussed here. Give them the benefit of the doubt, and just
help them learn how to post, rather than assume "

Since MRTG is written in Perl, some people here might know that MRTG =
Perl, and are able to answer the question. You don't, so don't hide behind
the posting guidelines. If you don't want to look it up using Google, why
waste your time on repeating the old guideline mantra?

Hi

unread,
Mar 13, 2006, 2:32:15 PM3/13/06
to
My mistake. Thought everyone knew what MRTG was. Not sure why I thought
that. Anyway. I have some data and I want to use perl to make some nice
pretty graphs that look something like this.

http://www.linux.cz/stats/mrtg-rrd/eth0-day.png

I think I found what might be the solution.

http://search.cpan.org/~mverb/GDGraph-1.43/

Any other easy to use perl ways to make graphs like this out there?

Matt

Dr.Ruud

unread,
Mar 13, 2006, 2:46:20 PM3/13/06
to
Hi schreef:


Please don't top-post.

> [...] I want to use perl to


> make some nice pretty graphs that look something like this.
> http://www.linux.cz/stats/mrtg-rrd/eth0-day.png
> I think I found what might be the solution.
> http://search.cpan.org/~mverb/GDGraph-1.43/
> Any other easy to use perl ways to make graphs like this out there?

http://search.cpan.org/~mschilli/RRDTool-OO-0.13/

Abigail

unread,
Mar 13, 2006, 3:00:44 PM3/13/06
to
Hi (no@spam) wrote on MMMMDLXXVII September MCMXCIII in
<URL:news:121b2r8...@corp.supernews.com>:

}} How do I create graphs that look like MRTG dynamically with perl? Are there
}} any easy ways to do that?


I'm quite charmed by gnuplot, and I use it exclusively to create graphs.
But it uses a pipe (Eeew!) to an external program (Eeew!) and doesn't
use a module (Eeew!). So most people consider me a heretic.

Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");

John Bokma

unread,
Mar 13, 2006, 3:28:54 PM3/13/06
to
Abigail <abi...@abigail.nl> wrote:


> I'm quite charmed by gnuplot, and I use it exclusively to create
> graphs. But it uses a pipe (Eeew!) to an external program (Eeew!) and
> doesn't use a module (Eeew!). So most people consider me a heretic.

So I probably shouldn't write here that I use Ant to run a few Perl tasks,
one using pscp to upload some files :-P

Andrzej Adam Filip

unread,
Mar 13, 2006, 3:34:57 PM3/13/06
to
"Hi" <no@spam> writes:

> How do I create graphs that look like MRTG dynamically with perl?
> Are there any easy ways to do that?

Have you seen rrdtool?
It is mrtg successor. The program can accept commands via stdin
(one command per line) or you can use special perl module to do it.

--
[pl2en Andrew] Andrzej Adam Filip : an...@priv.onet.pl : an...@xl.wp.pl
http://anfi.homeunix.net/

A. Sinan Unur

unread,
Mar 13, 2006, 3:37:20 PM3/13/06
to
"Hi" <no@spam> wrote in news:121bi68...@corp.supernews.com:

> My mistake. Thought everyone knew what MRTG was.

That's OK, but it is a good idea to give a URL when you are talking
about a specific software package.

Another good idea is to trim your reply, and put your responses
interspersed with the relevant sections of previous posts. See the
posting guidelines for further suggestions on how to quote.

> Anyway. I have some data and I want to use perl to
> make some nice pretty graphs that look something like this.
>
> http://www.linux.cz/stats/mrtg-rrd/eth0-day.png
>
> I think I found what might be the solution.
>
> http://search.cpan.org/~mverb/GDGraph-1.43/
>
> Any other easy to use perl ways to make graphs like this out there?

I would recommend starting with GD::Graph.

Abigail

unread,
Mar 13, 2006, 3:37:25 PM3/13/06
to
John Bokma (jo...@castleamber.com) wrote on MMMMDLXXVII September MCMXCIII
in <URL:news:Xns9785934F0B...@130.133.1.4>:

`` Abigail <abi...@abigail.nl> wrote:
``
``
`` > I'm quite charmed by gnuplot, and I use it exclusively to create
`` > graphs. But it uses a pipe (Eeew!) to an external program (Eeew!) and
`` > doesn't use a module (Eeew!). So most people consider me a heretic.
``
`` So I probably shouldn't write here that I use Ant to run a few Perl tasks,
`` one using pscp to upload some files :-P
``


I use 'make' to run all kinds of programs, including Perl programs.
I have replaced Perl programs by Makefiles (or Makefile targets)
more than once.

make rules.

Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"

Dr.Ruud

unread,
Mar 13, 2006, 3:41:48 PM3/13/06
to
Abigail schreef:
> Hi:

>> How do I create graphs that look like MRTG dynamically with perl?
>> Are there any easy ways to do that?
>
> I'm quite charmed by gnuplot, and I use it exclusively to create
> graphs.
> But it uses a pipe (Eeew!) to an external program (Eeew!) and doesn't
> use a module (Eeew!). So most people consider me a heretic.

MRTG-like gnuplots:
http://www.atd.ucar.edu/cgi-bin/weather.cgi

I still like PEAR_Image_Graph a lot:
http://pear.veggerby.dk/
http://pear.veggerby.dk/samples/
http://pear.php.net/package/Image_Graph/

Kraven

unread,
Mar 13, 2006, 4:36:57 PM3/13/06
to
Abigail wrote:
> Hi (no@spam) wrote on MMMMDLXXVII September MCMXCIII in
> <URL:news:121b2r8...@corp.supernews.com>:
> }} How do I create graphs that look like MRTG dynamically with perl? Are there
> }} any easy ways to do that?
>
>
> I'm quite charmed by gnuplot, and I use it exclusively to create graphs.
> But it uses a pipe (Eeew!) to an external program (Eeew!) and doesn't
> use a module (Eeew!). So most people consider me a heretic.
>
>
>
> Abigail
You mean a pipe like

#!/usr/bin/perl -w
use strict;
my $somefile = "/path/to/somefile";
my $pid = open Apipe, "| cat $somefile|less";
close(Apipe);

but surely not...

system("cat $somefile|less");

Abigail

unread,
Mar 13, 2006, 4:53:17 PM3/13/06
to
Kraven (kra...@not-here.org) wrote on MMMMDLXXVII September MCMXCIII in
<URL:news:ZBlRf.53739$H71....@newssvr13.news.prodigy.com>:
-: Abigail wrote:
-: > Hi (no@spam) wrote on MMMMDLXXVII September MCMXCIII in
-: > <URL:news:121b2r8...@corp.supernews.com>:
-: > }} How do I create graphs that look like MRTG dynamically with perl? Are there
-: > }} any easy ways to do that?
-: >
-: >
-: > I'm quite charmed by gnuplot, and I use it exclusively to create graphs.
-: > But it uses a pipe (Eeew!) to an external program (Eeew!) and doesn't
-: > use a module (Eeew!). So most people consider me a heretic.
-: >
-: >
-: >
-: > Abigail
-: You mean a pipe like
-:
-: #!/usr/bin/perl -w
-: use strict;
-: my $somefile = "/path/to/somefile";
-: my $pid = open Apipe, "| cat $somefile|less";
-: close(Apipe);
-:
-: but surely not...
-:
-: system("cat $somefile|less");


Those are different types of pipes?


Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s};;;
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)}; # Perl 5.6.0 broke this...
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))

Kraven

unread,
Mar 13, 2006, 6:26:59 PM3/13/06
to
> -: You mean a pipe like
> -:
> -: #!/usr/bin/perl -w
> -: use strict;
> -: my $somefile = "/path/to/somefile";
> -: my $pid = open Apipe, "| cat $somefile|less";
> -: close(Apipe);
> -:
> -: but surely not...
> -:
> -: system("cat $somefile|less");
>
>
> Those are different types of pipes?
>
>
> Abigail


Yes, piping from inside PERL. It can get way more complicated with the
$pid version. Basically you can run other programs from within perl
with open, system, exec, `....`, or glob.

John Bokma

unread,
Mar 13, 2006, 9:14:59 PM3/13/06
to
Abigail <abi...@abigail.nl> wrote:

> John Bokma (jo...@castleamber.com) wrote on MMMMDLXXVII September

[..]



> I use 'make' to run all kinds of programs, including Perl programs.
> I have replaced Perl programs by Makefiles (or Makefile targets)
> more than once.
>
> make rules.

I am having a love hate relation ship with Ant. I decided to give it a try
some time ago, also since now and then I do Java things, and quite a lot
of projects use Ant.

Abigail

unread,
Mar 14, 2006, 3:53:11 PM3/14/06
to
Kraven (kra...@not-here.org) wrote on MMMMDLXXVII September MCMXCIII in
<URL:news:7dnRf.53773$H71....@newssvr13.news.prodigy.com>:
,, > -: You mean a pipe like
,, > -:
,, > -: #!/usr/bin/perl -w
,, > -: use strict;
,, > -: my $somefile = "/path/to/somefile";
,, > -: my $pid = open Apipe, "| cat $somefile|less";
,, > -: close(Apipe);
,, > -:
,, > -: but surely not...
,, > -:
,, > -: system("cat $somefile|less");
,, >
,, >
,, > Those are different types of pipes?
,, >
,, >
,, > Abigail
,,
,,
,, Yes, piping from inside PERL.


Actually, all three pipes you have there are between different
programs. I still think all the pipes are the same.


,, It can get way more complicated with the
,, $pid version.

The $pid version of what?

,, Basically you can run other programs from within perl
,, with open, system, exec, `....`, or glob.


Actually, you can't run another program "within perl" using 'exec', as
'exec' *replaces* the current program with another.


Abigail
--
#!/opt/perl/bin/perl -- # No trailing newline after the last line!
BEGIN{$|=$SIG{__WARN__}=sub{$_=$_[0];y-_- -;print/(.)"$/;seek _,-open(_
,"+<$0"),2;truncate _,tell _;close _;exec$0}}//rekcaH_lreP_rehtona_tsuJ

A. Sinan Unur

unread,
Mar 14, 2006, 4:05:53 PM3/14/06
to
Abigail <abi...@abigail.nl> wrote in
news:slrne1eb9n....@alexandra.abigail.nl:

> #!/opt/perl/bin/perl -- # No trailing newline after the last line!
> BEGIN{$|=$SIG{__WARN__}=sub{$_=$_[0];y-_- -;print/(.)"$/;seek _,-open(_
> ,"+<$0"),2;truncate _,tell _;close _;exec$0}}//rekcaH_lreP_rehtona_tsuJ

This is an amazing JAPH. Very instructive.

Dave Weaver

unread,
Mar 16, 2006, 4:49:50 AM3/16/06
to
A. Sinan Unur <1u...@llenroc.ude.invalid> wrote:
> Abigail <abi...@abigail.nl> wrote in
> news:slrne1eb9n....@alexandra.abigail.nl:
>
> > #!/opt/perl/bin/perl -- # No trailing newline after the last line!
> > BEGIN{$|=$SIG{__WARN__}=sub{$_=$_[0];y-_- -;print/(.)"$/;seek _,-open(_
> > ,"+<$0"),2;truncate _,tell _;close _;exec$0}}//rekcaH_lreP_rehtona_tsuJ
>
> This is an amazing JAPH. Very instructive.
>

Seconded!

For those having difficulty getting it to work (like me!), you need to
save this to a file and make that file executable. i.e.:

% perl japh.pl # won't work
Jsyntax error at japh.pl line 3, next token ???
Execution of japh.pl aborted due to compilation errors.

% chmod +x japh.pl ; ./japh.pl # will work.
Just another Perl Hacker


Abigail

unread,
Mar 16, 2006, 2:58:16 PM3/16/06
to
Dave Weaver (zen1...@zen.co.uk) wrote on MMMMDLXXX September MCMXCIII in
<URL:news:441934be$0$5012$db0f...@news.zen.co.uk>:
// A. Sinan Unur <1u...@llenroc.ude.invalid> wrote:
// > Abigail <abi...@abigail.nl> wrote in
// > news:slrne1eb9n....@alexandra.abigail.nl:
// >
// > > #!/opt/perl/bin/perl -- # No trailing newline after the last line!
// > > BEGIN{$|=$SIG{__WARN__}=sub{$_=$_[0];y-_- -;print/(.)"$/;seek _,-open(_
// > > ,"+<$0"),2;truncate _,tell _;close _;exec$0}}//rekcaH_lreP_rehtona_tsuJ
// >
// > This is an amazing JAPH. Very instructive.
// >
//
// Seconded!
//
// For those having difficulty getting it to work (like me!), you need to
// save this to a file and make that file executable. i.e.:
//
// % perl japh.pl # won't work
// Jsyntax error at japh.pl line 3, next token ???
// Execution of japh.pl aborted due to compilation errors.
//
// % chmod +x japh.pl ; ./japh.pl # will work.
// Just another Perl Hacker


The fun is executing the file *twice*.


Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'

A. Sinan Unur

unread,
Mar 16, 2006, 3:07:06 PM3/16/06
to
Abigail <abi...@abigail.nl> wrote in
news:slrne1jgqn....@alexandra.abigail.nl:

> Dave Weaver (zen1...@zen.co.uk) wrote on MMMMDLXXX September MCMXCIII
> in <URL:news:441934be$0$5012$db0f...@news.zen.co.uk>:
> // A. Sinan Unur <1u...@llenroc.ude.invalid> wrote:
> // > Abigail <abi...@abigail.nl> wrote in
> // > news:slrne1eb9n....@alexandra.abigail.nl:
> // >
> // > > #!/opt/perl/bin/perl -- # No trailing newline after the last line!

> // > > BEGIN{$|=$SIG{__WARN__}=sub{$_=$_[0];y-_--;print/(.)"$/;seek _,-open(_

> // > > ,"+<$0"),2;truncate _,tell _;close _;exec$0}}//rekcaH_lreP_rehtona_tsuJ
> // >
> // > This is an amazing JAPH. Very instructive.
> // >
> //
> // Seconded!
> //

...


> // % chmod +x japh.pl ; ./japh.pl # will work.
> // Just another Perl Hacker
>
>
> The fun is executing the file *twice*.

That was the original reason I thought this one was extremely impressive.

It sure is hard to read ;-)

use...@davidfilmer.com

unread,
Mar 16, 2006, 3:16:04 PM3/16/06
to
Abigail wrote:
> perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'

Hmmm...
Use of uninitialized value in repeat (x) at -e line 1.

--
http://DavidFilmer.com

A. Sinan Unur

unread,
Mar 16, 2006, 3:26:44 PM3/16/06
to
use...@DavidFilmer.com wrote in news:1142540164.893352.212370
@i39g2000cwa.googlegroups.com:

> Abigail wrote:
>> perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
>
> Hmmm...
> Use of uninitialized value in repeat (x) at -e line 1.

You need to supply it with an argument with which to test:

C:\> perl -wle "print q{Prime} if (1 x shift) !~ /^1?$|^(11+?)\1+$/" 7853
Prime

Abigail

unread,
Mar 16, 2006, 3:58:47 PM3/16/06
to
A. Sinan Unur (1u...@llenroc.ude.invalid) wrote on MMMMDLXXX September
MCMXCIII in <URL:news:Xns97889D3C4C71...@127.0.0.1>:
$$ use...@DavidFilmer.com wrote in news:1142540164.893352.212370
$$ @i39g2000cwa.googlegroups.com:
$$
$$ > Abigail wrote:
$$ >> perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
$$ >
$$ > Hmmm...
$$ > Use of uninitialized value in repeat (x) at -e line 1.
$$
$$ You need to supply it with an argument with which to test:
$$
$$ C:\> perl -wle "print q{Prime} if (1 x shift) !~ /^1?$|^(11+?)\1+$/" 7853
$$ Prime


Maybe I should write a signature that deletes files. People getting the
uninitialized warning are obviously running the code without understanding
it. Running code that you pasted from a Usenet posting you don't understand
is a dangerous thing to do.


Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'

co...@zedat.fu-berlin.de

unread,
Mar 23, 2006, 2:26:58 AM3/23/06
to
A. Sinan Unur <1u...@llenroc.ude.invalid> wrote:

: C:\> perl -wle "print q{Prime} if (1 x shift) !~ /^1?$|^(11+?)\1+$/" 7853
: Prime

perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/' 45937
Segmentation fault

Accepted ceiling seems to be:
45569 -> Prime
45570 and above -> Segmentation fault
(on a Mac Mini)

Oliver.

--
Dr. Oliver Corff e-mail: co...@zedat.fu-berlin.de

Abigail

unread,
Mar 23, 2006, 3:44:54 PM3/23/06
to
<co...@zedat.fu-berlin.de> (co...@zedat.fu-berlin.de) wrote on
MMMMDLXXXVII September MCMXCIII in <URL:news:48f0u2F...@uni-berlin.de>:

:: A. Sinan Unur <1u...@llenroc.ude.invalid> wrote:
::
:: : C:\> perl -wle "print q{Prime} if (1 x shift) !~ /^1?$|^(11+?)\1+$/" 7853
:: : Prime
::
:: perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/' 45937
:: Segmentation fault
::
:: Accepted ceiling seems to be:
:: 45569 -> Prime
:: 45570 and above -> Segmentation fault
:: (on a Mac Mini)


Add more memory.


Abigail
--
perl -wle 'sub _ "Just another Perl Hacker"; print prototype \&_'

jussi.mon...@asdf-comptel.com

unread,
Mar 24, 2006, 8:35:21 AM3/24/06
to
>> // > Abigail <abi...@abigail.nl> wrote in
>> // > news:slrne1eb9n....@alexandra.abigail.nl:
>> // >
>> // > > #!/opt/perl/bin/perl -- # No trailing newline after the last line!
>> // > > BEGIN{$|=$SIG{__WARN__}=sub{$_=$_[0];y-_--;print/(.)"$/;seek _,-open(_
>> // > > ,"+<$0"),2;truncate _,tell _;close _;exec$0}}//rekcaH_lreP_rehtona_tsuJ
>> // >
>> // > This is an amazing JAPH. Very instructive.
>> //
>> // Seconded!

>>
>> The fun is executing the file *twice*.
>
> That was the original reason I thought this one was extremely impressive.
>
> It sure is hard to read ;-)

Thank god for Deparse, we mere mortals would be lost without it.

[tarzan ~]$ perl -MO=Deparse japh.pl
sub BEGIN {
$| = $SIG{'__WARN__'} = sub {
$_ = $_[0];
tr/_/ /;
print /(.)"$/;


seek _, -open(_, "+<$0"), 2;
truncate _, tell _;
close _;

exec $0;
}
;
}
//;
japh.pl syntax OK

That makes much more sense :-)

/jUSSi

--
remove -asdf and asdf- for email address

Abigail

unread,
Mar 24, 2006, 4:20:49 PM3/24/06
to
jussi.mon...@asdf-comptel.com (jussi.mon...@asdf-comptel.com)
wrote on MMMMDLXXXVIII September MCMXCIII in <URL:news:e00sip$65r$1...@phys-news4.kolumbus.fi>:
-- >> // > Abigail <abi...@abigail.nl> wrote in
-- >> // > news:slrne1eb9n....@alexandra.abigail.nl:
-- >> // >
-- >> // > > #!/opt/perl/bin/perl -- # No trailing newline after the last line!
-- >> // > > BEGIN{$|=$SIG{__WARN__}=sub{$_=$_[0];y-_--;print/(.)"$/;seek _,-open(_
-- >> // > > ,"+<$0"),2;truncate _,tell _;close _;exec$0}}//rekcaH_lreP_rehtona_tsuJ
-- >> // >
-- >> // > This is an amazing JAPH. Very instructive.
-- >> //
-- >> // Seconded!
-- >>
-- >> The fun is executing the file *twice*.
-- >
-- > That was the original reason I thought this one was extremely impressive.
-- >
-- > It sure is hard to read ;-)
--
-- Thank god for Deparse, we mere mortals would be lost without it.
--
-- [tarzan ~]$ perl -MO=Deparse japh.pl
-- sub BEGIN {
-- $| = $SIG{'__WARN__'} = sub {
-- $_ = $_[0];
-- tr/_/ /;
-- print /(.)"$/;
-- seek _, -open(_, "+<$0"), 2;
-- truncate _, tell _;
-- close _;
-- exec $0;
-- }
-- ;
-- }
-- //;
-- japh.pl syntax OK
--
-- That makes much more sense :-)


But that's the output *after* you ran it.

Try deparsing the program before running it.

Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'

jussi.mon...@asdf-comptel.com

unread,
Mar 27, 2006, 1:14:47 AM3/27/06
to
Abigail <abi...@abigail.nl> wrote:
>
> But that's the output *after* you ran it.
>
> Try deparsing the program before running it.

I can't :-)

[tarzan ~]$ perl -MO=Deparse japh.pl

Jsyntax error at japh.pl line 3, next token ???

japh.pl had compilation errors.
sub BEGIN {


$| = $SIG{'__WARN__'} = sub {

$_ = $_[0];
tr/_/ /;
print /(.)"$/;

seek _, -open(_, "+<$0"), 2;

truncate _, tell _;
close _;
exec $0;
}
;
}

[tarzan ~]$

co...@zedat.fu-berlin.de

unread,
Mar 27, 2006, 7:29:57 AM3/27/06
to
Abigail <abi...@abigail.nl> wrote:
: :: Segmentation fault

: ::
: :: Accepted ceiling seems to be:
: :: 45569 -> Prime
: :: 45570 and above -> Segmentation fault
: :: (on a Mac Mini)


: Add more memory.


I have 1GB, is that _still_ too little?

OliverI have 1GB, is that _still_ too little?

0 new messages