[28138] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9502 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 20 14:06:14 2006

Date: Thu, 20 Jul 2006 11:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 20 Jul 2006     Volume: 10 Number: 9502

Today's topics:
        CGI.pm and lost carriage returns <jczapski@nnnot.com>
    Re: CGI.pm and lost carriage returns <David.Squire@no.spam.from.here.au>
    Re: CGI.pm and lost carriage returns xhoster@gmail.com
    Re: CGI.pm and lost carriage returns usenet@DavidFilmer.com
    Re: CGI.pm and lost carriage returns <jczapski@nnnot.com>
        Clock <fgchan@gmail.com>
        Getting started in PXPerl, i.e how to run a script? <youcontrol@hispeed.ch>
    Re: Getting started in PXPerl, i.e how to run a script? <sigzero@gmail.com>
    Re: Getting started in PXPerl, i.e how to run a script? <youcontrol@hispeed.ch>
    Re: Getting started in PXPerl, i.e how to run a script? <syscjm@gwu.edu>
    Re: Help with tied/nested data structures <mumia.w.18.spam+nospam.usenet@earthlink.net>
    Re: How to find out if a certain value is in a list? <tadmc@augustmail.com>
    Re: How to print at certain point in perl <tadmc@augustmail.com>
    Re: How to print at certain point in perl <jurgenex@hotmail.com>
    Re: How to print at certain point in perl <bart@nijlen.com>
    Re: How to print at certain point in perl <DJStunks@gmail.com>
    Re: libstdc++ problem with ExtUtils::MakeMaker sherlock@genome.stanford.edu
    Re: libstdc++ problem with ExtUtils::MakeMaker sherlock@genome.stanford.edu
        Need compress-zlib example for textfile into .gz <marc.bau@gmx.net>
    Re: Need compress-zlib example for textfile into .gz <mritty@gmail.com>
    Re: Need compress-zlib example for textfile into .gz <trwww@sbcglobal.net>
    Re: Need compress-zlib example for textfile into .gz <marc.bau@gmx.net>
    Re: Need compress-zlib example for textfile into .gz <mritty@gmail.com>
        Net:TFTPd questions - Want to upload configs via TFTP <nospam@example.com>
        Question on comparing to variables containing integers <"v.niekerk at hccnet.nl">
    Re: Question on comparing to variables containing integ <David.Squire@no.spam.from.here.au>
    Re: Question on comparing to variables containing integ <benmorrow@tiscali.co.uk>
    Re: Question on comparing to variables containing integ <David.Squire@no.spam.from.here.au>
    Re: Question on comparing to variables containing integ anno4000@radom.zrz.tu-berlin.de
    Re: Question on comparing to variables containing integ <tadmc@augustmail.com>
        XML-RPC calls with real UTF8 data failed (Erik Wasser)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 20 Jul 2006 15:52:21 GMT
From: "Joseph Czapski" <jczapski@nnnot.com>
Subject: CGI.pm and lost carriage returns
Message-Id: <VENvg.8771$ve.6252@trndny06>

Hi, Perl practitioners.  I'm having a problem with CGI.pm.  If I have an 
HTML form with a textarea input box, I would like my Perl program to see the 
carriage returns that the user typed in so I can format his text 
appropriately.

Using

     $value = $q->param($name);

gives me the text with all the carriage returns deleted.  Some words are 
just stuck together where they were separated by only one or more carriage 
returns.

I like to use CGI.pm for the neatness and the file uploading capability.

Thanks for your help!

Joe Czapski
Boston, Mass.





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

Date: Thu, 20 Jul 2006 17:02:36 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: CGI.pm and lost carriage returns
Message-Id: <e9o9es$arq$1@gemini.csx.cam.ac.uk>

Joseph Czapski wrote:
> Hi, Perl practitioners.  I'm having a problem with CGI.pm.  If I have an 
> HTML form with a textarea input box, I would like my Perl program to see the 
> carriage returns that the user typed in so I can format his text 
> appropriately.
> 
> Using
> 
>      $value = $q->param($name);
> 
> gives me the text with all the carriage returns deleted.  Some words are 
> just stuck together where they were separated by only one or more carriage 
> returns.

How and where are you displaying $value to make this judgment? In a web 
browser? If so, not that HTML does not recognize carriage returns - it 
uses <BR> (or <BR/> for XHTML :) ) to indicate line breaks.

Still, it should at least treat them as white space...

Can you give us some more details, e.g. as the posting guidelines for 
this group say, a small but complete script demonstrating your problem 
(including data)?


DS


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

Date: 20 Jul 2006 16:00:38 GMT
From: xhoster@gmail.com
Subject: Re: CGI.pm and lost carriage returns
Message-Id: <20060720120607.034$4h@newsreader.com>

"Joseph Czapski" <jczapski@nnnot.com> wrote:
> Hi, Perl practitioners.  I'm having a problem with CGI.pm.  If I have an
> HTML form with a textarea input box, I would like my Perl program to see
> the carriage returns that the user typed in so I can format his text
> appropriately.
>
> Using
>
>      $value = $q->param($name);
>
> gives me the text with all the carriage returns deleted.

