[11554] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5154 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 17 06:07:39 1999

Date: Wed, 17 Mar 99 03:00:24 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 17 Mar 1999     Volume: 8 Number: 5154

Today's topics:
    Re: Are negative array indeces allowed? <Philip.Newton@datenrevision.de>
    Re: Array-Sort <britts@pyro.net>
    Re: Array-Sort (Tad McClellan)
    Re: Array-Sort (Bart Lateur)
    Re: Can you use xxx.pm inside aaa.pm (Arved Sandstrom)
        Dialog boxes <Emmanuel.Blimakis@eurodyn.com.gr>
        difference between my $x = 1 and my $x; $x = 1 <skilchen@swissonline.ch>
    Re: Doc in HtmlHelp Format (Ralf Schlueter)
        embed perl in c++ <echen@mdsi.bc.ca>
    Re: embed perl in c++ <eedalf@eed.ericsson.se>
        Filehandle Q... <gt4329b@prism.gatech.edu>
        Help on C-Kermit ... <vacevedo@tyr.mty.itesm.mx>
    Re: how do I add values in a text delimited file? <Philip.Newton@datenrevision.de>
    Re: HTML, RTF, XML and CGI (Michael Smith)
        Install ActivePerl? (Michael Stevens)
    Re: Newby Question (Bob Trieger)
    Re: open port from behind firewall, with no proxy <pboldra@spamtrap.dynamite.com.au>
    Re: Please can we stop this PIII thread RIGHT HERE? <=  ran@netgate.net
    Re: Problem passing parameters through MSDOS/Windows ba ran@netgate.net
    Re: RAD or WYSIWIG for Perl ??? <stevo@steve.com>
        Read a file. <s.filipowicz@orades.nl>
    Re: Read a file. <s.filipowicz@orades.nl>
    Re: Read a file. (Sami Rosenblad)
    Re: Reading Directory <Philip.Newton@datenrevision.de>
    Re: Reading Directory <Philip.Newton@datenrevision.de>
        recode anyone? <mostynm@gromit.ecr.mu.oz.au>
    Re: Regex limits for regex/function calls within subsit (Ilya Zakharevich)
    Re: Regex limits for regex/function calls within subsit (Sami Rosenblad)
    Re: Undefined subroutine error <thrase@slip.net>
    Re: Undefined subroutine error (Tad McClellan)
    Re: Undefined subroutine error (John )
    Re: Undefined subroutine error (John )
        Variable splitting (Ruud Limbeck)
    Re: What is wrong with this piece of counter code? <Philip.Newton@datenrevision.de>
    Re: Where to start with Perl <xugang@egr.msu.edu>
    Re: which version of perl5/lwp should we be using? (I R A Aggie)
    Re: which version of perl5/lwp should we be using? (Michael Budash)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 17 Mar 1999 11:42:30 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Are negative array indeces allowed?
Message-Id: <36EF8716.8F917D03@datenrevision.de>

John Chambers wrote:
> 
> Then there's the perl4 trick of faking a multi-dimensional array with
> things like $x{"$i,$j"}.  This works just fine in perl5, too, and in
> some situations is simpler than a true 2-D array.

Don't you mean $x{$i,$j} ? As I understand it, given the values "foo"
for $i and "bar" for $j, $x{"$i,$j"} would have a key of 'foo,bar'
whereas $x{$i,$j} would have a key of "foo\034bar" (or, more precisely,
'foo' . $; . 'bar' or join($;, 'foo', 'bar') -- see $; in perlvar, "the
subscript separator for multidimensional array emulation").

As I recall, the default value of $; was chosen so as to be unlikely to
conflict with "real" data. using "," as a separator, as in your example,
might possibly clash if $i or $j contain commas, which might happen; but
if $i and $j only contain printable ASCII characters (> 32), then \034
works fine.

Cheers,
Philip


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

Date: Tue, 16 Mar 1999 23:14:55 -0500
From: "Michael C. Brittain" <britts@pyro.net>
Subject: Re: Array-Sort
Message-Id: <36EF2C3F.B61085B6@pyro.net>

>
>
> Overkill alert!  The data are already sortable.
>
>   @data2 = sort { $a->[0] <=> $b->[0] }   # numerically
>            @data;
>
> I posted a similar solution moments before yours appeared here, and was
> amused to realize that in essence the ST was already done.

I am wary of asking this question for fear of getting flamed as a moron,
but what is a Schwartzian Transform anyway?  I did look for refereneces to
it in the camel, so please don't give me that...

-mike



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

Date: Tue, 16 Mar 1999 19:00:01 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Array-Sort
Message-Id: <1armc7.8t8.ln@magna.metronet.com>

Michael C. Brittain (britts@pyro.net) wrote:

: I am wary of asking this question for fear of getting flamed as a moron,


   People get flamed more often for ignoring the standard perl
   docs that for being moronic...


: but what is a Schwartzian Transform anyway?  I did look for refereneces to
: it in the camel, so please don't give me that...


   grep 'Schwartzian Transform' *.pod

perlfaq4.pod:that's come to be known as the Schwartzian Transform:
perlfunc.pod:    # same thing using a Schwartzian Transform (no temps)
perllol.pod:If you were into Schwartzian Transforms, you would probably

:-)


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 17 Mar 1999 08:47:46 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Array-Sort
Message-Id: <36f06b72.1974828@news.skynet.be>

Michael C. Brittain wrote:

>I am wary of asking this question for fear of getting flamed as a moron,
>but what is a Schwartzian Transform anyway?  I did look for refereneces to
>it in the camel, so please don't give me that...

The Schwartzian Transform could be post-Camel.

Try this online tutorial: http://www.5sigma.com/perl/schwtr.html

	Bart.


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

Date: Wed, 17 Mar 1999 06:55:54 -0400
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: Can you use xxx.pm inside aaa.pm
Message-Id: <Arved_37-1703990655550001@dyip-108.chebucto.ns.ca>

In article <epiYyz#b#GA.101@rpc1285.daytonoh.ncr.com>, "Dennis Kowalski"
<dennis.kowalsk@daytonoh.ncr.com> wrote:

> I have a lot of scripts that use Win32::NetResource to map network drives.
> I wrote a .pm module that has map and unmap routines in it.
> They take parameters for the drive and sharename
> I put a use Win32::NetResource in my .pm module.
> I wrote a test script that has a use statement for my .pm file and I called
> the map and unmap routine in it.
> My map routine calls the Win32::NetRseource::CancelConnection routine and
> gets an error message of an undefined routine.
> It is as if the use Win32::NetResource in my .pm is being ignored.
> Can a .pm use another .pm ???
> If not, any suggestions on how I can have a general library routine to map
> and unmap drives without each script writer useing the raw Win32 module ??
> Thanks in advance to the guru who responds

[ White space in above post condensed ]

I'm not a guru, and I don't use Windows Perl to the extent that I'd be
using Win32 modules, but your description above is fairly complete.

Are you actually using the full Win32::NetResource::CancelConnection call
when you use this function, i.e. full specified subroutine?

If not, do you know what NetResource exports (look at @EXPORT in that .pm file)?

Is your typo above, a cut and paste from the actual .pm file you wrote? :-)

Arved


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

Date: Wed, 17 Mar 1999 12:47:13 +0200
From: Emmanuel Blimakis <Emmanuel.Blimakis@eurodyn.com.gr>
Subject: Dialog boxes
Message-Id: <36EF8831.7351CCAD@eurodyn.com.gr>

Hi all,

I am having a problem creating  Dialog Box within Perl.  I am using Win
95 and the appropriate TK::DialogBox (note that I am not using
Tk::Dialog for this).

My code is as follows :

# displays ftp dialog box and (username, user password, serverdirectory
name, host name)
sub send_ordin_ftp {
                

        my $done;
        my $ftp;
        
        $done = 0 ;
        
# construct dialog box

        $ftp_dialog = $MW->DialogBox(
                                -title => "Send Incoming Orders to
server",
                                -buttons =>["Send", "Cancel"],
                                 );

# User Name
        $ftp_dialog->add("Label", -text => "User Name")->pack();
        $user_name= $ftp_dialog->add("Entry", -width => 35)->pack();

# User Password
        $ftp_dialog->add("Label", -text => "User Password")->pack();    
        $user_pw= $ftp_dialog->add("Entry", -width => 35)->pack();

# Server IP address/ IP Name
        $ftp_dialog->add("Label", -text => "Host Name")->pack();        
        $host_name= $ftp_dialog->add("Entry", -width => 35)->pack();

# Server Dir name
        $ftp_dialog->add("Label", -text => "Sever Dir")->pack();        
        $server_dir= $ftp_dialog->add("Entry", -width => 50)->pack();
 .
 .
 .
 .
} # end sub

I call the above procedure from a button on the main window.
When I press this button the following error message appears in the DOS
shell:

Tk::Error:  Invalid master window .dialogbox for .dialogbox at
D:\PERL\lib\site/TkSubmethods.pm line 34.
at D:\PERL\lib\site/Tk/DialogBox.pm line 31
Tk callback for wm
\&main::send_ordin_ftp
Tk callback for .frame1.butrton5
Tk::Button::butUp at D:\PERL\lib\site/Tk/Button.pm line 103
(command bound to event) at D:\PERL\lib\site/auto/Tk/Error.al line 13.

Can anyone out there in PERL land please give me an idea, as I am new to
PERL ?? 

thanx... Emmanuel Blimakis


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

Date: Wed, 17 Mar 1999 05:25:44 +0100
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: difference between my $x = 1 and my $x; $x = 1
Message-Id: <7cnb2o$82g$1@online-15-atm.cablecom.ch>

Where can i find a description of the semantic difference between
a) my $x = something;
and
b) my $x; $x = something;

Two more or less silly examples where the difference is evident. Both
examples are using "anonymous" internal helper functions, which are
called recursively.