Most likely, either your web browser isn't sending what you think it is
sending, or the data you are seeing is not what you think you are seeing.

Can you provide an example script that produces the form and evaluates the
response in a way to demonstrate what you are saying?

Xho

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


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

Date: 20 Jul 2006 10:15:27 -0700
From: usenet@DavidFilmer.com
Subject: Re: CGI.pm and lost carriage returns
Message-Id: <1153415727.774088.119170@75g2000cwc.googlegroups.com>

Joseph Czapski wrote:
> Hi, Perl practitioners.  I'm having a problem with CGI.pm.  If I have an
> HTML form with a textarea input box, I would like my Perl program to see the
> carriage returns that the user typed in so I can format his text appropriately.

I think CGI is a great module, but the one fault that I would find is
the sloppy and incomplete perldocs.  I cannot think of a Perl builtin
module that has worse documentation.

IMHO, If someone wants to do serious CGI programming, s/he really needs
to get a book that fills in the gaping holes in the perldocs.
Unfortunately, the selection is neither wide nor particularly good.  I
have the "Official Guide to Programming with CGI.pm" by Lincoln Stein
(the author of the module), which is kinda like an annotated version of
the perldocs. But, at least, it has fairly complete information.

Page 261-262 of the "Official Guide" describes the behavior of the
textarea's wrapping properties, which is controlled by a "-wrap"
argument (which is not mentioned in any way in the perldocs).

<quote>
-wrap: Sets the WRAP attribute. It can be one of "off," "physical," or
"virtual."  If "off," word wrapping only occurs in the field when the
user presses the Enter key. The contents of the field are transmitted
to your script with line breaks inserted exactly as they were displayed
to the user. If "physical," word wrapping occurs automatically when the
text exceeds the width of the field, and the text is transmitted to
your script as if the user had actually transmitted it that way.  If
"virtual," word wrapping occurs automatically when the text exceeds the
width of the field, but the contents of the field are transmitted to
your script as a single unbroken line of text (unless the user inserts
a blank line manually).
</quote>

Of course, someone who was rather familiar with HTML itself could
probably guess how WRAP (which is an HTML property) is implemented in
CGI.pm.  Personally, though, I use CGI precisely because I DON'T want
to fool with the oddities of HTML.

-- 
David Filmer (http://DavidFilmer.com)



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

Date: Thu, 20 Jul 2006 17:37:40 GMT
From: "Joseph Czapski" <jczapski@nnnot.com>
Subject: Re: CGI.pm and lost carriage returns
Message-Id: <EbPvg.12076$Te.12035@trndny02>

David Filmer wrote:
 ...
> -wrap: Sets the WRAP attribute. It can be one of "off," "physical," or
> "virtual."  If "off," word wrapping only occurs in the field when the
> user presses the Enter key. The contents of the field are transmitted
> to your script with line breaks inserted exactly as they were displayed
> to the user. If "physical," word wrapping occurs automatically when the
> text exceeds the width of the field, and the text is transmitted to
> your script as if the user had actually transmitted it that way.  If
> "virtual," word wrapping occurs automatically when the text exceeds the
> width of the field, but the contents of the field are transmitted to
> your script as a single unbroken line of text (unless the user inserts
> a blank line manually).
 ...

Holy smoke, I think the WRAP attribute may be the issue.  I have it set to 
'virtual' on all forms.  I'm going to test that and then reply back.

Thank you very much!

Joe Czapski
Boston, Mass.





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

Date: 20 Jul 2006 10:42:42 -0700
From: "TheOrangeRemix" <fgchan@gmail.com>
Subject: Clock
Message-Id: <1153417362.041583.81100@b28g2000cwb.googlegroups.com>

Hi,

I would like to set up a script that includes a Windows API interface
of a pop-up that displays a changeable date and time. Whatever date and
time is set, the program will input that data into a time array.

For example, I if I run the program, set today's date and time on the
interface: July 20, 2006 10:40 AM, it will output the result into an
array like this:

@runtime = (0, 40, 10, 20, 6, 2006); ### (seconds, minutes, hours, day,
month (-1), year)

I guess there are two questions involved: how do I call the described
API and how does it get placed into an array for processing?



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

Date: Thu, 20 Jul 2006 16:12:21 +0200
From: =?ISO-8859-1?Q?Markus_H=E4nchen?= <youcontrol@hispeed.ch>
Subject: Getting started in PXPerl, i.e how to run a script?
Message-Id: <44bf8f44@news1.ethz.ch>

Hi,