sub permute {
  # C.T. Fike's algorithm
  my $n = shift;
  my @list = (0..$n-1);

  my $next_perm;          #predeclaration needed
  $next_perm = sub {      # my $next_perm = sub { # DOESN'T WORK
    my $i = $_[0];
    if ($i == $n - 1) {
      print "@list", "\n";
    } else {
      for (my $j = $i; $j < $n; $j++) {
        @list[$j, $i] = @list[$i, $j];
        # this variable is "unknown" without the predeclaration
        &$next_perm($i + 1);
        @list[$j, $i] = @list[$i, $j];
      }
    }
  };
  &$next_perm(0);
}

sub is_even {
  my $x = shift;
  my $odd;                 # without this predeclaration
                           # the example produces an error
  my $even = sub {
    my $x = shift;
    return ($x <= 0) ? 1 : &$odd($x - 1);
  };

  $odd = sub {             # instead of: my $odd = sub {
    my $x = shift;
    return ($x <= 0) ? 0 : &$even($x - 1);
  };

  return &$even(abs($x));
}

Has the predeclaration of lexically scoped variables the same effect
as using "letrec" in some other languages?

--
Samuel Kilchenmann
skilchen@swissonline.ch






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

Date: 17 Mar 1999 07:44:47 GMT
From: schlueter@dialogs.de (Ralf Schlueter)
Subject: Re: Doc in HtmlHelp Format
Message-Id: <36ef5e24.55685977@eunetnews.germany.eu.net>


>I have no idea what an "HtmlHelp" is. ...

What kind of documentation comes with Perl for Win32?
Perl for Win32 comes with the standard Perl documentation, as well as
Win32 specific additions. Documentation is also available for all Core
modules. 
Additional documentation is available from the Perl Resource Kit for
Win32 from O'Reilly. It has full documentation for Perl and for the
modules and utilities in both HTML (for users of Netscape and other
browsers) and in Microsoft's new Help format, HtmlHelp (for MSIE 4.0
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 users). Documentation is also available in POD (Plain Old
Documentation), Perl's documentation format. 
Also, when you add a module package through the Perl Package Manager
or Visual Package Manager, the documentation for that module is
installed on your system. This documentation is provided in HTMLHelp,
HTML, and POD format (if POD documentation is embedded in the module).


What is HtmlHelp?
HtmlHelp is Microsoft's new help file format. Its .CHM files replace
the old .HLP files. The difference is that HtmlHelp is easier to work
with (no RTF converters and stuff), and it can contain anything that
can be contained in a simple HTML document, including Scripts,
applets, styles, and of course, cool HTML. 
ActiveState has adopted the HtmlHelp format for its online
documentation for Perl for Win32. This means that Perl's documentation
for Win32 has come of age and is an entity of its own. Perl help is
now searchable by keyword, and is easily extended every time you add a
package with the Package Manager tool. 


On Tue, 16 Mar 1999 15:59:20 -0500, Jay Glascoe
<jglascoe@giss.nasa.gov> wrote:

>[courtesy copy of post sent to cited author]
>
>Ralf Schlueter wrote:
>> 
>> Hi,
>> 
>> I'm looking for perl documentation in HtmlHelp format.
>> Does anybody know where I can download it?
>
>hi,
>
>I have no idea what an "HtmlHelp" is.  But, I know the
>docs are available as PlainOldHtml files:
>
>print << 'Narf!';
>You can access these individually or you can fetch a giant
>tarfile of all the HTML pages.
>    http://language.perl.com/info/documentation.html
>Narf!
>
>	Jay Glascoe
>-- 
>	"Don't be too proud of this technological
>	 terror you've constructed."
>        --Darth Vader (speaking to Bjarne S. ???)





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

Date: Tue, 16 Mar 1999 16:28:07 -0800
From: "Ellena Chen" <echen@mdsi.bc.ca>
Subject: embed perl in c++
Message-Id: <7cmt2f$3m8$1@vannews.mdsi.bc.ca>

Hi,

I am using ActivePerl on Windows 95 plateform.  How can I embed a perl
subroutine into my c++ code?

Thank you.




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

Date: Wed, 17 Mar 1999 11:10:31 +0100
From: Alex Farber <eedalf@eed.ericsson.se>
To: Ellena Chen <echen@mdsi.bc.ca>
Subject: Re: embed perl in c++
Message-Id: <36EF7F97.8CE656F7@eed.ericsson.se>

Ellena Chen wrote:
> I am using ActivePerl on Windows 95 plateform.  How can I embed a perl
> subroutine into my c++ code?

The book "Advanced Perl Programming" (see URL:
http://www.oreilly.com/catalog/advperl/ ) has
nice explation of it. See also "perldoc perlembed"
and "perldoc perlguts".

/Alex


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

Date: Wed, 17 Mar 1999 04:56:05 -0500
From: "Morris" <gt4329b@prism.gatech.edu>
Subject: Filehandle Q...
Message-Id: <7cnu49$c3a$1@news-int.gatech.edu>

I figure this will be easy to someone...

I want a script to call an external program (whois), write the output that
would normally be echoed to the screen to a file, and then return to normal
behavior.  My latest attempt looks like this:

----------------------
print "Starting...\n\n";
 open( ORIG_STDOUT, ">STDOUT" );
 open( STDOUT, ">$out_file");
system($whois);
 open( STDOUT, ">ORIG_STDOUT" );
 close( ORIG_STDOUT );
print "Finished.\n";

$valid = 0;

open( RES, "<$out_file" );
while (($in = <RES>) ne "")
{
 $valid = 1;
}
close( RES );

print "User valid? $valid\n\n";
----------------------

 ...the idea being that the script calls 'whois' on the system and checks to
see if anything was returned.  If something was returned, the user exists in
the database and is a valid user.  If anyone can think of a better way to
implement this...lemme know.

    Whats going on when I run this:
----------------------
>>: perl whois_test.pl
Starting...

>>:
----------------------

The contents of '$out_file' look like this after execution:
----------------------

(whois output)

0
----------------------

Any insight/lesson would be great... Ive checked in Programming Perl
(O'Reilly), which has never failed me before, but Im /obviously/ missing
something.  Thanks in advance...


  Morris





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

Date: Tue, 16 Mar 1999 23:28:00 -0600
From: Victor Acevedo <vacevedo@tyr.mty.itesm.mx>
Subject: Help on C-Kermit ...
Message-Id: <36EF3D5F.476665CC@tyr.mty.itesm.mx>

    Hello :

            I have a problem , I'm using C-Kermit to make a phone
connection,

        but I can't configure my modem properly, I think the problem is
related

         to the assignation of the port .. Any idea ?



Thanks in advance ...



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

Date: Wed, 17 Mar 1999 11:58:19 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: how do I add values in a text delimited file?
Message-Id: <36EF8ACB.1E466D0@datenrevision.de>

Ramanujam Parthasarathi wrote:
> 
>     @list = split(/\|/, $line);

Given the example values, /\s*\|\s*/ may be better, in order to swallow
any whitespace on either side of the pipe.

Cheers,
Philip


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

Date: 17 Mar 1999 07:01:11 GMT
From: smith@io.com (Michael Smith)
Subject: Re: HTML, RTF, XML and CGI
Message-Id: <slrn7eukq5.pni.smith@dillinger.io.com>

On Tue, 16 Mar 1999 21:16:07 +0300, Michael Yevdokimov
<flanker@sonnet.ru> wrote:

>Have you received an answer?
>I'd like to get a Perl script for parsing RTF file (to convert it into
>HTML)... My scripts works under FreeBSD system and I don't need in C
>programes!
>
>If you have or anyone else have, please let me know as soon as possible. ;-)

If you're looking for a simple standalone script, I don't think you're
likely to find one -- RTF to HTML conversion is not simple.

The RTF::Parser module might be worth exploring if you know what to
do with it, and if you keep in mind that it is alpha/beta software
described by its author as a "minimal RTF processor."

If you want something that works: RTFtoHTML.

-- 
Michael Smith      Austin, Texas
smith@io.com 


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

Date: 17 Mar 1999 06:32:38 GMT
From: michaelx59@hotmail.com (Michael Stevens)
Subject: Install ActivePerl?
Message-Id: <MPG.11591682f1b2f4d6989687@netnews.worldnet.att.net>

Hi, I'm a Window95 user just starting with Perl. I have Perl for Win32 
build 315 installed on my computer. I have noticed a download from 
Activestate called ActivePerl. Could someone tell me if this would be 
better than my current installation? I know it comes with more tools but 
I'm not sure what they all do.

If I do install ActivePerl do I need to uninstall my current interpreter 
first?
-- 
Michael Stevens
michaelx59@hotmail.com


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

Date: Wed, 17 Mar 1999 00:31:29 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Newby Question
Message-Id: <7cmt73$a52$1@oak.prod.itd.earthlink.net>

mojo@trianglenet.net wrote:
>Hello,
>I have been trying
>to learn perl/cgi
>here in the last
>month.  I have been
>attempting to create
>and run simple
>programs from the
>"CGI Developer's
>Guide" by Eugene
>Eric Kim. 

>#!/cgi-bin/nameage.cgi

>>> snippage <<<
If this is what the book told you to use as the 1st (shebang) line, don't 
hesitate in throwing that book away!!!!!!

Good luck

Bob Trieger
sowmaster@juicepigs.com       



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

Date: Wed, 17 Mar 1999 16:34:16 +1100
From: Paulboldra <pboldra@spamtrap.dynamite.com.au>
Subject: Re: open port from behind firewall, with no proxy
Message-Id: <36EF3ED8.681DE08@spamtrap.dynamite.com.au>

Thanks Don, but I guess 'ip-filter' is funky.  There are no tcp/ip clients of any
kind running on that machine, only servers that 'listen' to ports opened in the
firewall.  I can't telnet out of this box, I can't even ping.  Connections just
time out if I try.

My script isn't using lib-www, so I might be able to use James' suggestion, once I
understand it.  Will post here if it's a success.

thanks all.

paulboldra

Don Roby wrote:

> In article <36ECA499.87AB327A@spamtrap.dynamite.com.au>,
>   Paulboldra <pbolda@spamtrap.dynamite.com.au> wrote:
> > Hello,
> > My TCP/IP grounding isn't too good, but I've put together a simple http
> > client which I need to run on a solaris box.  Solaris on this box has
> > been patched by 'ip filter' (
> > http://coombs.anu.edu.au/ipfilter/ip-filter.html ) to only allow
> > connections on specified ports.
> >
> > So now I can't run my http client, since the port replies are sent to is
> > randomly allocated by the OS.  Can anyone suggest a way to get my http
> > client to create sockets only on a pre-determined port number?  I have
> > found ways to do this for a server, but how does it work if you're a
> > client?
>
> Unless that 'ip filter' thing is doing something VERY funky in the kenel, it's
> unlikely that it's to blame for your script's failure.  Have you verified that
> the script works on an unpatched Unix?
>
> If a kernel hack (or a firewall) prevents the creation of dynamic source ports
> for TCP connections, most IP software would die horribly.  Can you telnet from
> that machine to another?  Try downloading lynx and seeing if that works.
>
> Finally, post some code, (not too large ...) and describe its behavior in your
> situation.  We may be able to see something you've missed.
>
> --
> Don Roby
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own



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

Date: 17 Mar 1999 10:02:21 GMT
From: ran@netgate.net
Subject: Re: Please can we stop this PIII thread RIGHT HERE? <= Complaint addresses
Message-Id: <7cnujd$aq2$1@remarQ.com>

In <01be6f1a$1298f700$2a01a8c0@arc7>, "Richard Heathfield" <binary@eton.powernet.co.uk> writes:

>Subject line says it all - we've been through this subject ad nauseam
>already, after all.

The latest spam came from earthlink:  complain to abuse@earthlink.net.

The website is hosted by value.net:  abuse@value.net.

Send them a copy of the full posting (including headers),  along with a 
*courteous* request that they persuade their customer(s) to either:

   a. play nice,  or
   b. get the *#$% out of the Usenet sandbox.

Unfortunately,  it may take a while to run them out of ISPs:  the 
earthlink posting appears to have come from Santa Clara,  where POPs are
almost as common as phone booths.

Ran




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

Date: 17 Mar 1999 10:18:06 GMT
From: ran@netgate.net
Subject: Re: Problem passing parameters through MSDOS/Windows batch file
Message-Id: <7cnvgu$aq2$2@remarQ.com>

In <un21dy2sf.fsf@cs.uu.nl>, piet@cs.uu.nl writes:

>Is there a way to reliably pass parameters to a perl script through a batch
>file?

No.  I've been through this,  too:  no matter what you try,  eventually 
you'll find some character (combination) that breaks it.

The OS/2 command interpreter inherited most of that "imbecile behavior" 
you mentioned,  so I'm gradually migrating all my OS/2 shell usage to a 
port of ksh.  There are some free versions of various flavors of sh for 
DOS,  too:  you may find that the most desirable alternative.

Ran




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

Date: Wed, 17 Mar 1999 01:29:57 -0500
From: "Steve Davis" <stevo@steve.com>
Subject: Re: RAD or WYSIWIG for Perl ???
Message-Id: <7cni7d$s5a$1@camel18.mindspring.com>

>WYSIWYG doesn't exist per se, not if you're thinking of stuff like
>VisualBasic, but if you're thinking of building GUI's (not the same thing,
>of course), there are plenty of options for those. Begs the question,
>exactly what do you mean by WYSIWYG when you're not doing GUI's? :-)



I want a GUI that will help me assemble the code.. there are dozens of apps
out there to help me produce java apps but nothing for Perl which surprises
me.

I am clueless when it comes to writing perl from scratch and I think a GUI
or RAD product for Perl is long overdue.

Steve





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

Date: Wed, 17 Mar 1999 10:43:50 +0100
From: Steven Filipowicz <s.filipowicz@orades.nl>
Subject: Read a file.
Message-Id: <36EF7956.F463DE6E@orades.nl>

Hi All,

Yesterday I posted a question about this and got some good answers that
helped a lot.

This program reads in a fileand outputs the file to the browser.
The problem is that it outputs everything behind each other. So at the
end of a line it should start
on a new line, but it doesn't. Make's it a very messy and unreadable
logfile.
--------------------------------------------------------------
#!/usr/local/bin/perl 

$target = '/usr/local/etc/httpd/logs/www.orades.nl.agent';

print "Content-type: text/html", "\n\n";
print "<body>\n";

open FILE, $target or die "could not open '$target' $!";
while ($line = <FILE>) {
	@line = split / / , $line;
	print $line;
	}
	close FILE;
	
print "<FONT COLOR=red>DONE</FONT>\n";
print "</body>\n";
--------------------------------------------------------------

I tried this 

	print $line ,"\n\n";

But this doesn't do anything.

I'm not so familiar with Perl but when I remove the line

	@line = split / / , $line;

There's no difference with the output. I believe this line splits the
line so that it's possible to output parts of the line.

Thanks again for any help!


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

Date: Wed, 17 Mar 1999 10:54:25 +0100
From: Steven Filipowicz <s.filipowicz@orades.nl>
Subject: Re: Read a file.
Message-Id: <36EF7BD1.F1088CF6@orades.nl>



Steven Filipowicz wrote:


> The problem is that it outputs everything behind each other. So at the
> end of a line it should start
> on a new line, but it doesn't. Make's it a very messy and unreadable
> logfile.
> --------------------------------------------------------------
> #!/usr/local/bin/perl
> 
> $target = '/usr/local/etc/httpd/logs/www.orades.nl.agent';
> 
> print "Content-type: text/html", "\n\n";
> print "<body>\n";
> 
> open FILE, $target or die "could not open '$target' $!";
> while ($line = <FILE>) {
>         @line = split / / , $line;
>         print $line;
>         }
>         close FILE;
> 
> print "<FONT COLOR=red>DONE</FONT>\n";
> print "</body>\n";
> --------------------------------------------------------------

Never mind! I solved the problem!
I should have used this line :

         print $line , "<BR>";

Now it works fine!


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

Date: Wed, 17 Mar 1999 12:11:36 +0200
From: blade@leela.janton.fi (Sami Rosenblad)
Subject: Re: Read a file.
Message-Id: <blade-1703991211370001@durandal.janton.fi>

In article <36EF7956.F463DE6E@orades.nl>, s.filipowicz@orades.nl wrote:

> This program reads in a fileand outputs the file to the browser.
> The problem is that it outputs everything behind each other. So at the
> end of a line it should start
> on a new line, but it doesn't. Make's it a very messy and unreadable
> logfile.
> --------------------------------------------------------------
> #!/usr/local/bin/perl 

#!/usr/local/bin/perl -w        # you should enable warnings!

> $target = '/usr/local/etc/httpd/logs/www.orades.nl.agent';
> 
> print "Content-type: text/html", "\n\n";
> print "<body>\n";
> 
> open FILE, $target or die "could not open '$target' $!";
> while ($line = <FILE>) {
>         @line = split / / , $line;
>         print $line;
>         }
>         close FILE;
>         
> print "<FONT COLOR=red>DONE</FONT>\n";
> print "</body>\n";
> --------------------------------------------------------------
> 
> I tried this 
> 
>         print $line ,"\n\n";
> 
> But this doesn't do anything.

White space is suppressed by the browser viewing the file, unless you
specify it's preformatted. Use <pre></pre> instead.

Or consider outputting a line break HTML tag after each line:

while (<FILE>) { print "$_<br>\n"; }

> I'm not so familiar with Perl but when I remove the line
> 
>         @line = split / / , $line;
> 
> There's no difference with the output. I believe this line splits the
> line so that it's possible to output parts of the line.

That's because you don't print @line at all! Note that @line (an array)
and $line (a scalar) are entirely different things. Consider naming them
differently to avoid confusion.

The split statement above splits $line into words (more accurately, chunks
separated by a space character) and puts them into @line. This might not
be what you want.

-- 
Sami Rosenblad | blade@leela.janton.fi | running Linux since 1999


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

Date: Wed, 17 Mar 1999 11:54:30 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Reading Directory
Message-Id: <36EF89E6.68FA2EB6@datenrevision.de>

Tad McClellan wrote:
> 
> Mark Sholund (msholund@bigfoot.com) wrote:
> : @files = readdir(DIR);
> : print "@files\n;
> : exit 0;
> 
>    There are three lines that look OK to me  :-)

Except, of course, for the missing " at the end of the second line.

HTH, HAND

Cheers,
Philip


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

Date: Wed, 17 Mar 1999 11:55:11 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Reading Directory
Message-Id: <36EF8A0F.5A1AA87A@datenrevision.de>

Tad McClellan wrote:
> 
> Mark Sholund (msholund@bigfoot.com) wrote:
> : ($dir = $ARGV[0]) || ($dir = ".");
> 
>    That is more idiomatically written as:
> 
>       $dir =  $ARGV[0] || '.';
> 
>    Easier on the eyes too  :-)

And even more idiomatically as:

   $dir = shift || '.';

But this may be too terse for some.

Cheers,
Philip


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

Date: Wed, 17 Mar 1999 15:27:21 +1100
From: mostyn <mostynm@gromit.ecr.mu.oz.au>
Subject: recode anyone?
Message-Id: <Pine.SGI.3.95.990317152630.355480C-100000@gromit.ecr.mu.oz.au>

anyone care to write fortune in perl for me?  heh.

mostyn.
--
My fading voice sings of love,          /*-----------------------*/
But she cries to the clicking of time. /* Surely you're joking, */
Oh, time.  Wait in the fire...          /* mostynm@ecr.mu.oz.au  */
	-- Jeff Buckley, "Grace"        /*-----------------------*/



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

Date: 17 Mar 1999 07:03:30 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Regex limits for regex/function calls within subsitutions?
Message-Id: <7cnk42$9vv$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Abigail
<abigail@fnx.com>],
who wrote in article <7cn2u2$k3j$1@client2.news.psi.net>:

> There used to be a limit on the size of the compiled regex, but I don't
> know if that limit is still there.

Theoretically, this limit is lifted in 5.005.  Practically, there is a
lot of extra logic to allow LARGE RExen without reducing performance
of smaller ones.  Since LARGE RExen do not appear that often, there
may be extra bugs related to them.

Ilya


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