I just tried to get Perl running on a Windows 2000 machine (coming from 
Mac OS X) and started by installing PXPerl (http://pxperl.com). 
Installation went ahead without any errors.

But I have not figured out yet, how to a run a script.

I tried to run a simple script in the console simply by typing 
'helloWorld.pl' (i.e. the name of the script). Upon doing that an 
application called SciTE opens and displays the file (SciTE looks like 
being a simple editor). Trying out the menu 'Tools -> Compile', I get 
the output:

>perl helloWorld.pl
>The system cannot find the file specified.

What is going wrong here? Or, what I am doing wrong?

Any help is highly appreciated.

Markus

P.S.: The script:
#!perl
print "Hello World!\n";

It has DOS line endings.



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

Date: 20 Jul 2006 07:25:13 -0700
From: "Robert Hicks" <sigzero@gmail.com>
Subject: Re: Getting started in PXPerl, i.e how to run a script?
Message-Id: <1153405513.752188.120200@h48g2000cwc.googlegroups.com>


Markus H=E4nchen wrote:
> Hi,
>
> I just tried to get Perl running on a Windows 2000 machine (coming from
> Mac OS X) and started by installing PXPerl (http://pxperl.com).
> Installation went ahead without any errors.
>
> But I have not figured out yet, how to a run a script.
>
> I tried to run a simple script in the console simply by typing
> 'helloWorld.pl' (i.e. the name of the script). Upon doing that an
> application called SciTE opens and displays the file (SciTE looks like
> being a simple editor). Trying out the menu 'Tools -> Compile', I get
> the output:
>
> >perl helloWorld.pl
> >The system cannot find the file specified.
>
> What is going wrong here? Or, what I am doing wrong?
>
> Any help is highly appreciated.
>
> Markus
>
> P.S.: The script:
> #!perl
> print "Hello World!\n";
>
> It has DOS line endings.

The "bin" directory isn't in your PATH probably.

The bigger question is why PXPerl? I don't (or didn't) think it is
being worked on any more.

Robert



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

Date: Thu, 20 Jul 2006 18:45:47 +0200
From: =?ISO-8859-1?Q?Markus_H=E4nchen?= <youcontrol@hispeed.ch>
Subject: Re: Getting started in PXPerl, i.e how to run a script?
Message-Id: <44bfb33b@news1.ethz.ch>

> The "bin" directory isn't in your PATH probably.
> 
> The bigger question is why PXPerl? I don't (or didn't) think it is
> being worked on any more.
> 
> Robert

Thanks for the reply. I have figured it out myself in the meantime 
(typing 'perl helloWorld.pl' works now):

I had to restart Windows!

Coming from Mac OS X, I did not consider that after fiddling with the 
PATH, as the PXPerl installer did, one might have to restart, and I 
also did not see anything in the PXPerl instructions asking for a 
restart.

As to why I chose PXPerl, browsing through the list at 
www.cpan.org/ports/#win32, and not knowing anything about Perl on 
Windows, its description sounded appealing and installation was also 
absolutely straightforward.
But since I have to install Perl on other Windows machines as well, 
what distribution would you recommend?

Markus



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

Date: Thu, 20 Jul 2006 14:04:21 -0400
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: Getting started in PXPerl, i.e how to run a script?
Message-Id: <12bvhdcevk7mvad@corp.supernews.com>

Markus Hänchen wrote:
>> The "bin" directory isn't in your PATH probably.
>>
>> The bigger question is why PXPerl? I don't (or didn't) think it is
>> being worked on any more.
>>
>> Robert
> 
> 
> Thanks for the reply. I have figured it out myself in the meantime 
> (typing 'perl helloWorld.pl' works now):
> 
> I had to restart Windows!
> 
> Coming from Mac OS X, I did not consider that after fiddling with the 
> PATH, as the PXPerl installer did, one might have to restart, and I also 
> did not see anything in the PXPerl instructions asking for a restart.
> 
> As to why I chose PXPerl, browsing through the list at 
> www.cpan.org/ports/#win32, and not knowing anything about Perl on 
> Windows, its description sounded appealing and installation was also 
> absolutely straightforward.
> But since I have to install Perl on other Windows machines as well, what 
> distribution would you recommend?
> 
> Markus
> 

I don't run Perl on Windows myself, but ActiveState seems to be what 
everybody on Windows uses.


Chris Mattern
on Windows uses.


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

Date: Thu, 20 Jul 2006 11:23:12 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: Help with tied/nested data structures
Message-Id: <AIJvg.7269$vO.274@newsread4.news.pas.earthlink.net>

On 07/19/2006 08:46 PM, Dr.Ruud wrote:
> Mumia W. schreef:
> 
>>      my ($self) = shift;
>> [...]
>>      my ($self) = shift;
>> [...]
>>      my $self = shift;
> 
> Any special reason for the difference?
> 

No reason other than the fact that the program went through 
several changes. Heck, I even realized I left some debugging 
cruft in it after I'd posted :)



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

Date: Thu, 20 Jul 2006 06:49:28 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How to find out if a certain value is in a list?
Message-Id: <slrnebure8.drq.tadmc@magna.augustmail.com>

TN <tjpn@not_spam.surfeu.fi> wrote:

> what would be the shortest (or best...) way to find out if a certain value 
> is in the list like in the code here:
            ^^^^
            ^^^^

   perldoc -q list

       How can I tell whether a certain element is contained in a list or
       array?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 20 Jul 2006 07:08:50 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How to print at certain point in perl
Message-Id: <slrnebusii.drq.tadmc@magna.augustmail.com>

Bart Van der Donck <bart@nijlen.com> wrote:
> Amaninder wrote:
> 
>> I want to print something, lets say "abc",  at certain point on the
>> screen no matter whats come before it.


> for (split /\n/, $lines)  {
>   my $sp = '';
>   $sp.=' ' for ( 1 .. ($max + $spaces - length($_)) );
>   print $_ . $sp . $str . "\n";
> }


Or let printf do it for you by replacing that loop body with:

      printf "%-${max}s%${spaces}s%s\n", $_, ' ', $str;

or the same thing formatted for human consumption:

      printf "%-${max}s"    # the variable length string
           . "%${spaces}s"  # the offset between columns
           . "%s\n"         # the string to be aligned
           , $_
           , ' '
           , $str;


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 20 Jul 2006 12:48:47 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How to print at certain point in perl
Message-Id: <PYKvg.4357$us.1989@trnddc04>

Bart Van der Donck wrote:
>  my $sp = '';
>  $sp.=' ' for ( 1 .. ($max + $spaces - length($_)) );

Did you mean
    my $sp = ' ' x ($max + $spaces - length($_));

jue 




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

Date: 20 Jul 2006 06:39:15 -0700
From: "Bart Van der Donck" <bart@nijlen.com>
Subject: Re: How to print at certain point in perl
Message-Id: <1153402755.249436.193840@m79g2000cwm.googlegroups.com>

J=FCrgen Exner wrote:

> Bart Van der Donck wrote:
> >  my $sp =3D '';
> >  $sp.=3D' ' for ( 1 .. ($max + $spaces - length($_)) );
>
> Did you mean
>     my $sp =3D ' ' x ($max + $spaces - length($_));

Just for the hi-score, actually the whole block:

for (split /\n/, $lines)  {
  my $sp =3D '';
  $sp.=3D' ' for ( 1 .. ($max + $spaces - length($_)) );
  print $_ . $sp . $str . "\n";
}

could be rewritten as:

print $_ .' 'x($max+$spaces-length($_)).$str."\n"for(split/\n/,$lines);

--=20
 Bart



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

Date: 20 Jul 2006 06:53:18 -0700
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: How to print at certain point in perl
Message-Id: <1153403598.476803.264700@m79g2000cwm.googlegroups.com>

Bart Van der Donck wrote:
> Just for the hi-score, actually the whole block:
>
> for (split /\n/, $lines)  {
>   my $sp = '';
>   $sp.=' ' for ( 1 .. ($max + $spaces - length($_)) );
>   print $_ . $sp . $str . "\n";
> }
>
> could be rewritten as:
>
> print $_ .' 'x($max+$spaces-length($_)).$str."\n"for(split/\n/,$lines);

I didn't know there was a hi-score involved!  My contribution:

  #!/usr/bin/perl

  use strict;
  use warnings;

  use Text::Table;
  my $tb = Text::Table->new();

  $tb->add($_,'abc') while <DATA>;

  print $tb;

  __DATA__
  wwwwwwwwwwwwwwwwwwwwwwwwwwww
  qqqqqqqqqqqqqqqqqqqqq
  zzzzzzzzzzzzzzzzzzzzzzzzzzzz
  eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

-jp



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

Date: 20 Jul 2006 07:20:45 -0700
From: sherlock@genome.stanford.edu
Subject: Re: libstdc++ problem with ExtUtils::MakeMaker
Message-Id: <1153405245.002518.162200@s13g2000cwa.googlegroups.com>

Hi Rob,

Thanks for the reply.  Using :

perl -e 'require ExtUtils::Liblist; ExtUtils::Liblist->ext("-lstdc++",
1, 1);'

I get:

Potential libraries are '-lstdc++':
stdc++ not found in /usr/local/lib
stdc++ not found in /usr/lib
Note (probably harmless): No library found for -lstdc++

poking around in /usr/lib, I see:

libstdc++-static.a
libstdc++.6.0.3.dylib*
libstdc++.6.0.4.dylib*
libstdc++.6.dylib@ -> libstdc++.6.0.4.dylib

but this is where my ignorance prevents me from knowing if this is what
I'm looking for.  Poking around a little further, there is also:

/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libstdc++.dylib

which probably is what I want, and the compiler seems to know how to
find when given the -lstdc++ flag, but MakeMaker doesn't know how to
find, so won't provide the flag (in fact this is a link to
libstdc++.6.dylib back in the /usr/lib directory).

I'll also try asking the unix porting group over on the Apple pages,

Cheers,
Gavin