Date: Wed, 17 Mar 1999 09:22:36 +0200
From: blade@leela.janton.fi (Sami Rosenblad)
Subject: Re: Regex limits for regex/function calls within subsitutions?
Message-Id: <blade-1703990922370001@durandal.janton.fi>

In article <7cmimn$o4t$1@mathserv.mps.ohio-state.edu>,
ilya@math.ohio-state.edu (Ilya Zakharevich) wrote:

[snip]
> but this is only a heuristic, and it is always possible to create a
> REx which would blow things away:
> 
>   > perl -we '$_ = "a" x 1e6; /(a?a?a?){12345}/'
>   Segmentation fault (core dumped)

# perl -we '$_ = "a" x 1e6; /(a?a?a?){12345}/'
(a?a?a?){12345} matches null string many times at -e line 1.

# perl -v

This is perl, version 5.004_04 built for i386-linux
 .
 .
 .

-- 
Sami Rosenblad | blade@leela.janton.fi | running Linux since 1999


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

Date: Tue, 16 Mar 1999 22:02:59 -0800
From: Paul Cameron <thrase@slip.net>
To: John@melon17.freeserve.co.uk
Subject: Re: Undefined subroutine error
Message-Id: <36EF4592.FFDACB60@slip.net>

John wrote:

> I run a perl script via a cgi with no real problem.
>
> When i run it from a cronjob i get undefined sub-routine
> error.
>
> Does anyone know why i might be getting this ?

My remote debugging skills (operating through the medium of
telepathy) are rather weak. You'll have to provide more information.

1) Like ... uhh, the error message for starters.
2) And perhaps the script if it's small enough.
3) Or for your to disclose what CGI variables you are using.
4) And what modules your perl script is calling.

Wait wait ... my telepathic six sense is kicking in ... hmm,
false alarm.

HTH!!

Paul.



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

Date: Tue, 16 Mar 1999 21:14:04 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Undefined subroutine error
Message-Id: <c53nc7.d09.ln@magna.metronet.com>

Paul Cameron (thrase@slip.net) wrote:
: John wrote:

: > I run a perl script via a cgi with no real problem.
: >
: > When i run it from a cronjob i get undefined sub-routine
: > error.
: >
: > Does anyone know why i might be getting this ?

: My remote debugging skills (operating through the medium of
: telepathy) are rather weak.


   But mine is working fine.

   There is an error on line 17.

   :-)


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 17 Mar 1999 09:51:13 GMT
From: John@melon17.freeserve.co.uk (John )
Subject: Re: Undefined subroutine error
Message-Id: <36ef7a5a.2545442@news.freeserve.net>

On Tue, 16 Mar 1999 22:02:59 -0800, Paul Cameron <thrase@slip.net>
wrote:

>John wrote:
>
>> I run a perl script via a cgi with no real problem.
>>
>> When i run it from a cronjob i get undefined sub-routine
>> error.
>>
>> Does anyone know why i might be getting this ?
>
>My remote debugging skills (operating through the medium of
>telepathy) are rather weak. You'll have to provide more information.
>
>1) Like ... uhh, the error message for starters.
But your common sense skills have crashed.

The error message has been given (read above).

I was more interested in the reasons why the server
side gives an error and the user side does not.

I will assume you have run out of cpu on this.
Or perhaps you may need more memory.

John



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

Date: Wed, 17 Mar 1999 09:52:37 GMT
From: John@melon17.freeserve.co.uk (John )
Subject: Re: Undefined subroutine error
Message-Id: <36f17b4e.2789708@news.freeserve.net>

On Tue, 16 Mar 1999 21:14:04 -0500, tadmc@metronet.com (Tad McClellan)
wrote:

>Paul Cameron (thrase@slip.net) wrote:
>: John wrote:
>
>: > I run a perl script via a cgi with no real problem.
>: >
>: > When i run it from a cronjob i get undefined sub-routine
>: > error.
>: >
>: > Does anyone know why i might be getting this ?
>
>: My remote debugging skills (operating through the medium of
>: telepathy) are rather weak.
>
>
>   But mine is working fine.
>
>   There is an error on line 17.
>
Zzzzzzz........wrong

John



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

Date: Wed, 17 Mar 1999 10:55:11 GMT
From: ruud.limbeck@tip.nl (Ruud Limbeck)
Subject: Variable splitting
Message-Id: <36ef893c.10566640@news.NL.net>

Hi there ;

I need to split up a variable but is don't work .....
The problemm $test contains : thisisatestandiwant

All I want to have is test (actually 7 characters from
the beginning and 4 caracters long .and drop it in a 
variable called $new .

Greetz




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

Date: Wed, 17 Mar 1999 12:00:18 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: What is wrong with this piece of counter code?
Message-Id: <36EF8B42.F6018ED0@datenrevision.de>

tatabu@my-dejanews.com wrote:
> 
> My counter log file gets corrupted all the time.
> What is wrong with this code? I would appreciate
> your help.
> 
> $url = "<tr><td align=\"right\"><a
> href=\"$ENV{'DOCUMENT_URI'}\">$ENV{'DOCUMENT_URI'}</a>:</td>"; $count = 0;
> $pad = "%.$pad"."d"; open (LOG, ">$logpath"); flock (LOG, 2); foreach
> $line(@data) {  if ($line =~ /$url/) {  $line =~ /<td>(.*)<\/td>/;  $count =
> $1;  $count++;  $count = sprintf($pad, $count);  print LOG
> "$url<td>$count</td></tr>\n";  }  elsif ($count == 0 && substr($line,0,8) eq
> "</table>") {  $count++;  $count = sprintf($pad, $count);  print LOG
> "$url<td>$count</td></tr>\n";  print LOG "$line";  }  else { print LOG
> "$line"; } } flock (LOG, 8); close(LOG); ###############

What's wrong with this code? It's illegible and difficult to maintain
the way it is written. Oh, you mean "why doesn't it work the way I
expect it to?" -- then look at Tad's answer.

Cheers,
Philip


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

Date: Wed, 17 Mar 1999 00:04:11 -0500
From: Gang Xu <xugang@egr.msu.edu>
Subject: Re: Where to start with Perl
Message-Id: <36EF37CA.DD72C13D@egr.msu.edu>

Dana Booth wrote:

> In article <36ED1673.29D50D@ccrsDotnrcandOtgc.ca>
> Tom Kralidis <tom.kralidis@ccrsDotnrcandOtgc.ca> wrote:
>
> > Hi,
> >
> > At the risk of getting smart-alec replies, does anyone have any good
> > starting points for someone wanting to learn Perl.  I have a good handle
> > of UNIX (awk, grep, sed), some C/C++ and have heard nothing but good
> > things about Perl.  I would like to enhance my data manipulation
> > capabilities and productivity among other things.
>
> Programming Perl, an O'Reilly book, is very good. Like you, I also
> had some programming experience before trying Perl, and unlike
> some other languages, this made Perl a real snap, as far as getting
> the basics down. Knowing other languages can be a hinderence
> sometimes; I get impatient, and instead of learning, I just flip through
> a book until I find what I need. But with Perl, and with the book
> Programming Perl, you can get going _very_ quickly.
>
> BTW, Perl is a blast... I'm the SA at a manufacturing plant, and I
> find myself looking for reasons to write Perl. :)
>
> ---------------------------
> Dana Booth <dana[at]oz.net>
> Tacoma, Wa., USA
> ---------------------------



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

Date: 17 Mar 1999 04:51:27 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: which version of perl5/lwp should we be using?
Message-Id: <slrn7eudoc.ngp.fl_aggie@stat.fsu.edu>

On Tue, 16 Mar 1999 11:55:24 -0800, Michael Budash
<mbudash@trantracks.com> wrote:

+ what version of perl for irix should i consider the "latest" without going

Depends. Do you want the freeware-instable tarball? Then you need to
look at SGI's freeware site. Do you want to try and compile it yourself?
the look for stable_perl.tar.gz.

+ "beta"? is there some reason they host (hiway.com) would choose to stop at
+ 5.003?

Because no one bothered to upgrade? IMHO, compiling perl5* under IRIX
was a pain. On the other hand, I think I was on a woefully misconfigured
system. YMMV.

+ also: should i ask for the latest version of LWP to be installed? is it a
+ potential problem for 5.01 to be there?

Perhaps you should download 5.36 and see what the change log sez, and
if that's important?

James


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

Date: Wed, 17 Mar 1999 00:11:09 -0800
From: mbudash@sonic.net (Michael Budash)
Subject: Re: which version of perl5/lwp should we be using?
Message-Id: <mbudash-1703990011090001@d46.nas1.napa.sonic.net>

In article <slrn7eudoc.ngp.fl_aggie@stat.fsu.edu>,
fl_aggie@thepentagon.com wrote:

>On Tue, 16 Mar 1999 11:55:24 -0800, Michael Budash
><mbudash@trantracks.com> wrote:
>
>+ what version of perl for irix should i consider the "latest" without going
>+ "beta"
>
>Depends. Do you want the freeware-instable tarball? Then you need to
>look at SGI's freeware site. Do you want to try and compile it yourself?
>the look for stable_perl.tar.gz.

i'm not actually talking about installing anything...i'm just trying to
point my scripts to the 'best' (subjective, i know) version of perl
without going out on a buggy limb...

>+ is there some reason their host (hiway.com) would choose to stop at
>+ 5.003?
>
>Because no one bothered to upgrade? IMHO, compiling perl5* under IRIX
>was a pain. On the other hand, I think I was on a woefully misconfigured
>system. YMMV.

they have 5.004xx and 5.005xx, as i said in my original post. it's just
not the default...

>+ also: should i ask for the latest version of LWP to be installed? is it a
>+ potential problem for 5.01 to be there?
>
>Perhaps you should download 5.36 and see what the change log sez, and
>if that's important?

good suggestion. shoulda thoughta that. thanks.
-- 
@------------------------------@--------------------@
| Michael Budash Consulting    | 707-252-7670       |
| Perl, Javascript, PHP, MySQL | 707-258-7800 x7736 |
| Official Extropia Developer  | mbudash@sonic.net  |
@------------------------------@--------------------@


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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