Sisyphus wrote:
> <sherlock@genome.stanford.edu> wrote in message
> news:1153358349.380043.115680@75g2000cwc.googlegroups.com...
> > Hi,
> >
> > The GO::TermFinder modules
> > (http://search.cpan.org/dist/GO-TermFinder/), which I wrote, often seem
> > to have problems (platform dependent) when doing the make step,
> > specifically compiling the swig code in the 'native' directory.  The
> > Makefile.PL in that directory has:
> >
> >  'LIBS'            => ['-lm -lstdc++'],
> >
> > but when the make is run, I see a complaint:
> >
> > Note (probably harmless): No library found for -lstdc++
> .
> .
> > If however, I look at the generated
> > Makefile in the native directory, I see:
> >
> > LDLOADLIBS = -lm
>
> Yep, '-lstdc++' is not added to LDLOADLIBS because that library could not be
> found when running the Makefile.PL. (If it had been found it *would* have
> been added.)
> And yet, the library is obviously present and *can* be located by the build
> ('make') process. The question therefore becomes "Why is the stdc++ library
> not located by the 'perl Makefile.PL" process ?"
>
> I don't know the answer, but the ExtUtils::LibList documentation may help
> you to devise some tests that you can run on the problem platform(s) to
> determine the cause.
> 
> Cheers,
> Rob



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

Date: 20 Jul 2006 08:17:22 -0700
From: sherlock@genome.stanford.edu
Subject: Re: libstdc++ problem with ExtUtils::MakeMaker
Message-Id: <1153408642.902525.116410@m79g2000cwm.googlegroups.com>

The answer I got on the MacOSX porting list was:

> You need to somehow get perl to use g++ to link the module instead of
> gcc. You'll probably need to use some tool to detect the platform c++
> compiler and then use that. I'll suggest autoconf et. al. but many
> people seem to have some kind of religious thing against the autotools,
> so use whatever is apropriate.

but I'm don't really know how to implement that advice, and a search of
the MakeMaker docs doesn't find any reference to gcc or g++, so I don't
know if I can use MakeMaker to specify g++ instead of gcc.  If anyone
has any follow up advice, it would be much appreciated,

Cheers,
Gavin


sherlock@genome.stanford.edu wrote:
> Hi Rob,
>
> Thanks for the reply.  Using :
>
> perl -e 'require ExtUtils::Liblist; ExtUtils::Liblist->ext("-lstdc++",
> 1, 1);'
>
> I get:
>
> Potential libraries are '-lstdc++':
> stdc++ not found in /usr/local/lib
> stdc++ not found in /usr/lib
> Note (probably harmless): No library found for -lstdc++
>
> poking around in /usr/lib, I see:
>
> libstdc++-static.a
> libstdc++.6.0.3.dylib*
> libstdc++.6.0.4.dylib*
> libstdc++.6.dylib@ -> libstdc++.6.0.4.dylib
>
> but this is where my ignorance prevents me from knowing if this is what
> I'm looking for.  Poking around a little further, there is also:
>
> /usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libstdc++.dylib
>
> which probably is what I want, and the compiler seems to know how to
> find when given the -lstdc++ flag, but MakeMaker doesn't know how to
> find, so won't provide the flag (in fact this is a link to
> libstdc++.6.dylib back in the /usr/lib directory).
>
> I'll also try asking the unix porting group over on the Apple pages,
>
> Cheers,
> Gavin
>
> Sisyphus wrote:
> > <sherlock@genome.stanford.edu> wrote in message
> > news:1153358349.380043.115680@75g2000cwc.googlegroups.com...
> > > Hi,
> > >
> > > The GO::TermFinder modules
> > > (http://search.cpan.org/dist/GO-TermFinder/), which I wrote, often seem
> > > to have problems (platform dependent) when doing the make step,
> > > specifically compiling the swig code in the 'native' directory.  The
> > > Makefile.PL in that directory has:
> > >
> > >  'LIBS'            => ['-lm -lstdc++'],
> > >
> > > but when the make is run, I see a complaint:
> > >
> > > Note (probably harmless): No library found for -lstdc++
> > .
> > .
> > > If however, I look at the generated
> > > Makefile in the native directory, I see:
> > >
> > > LDLOADLIBS = -lm
> >
> > Yep, '-lstdc++' is not added to LDLOADLIBS because that library could not be
> > found when running the Makefile.PL. (If it had been found it *would* have
> > been added.)
> > And yet, the library is obviously present and *can* be located by the build
> > ('make') process. The question therefore becomes "Why is the stdc++ library
> > not located by the 'perl Makefile.PL" process ?"
> >
> > I don't know the answer, but the ExtUtils::LibList documentation may help
> > you to devise some tests that you can run on the problem platform(s) to
> > determine the cause.
> > 
> > Cheers,
> > Rob



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

Date: Thu, 20 Jul 2006 15:48:22 +0200
From: "Marc Bauer" <marc.bau@gmx.net>
Subject: Need compress-zlib example for textfile into .gz
Message-Id: <44bf89b4$0$31181$bb690d87@news.main-rheiner.de>

hi

i searched the net and read the docu of Compress-Zlib. But i do not 
understand the Compress-Zlib examples... :-(.

please give me a simple example, to compress a txt file on my disk to .gz - 
nothing more.


Regards
Marc 




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

Date: 20 Jul 2006 07:19:22 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Need compress-zlib example for textfile into .gz
Message-Id: <1153405162.861566.241330@b28g2000cwb.googlegroups.com>

Marc Bauer wrote:
> i searched the net and read the docu of Compress-Zlib. But i do not
> understand the Compress-Zlib examples... :-(.

It would be most helpful if you could explain *what* you don't
understand about them.  That way, we can help you to learn.

> please give me a simple example, to compress a txt file on my disk to .gz -
> nothing more.

Since I'd never used this module before either, I consider this a good
learning exercise for myself.  The below seems to work, gzipping any
file provided on the command line (but not removing the original, as
the actual gzip program does):

#!/usr/bin/perl
use strict;
use warnings;
use Compress::Zlib;

@ARGV > 0 or die "Usage: $0 <file1> [<file2> [<file3> ... ] ]\n";

for my $file (@ARGV) {
    open my $fh, '<', $file or
        warn "Could not open '$file': $!\n" and next;
    my $gz = gzopen("$file.gz", "w") or die "Cannot open $file.gz: $!";

    while (<$fh>) {
        $gz->gzwrite($_); 
    } 
    $gz->gzclose(); 
}



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

Date: Thu, 20 Jul 2006 14:25:28 GMT
From: "Todd W" <trwww@sbcglobal.net>
Subject: Re: Need compress-zlib example for textfile into .gz
Message-Id: <snMvg.70589$fb2.47960@newssvr27.news.prodigy.net>


"Marc Bauer" <marc.bau@gmx.net> wrote in message 
news:44bf89b4$0$31181$bb690d87@news.main-rheiner.de...
> hi
>
> i searched the net and read the docu of Compress-Zlib. But i do not 
> understand the Compress-Zlib examples... :-(.
>
> please give me a simple example, to compress a txt file on my disk to 
> .gz - nothing more.
>

Do the programs in the examples directory that come with the distro not 
suffice:

http://search.cpan.org/src/PMQS/Compress-Zlib-1.42/examples/

?

Todd W.




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

Date: Thu, 20 Jul 2006 17:48:34 +0200
From: "Marc Bauer" <marc.bau@gmx.net>
Subject: Re: Need compress-zlib example for textfile into .gz
Message-Id: <44bfa5d6$0$31183$bb690d87@news.main-rheiner.de>

hi

i tryed this and it produces corrupt files.


use Compress::Zlib;

my $tmpdir='./tmp';
my $outputdir='.';

my $inputfile="$tmpdir/test.txt";
my $outputfile="$outputdir/test.txt.gz";

binmode FILE;
open (FILE, '<', $inputfile) or die "Could not open $inputfile: $!\n";

my $gz = gzopen($outputfile, "w") or die "Cannot open $outputfile: 
$gzerrno\n";

while (<FILE>) {
    $gz->gzwrite($_) or die "error writing: $gzerrno\n" ;
}
$gz->gzclose();

close (FILE);



Regards
Marc




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

Date: 20 Jul 2006 09:48:15 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Need compress-zlib example for textfile into .gz
Message-Id: <1153414095.884389.253040@i3g2000cwc.googlegroups.com>

Marc Bauer wrote:
> hi
>
> i tryed this and it produces corrupt files.

What you posted worked perfectly for me.  It created test.txt.gz in the
current directory.  I then gunzipped that file and saw my original
file.

By what means are you determining that the files it produces are
"corrupt"?

Paul Lalli



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

Date: Thu, 20 Jul 2006 09:59:35 -0700
From: "Chris G." <nospam@example.com>
Subject: Net:TFTPd questions - Want to upload configs via TFTP
Message-Id: <44bfb67e$0$17998$892e7fe2@authen.yellow.readfreenews.net>

I am writing a script that will log into my network equipment and backup
the configurations to a TFTP server.  Since I don't want the security
risk of a TFTP server running all the time, I want to create a TFTP
server when the script starts and destroy it when I am done.  My problem
is that the Net::TFTPd module does not seem to process any of the
requests.  Issuing a "netstat -a" does show a socket created on port 69,
but nothing else.  The script times out and dies.  Is that module
compatible with current versions of perl, since it was written for perl
5.006?

Has anyone else done this or had experience trying to do this?  I am
running perl under RedHat Enterprise Linux 4.  Suggestions or actual
code would be helpful and appreciated.

Thanks,

Chris G.
cgauthie^gmail(dot)com





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

Date: Thu, 20 Jul 2006 13:02:22 +0200
From: Huub <"v.niekerk at hccnet.nl">
Subject: Question on comparing to variables containing integers
Message-Id: <44bf62b9$0$24006$e4fe514c@dreader24.news.xs4all.nl>

Hi,

I try to read an integer from MySQL and compare it in an if statement: 
if ($var == $compare) {}. The reading from MySQL is fine. The problem I 
have is getting the correct value in $var. What I did when comparing 2 
strings was this:

	@betaald = $sth->fetchrow_array;
	$betaald[0] = @betaald;
	$betaald = $betaald[0];
	$vergelijk = "N";
	if ($betaald == $vergelijk) {..code..}

I had hoped to use the same handling for an integer, but that doesn't 
work. If say @betaald = 3, then $betaald[0] turns out to be 1, not 3. I 
understand that "1' is the length of @betaald.
So far, I can't find what I need on CPAN, unless I'm looking for the 
wrong thing.
Thanks for helping out (hint/clue/link),

Huub


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

Date: Thu, 20 Jul 2006 12:14:47 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: Question on comparing to variables containing integers
Message-Id: <e9noj7$4te$1@gemini.csx.cam.ac.uk>

Huub wrote:
> Hi,
> 
> I try to read an integer from MySQL and compare it in an if statement: 
> if ($var == $compare) {}. The reading from MySQL is fine. The problem I 
> have is getting the correct value in $var. What I did when comparing 2 
> strings was this:
> 
>     @betaald = $sth->fetchrow_array;
>     $betaald[0] = @betaald;

You have now written the size of the array @betaald into the first 
element of that array, $betaald[0], overwriting whatever was there. Is 
the what you meant to do?

>     $betaald = $betaald[0];

Now you copy $betaald[0], which holds the size of the array @betaald, 
into a scalar called $betaald.

>     $vergelijk = "N";

This is a string.

>     if ($betaald == $vergelijk)

You are comparing using ==, which is for numerical comparisons, but 
$vergelijk contains a string, which will evaluate as zero in numeric 
context (IIRC).

> {..code..}
> 
> I had hoped to use the same handling for an integer, but that doesn't 
> work. If say @betaald = 3

This means that the array @betaald has three elements. Is that what you 
think it means?

>, then $betaald[0] turns out to be 1, not 3. I 
> understand that "1' is the length of @betaald.

Well, I guess @betaald only had one element.

It's hard to tell from this, but I suspect that what you want is 
something like:

@betaald = $sth->fetchrow_array;
if ($betaald[0] == 1234) { do something }

Though you really should check that @betaald contains something before 
acting on it...


DS


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

Date: Thu, 20 Jul 2006 12:50:19 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: Question on comparing to variables containing integers
Message-Id: <r874p3-1cp.ln1@osiris.mauzo.dyndns.org>


Quoth David Squire <David.Squire@no.spam.from.here.au>:
> Huub wrote:
> > 
> > I had hoped to use the same handling for an integer, but that doesn't 
> > work. If say @betaald = 3
> 
> This means that the array @betaald has three elements. Is that what you 
> think it means?

No it doesn't. 

    if (@betaald == 3) {...}

checks if the array has 3 elements, but @betaald = 3 is the same as
@betaald = (3) and gives the array one element with the value 3.

> >, then $betaald[0] turns out to be 1, not 3. I 
> > understand that "1' is the length of @betaald.
> 
> Well, I guess @betaald only had one element.

Well, yes.

Ben

-- 
   Razors pain you / Rivers are damp
   Acids stain you / And drugs cause cramp.                    [Dorothy Parker]
Guns aren't lawful / Nooses give
  Gas smells awful / You might as well live.            benmorrow@tiscali.co.uk


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

Date: Thu, 20 Jul 2006 12:57:47 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: Question on comparing to variables containing integers
Message-Id: <e9nr3s$a7t$1@gemini.csx.cam.ac.uk>

Ben Morrow wrote:
> Quoth David Squire <David.Squire@no.spam.from.here.au>:
>> Huub wrote:
>>> I had hoped to use the same handling for an integer, but that doesn't 
>>> work. If say @betaald = 3
>> This means that the array @betaald has three elements. Is that what you 
>> think it means?
> 
> No it doesn't. 
> 
>     if (@betaald == 3) {...}
> 
> checks if the array has 3 elements, but @betaald = 3 is the same as
> @betaald = (3) and gives the array one element with the value 3.
> 

Sure, but I did not interpret the OPs "@betaald = 3" in text as an 
assignment (since there was nothing like that in his code), but as 
short-hand for "@betaald has the value of 3", which I would be prepared 
to bet is what he meant. (Still, I guess it is good practice to 
discourage using code-like things in non=code-like ways).


DS


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

Date: 20 Jul 2006 12:20:08 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Question on comparing to variables containing integers
Message-Id: <4i9anoF2nrliU2@news.dfncis.de>

David Squire  <David.Squire@no.spam.from.here.au> wrote in comp.lang.perl.misc:

> to bet is what he meant. (Still, I guess it is good practice to 
> discourage using code-like things in non=code-like ways).

 ...such as using an equals-sign where a hyphen should go? :)

Anno


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

Date: Thu, 20 Jul 2006 07:25:11 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Question on comparing to variables containing integers
Message-Id: <slrnebuth7.drq.tadmc@magna.augustmail.com>

Huub <> wrote:

> I try to read an integer from MySQL and compare it in an if statement: 
> if ($var == $compare) {}. 


That should work fine if $var and $compare are indeed numbers.

If it isn't working then you don't have a problem with the comparison,
you have a problem with how you put the values into one or both
of those variables.

Find out what values you have by inserting a debugging statement
before that if:

   print "comparing ($var == $compare)\n";


> The problem I 
> have is getting the correct value in $var. What I did when comparing 2 
> strings was this:
> 
> 	@betaald = $sth->fetchrow_array;
> 	$betaald[0] = @betaald;


This stomps over the value of the first element, replacing it with
the number of elements in the array.


> 	$betaald = $betaald[0];
> 	$vergelijk = "N";
> 	if ($betaald == $vergelijk) {..code..}
                     ^^

"eq" is for comparing strings.

"==" is for comparing numbers.

$vergelijk is clearly a string, so you are using the wrong operator,
which you should already know since you should always enable warnings
when developing Perl code.


> I had hoped to use the same handling 


Errr, but it is wrong.

If you base new stuff on something that is wrong, the new stuff
will also be wrong.


> for an integer, but that doesn't 
> work. 


It does exactly what you told it to do.

If that isn't what you want, then you need to tell it to do something else.


> If say @betaald = 3, then $betaald[0] turns out to be 1, not 3. I 
> understand that "1' is the length of @betaald.


If you want the value of the 1st element instead of the number of
elements then don't stomp over the value of the 1st element with
the number of elements.


> Thanks for helping out (hint/clue/link),


   if ($betaald[0] == $vergelijk) {..code..}   # if numbers

   if ($betaald[0] eq $vergelijk) {..code..}   # if strings


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 20 Jul 2006 17:40:49 +0200
From: fuzz@uni-paderborn.de (Erik Wasser)
Subject: XML-RPC calls with real UTF8 data failed
Message-Id: <1pk4p3-hti.ln1@wasser-7359.user.cis.dfn.de>

Today I've tried to do some XML-RPC calls with 3 different libraries. 
And I failed. Or - to be more exact - the libraries failed, but read on. 
Here's an client example for the 'Frontier::Client' library:

#!/usr/bin/perl

use strict;
use warnings;

use Frontier::Client;
use Data::Dumper;

use utf8;
use encoding 'utf8';

my $client = Frontier::Client->new(
   # please ignore the fact that google is not offering
   # any services under this adress
   url          => 'http://www.google.com',
   encoding     => 'utf-8',
   use_objects  => 0,
);

print Dumper($client->call('double', 'ä'));

The script have to be saved in UTF8 mode otherwise the umlaut will not 
be saved correctly. Here's the output of the RPC request call:

0x0000:  4500 00ce fd6e 4000 4006 8183 0a00 10dc  E....n@.@.......
0x0010:  42f9 5d63 c507 0050 574e 1362 7e4c ff2e  B.]c...PWN.b~L..
0x0020:  5018 16d0 bbf8 0000 3c3f 786d 6c20 7665  P.......<?xml.ve
0x0030:  7273 696f 6e3d 2231 2e30 2220 656e 636f  rsion="1.0".enco
0x0040:  6469 6e67 3d22 7574 662d 3822 3f3e 0a3c  ding="utf-8"?>.<
0x0050:  6d65 7468 6f64 4361 6c6c 3e0a 3c6d 6574  methodCall>.<met
0x0060:  686f 644e 616d 653e 646f 7562 6c65 3c2f  hodName>double</
0x0070:  6d65 7468 6f64 4e61 6d65 3e0a 3c70 6172  methodName>.<par
0x0080:  616d 733e 0a3c 7061 7261 6d3e 3c76 616c  ams>.<param><val
0x0090:  7565 3e3c 7374 7269 6e67 3ee4 3c2f 7374  ue><string>.</st
0x00a0:  7269 6e67 3e3c 2f76 616c 7565 3e3c 2f70  ring></value></p
0x00b0:  6172 616d 3e0a 3c2f 7061 7261 6d73 3e0a  aram>.</params>.
0x00c0:  3c2f 6d65 7468 6f64 4361 6c6c 3e0a       </methodCall>.

The XML was correctly marked with UTF-8 but the german umlaut is encoded 
in one octet (0xe4) but german umlauts are two octets in UTF-8.

The two others libraries (RPC::XML::Client and XMLRPC::Lite) failed in 
nearly the same way. But I don't want to pretend that I'm the super 
programmer so maybe I'm here the problem.

Is there anyone out there who is using XML-RPC in perl with real UTF-8 
parameters (not encoded in Base64)? A lot of example scripts from the 
internet are still using plain 7-Bit ASCII and that is not a problem at 
all.

Any hints or urls are welcome.

-- 
So long... Fuzz


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 9502
***************************************


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