[29837] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1080 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 29 14:09:54 2007

Date: Thu, 29 Nov 2007 11:09:07 -0800 (PST)
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, 29 Nov 2007     Volume: 11 Number: 1080

Today's topics:
        <<<<<<< HUNDSOME GAIN WITHOUT INVEST ON NET>>>>>>> <foxcat65@gmail.com>
        dprofpp Garbled profile error <avilella@gmail.com>
    Re: dprofpp Garbled profile error <ben@morrow.me.uk>
    Re: equivalent controls <tzz@lifelogs.com>
        Errors using installing perl modules <gabrielepetrone@gmail.com>
    Re: How to persist and query a hash lookup in memory wi <tzz@lifelogs.com>
    Re: How to persist and query a hash lookup in memory wi xhoster@gmail.com
    Re: How to persist and query a hash lookup in memory wi <jimsgibson@gmail.com>
    Re: making the keys of a hash from parameters collected <rallabs@adelphia.net>
    Re: making the keys of a hash from parameters collected <krahnj@telus.net>
    Re: making the keys of a hash from parameters collected <1usa@llenroc.ude.invalid>
        PDF::Reuse & UK currency 'pound' symbol <justin.0711@purestblue.com>
    Re: PDF::Reuse & UK currency 'pound' symbol <ben@morrow.me.uk>
    Re: perl ftp and hidden partitions schmmichael@gmail.com
    Re: retrieving news messages <invalid@invalid.net>
    Re: retrieving news messages <tadmc@seesig.invalid>
    Re: retrieving news messages <1usa@llenroc.ude.invalid>
    Re: SvUOK always fails on 64bit platform <ben@morrow.me.uk>
        what "shift" does, if not "$_ = shift;" ? <devphyl@gmail.com>
    Re: what "shift" does, if not "$_ = shift;" ? <peter@makholm.net>
    Re: what "shift" does, if not "$_ = shift;" ? <devphyl@gmail.com>
    Re: writing to a notepad in perl <tadmc@seesig.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 29 Nov 2007 00:54:30 -0800 (PST)
From: dfh <foxcat65@gmail.com>
Subject: <<<<<<< HUNDSOME GAIN WITHOUT INVEST ON NET>>>>>>>
Message-Id: <9236dccb-44d6-411e-a7f1-ee137de57f64@a39g2000pre.googlegroups.com>

Hundsome profit from internet

  Make quick good cash working 2 to 3 hours a day
=B7 Work part time or full time as you like .
=2E Work anywhere from home/ office without restrictions
=B7 Guaranteed payment month after month

Get the Secret Formula Money Making Formula a the links below

http://moneywithaffiliateprogram.blogspot.com/



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

Date: Thu, 29 Nov 2007 03:28:48 -0800 (PST)
From: "avilella@gmail.com" <avilella@gmail.com>
Subject: dprofpp Garbled profile error
Message-Id: <f7461785-34c2-4732-a872-8c18b19b2f00@b15g2000hsa.googlegroups.com>

Hi all,

When I execute:

perl -MDevel::Profiler myscript.pl
dprofpp tmon.out

I get:

Garbled profile, missing an enter time stamp at /usr/bin/dprofpp line
816, <fh> line 28624.

I googled for it, but couldn't find any info about this error.

Anyone?


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

Date: Thu, 29 Nov 2007 12:50:51 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: dprofpp Garbled profile error
Message-Id: <b6p225-gr1.ln1@osiris.mauzo.dyndns.org>


Quoth "avilella@gmail.com" <avilella@gmail.com>:
> Hi all,
> 
> When I execute:
> 
> perl -MDevel::Profiler myscript.pl
> dprofpp tmon.out
> 
> I get:
> 
> Garbled profile, missing an enter time stamp at /usr/bin/dprofpp line
> 816, <fh> line 28624.
> 
> I googled for it, but couldn't find any info about this error.

You didn't check rt.cpan.org: find the Devel-Profiler distribution on
search.cpan.org, and click on the View/Report bugs link. There was a bug
filed three years ago that suggests D::P doesn't like XS modules. Are
you using any?

Ben



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

Date: Thu, 29 Nov 2007 10:13:30 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: equivalent controls
Message-Id: <86wss1113p.fsf@lifelogs.com>

On Thu, 29 Nov 2007 04:40:31 GMT "Jürgen Exner" <jurgenex@hotmail.com> wrote: 

JE> Wade Ward wrote:
>> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
>> ## contributors: joe smith, jean luc, Jürgen Exner

JE> Please remove my name. I would be ashamed to be associated with such code.

Don't be so modest, you could collect on the royalties! :)

Ted


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

Date: Thu, 29 Nov 2007 10:26:38 -0800 (PST)
From: Manuel <gabrielepetrone@gmail.com>
Subject: Errors using installing perl modules
Message-Id: <95591a9a-da0b-45d5-9626-fc8499324812@e25g2000prg.googlegroups.com>

Hallo,
i normally used ppm to install perl modules on windows and i never had
any problems. I just switched to linux (xubuntu) and i'm trying to
install WWW::Mechanize but it does not work. This is what i did ( root
user):

root@server:~/Desktop# perl -MCPAN -e shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.7601)
ReadLine support available (try 'install Bundle::CPAN')
cpan> install WWW::Mechanize
Running install for module WWW::Mechanize
Running make for P/PE/PETDANCE/WWW-Mechanize-1.32.tar.gz
CPAN: Digest::MD5 loaded ok
CPAN: Compress::Zlib loaded ok
Checksum for /root/.cpan/sources/authors/id/P/PE/PETDANCE/WWW-
Mechanize-1.32.tar.gz ok
Scanning cache /root/.cpan/build for sizes
Deleting from cache: /root/.cpan/build/Crypt-SSLeay-0.57 (11.0>10.0
MB)
Deleting from cache: /root/.cpan/build/YAML-0.66 (10.7>10.0 MB)
Deleting from cache: /root/.cpan/build/libwww-perl-5.808 (10.2>10.0
MB)
WWW-Mechanize-1.32/
WWW-Mechanize-1.32/perlcriticrc
WWW-Mechanize-1.32/lib/
WWW-Mechanize-1.32/lib/WWW/
WWW-Mechanize-1.32/lib/WWW/Mechanize/
WWW-Mechanize-1.32/lib/WWW/Mechanize/Image.pm
WWW-Mechanize-1.32/lib/WWW/Mechanize/Link.pm
WWW-Mechanize-1.32/lib/WWW/Mechanize/Examples.pod
WWW-Mechanize-1.32/lib/WWW/Mechanize/Cookbook.pod
WWW-Mechanize-1.32/lib/WWW/Mechanize/FAQ.pod
WWW-Mechanize-1.32/lib/WWW/Mechanize.pm
WWW-Mechanize-1.32/etc/
WWW-Mechanize-1.32/etc/www-mechanize-logo.png
WWW-Mechanize-1.32/bin/
WWW-Mechanize-1.32/bin/mech-dump
WWW-Mechanize-1.32/MANIFEST
WWW-Mechanize-1.32/Changes
WWW-Mechanize-1.32/META.yml
WWW-Mechanize-1.32/t/
WWW-Mechanize-1.32/t/find_link_id.t
WWW-Mechanize-1.32/t/upload.html
WWW-Mechanize-1.32/t/image-new.t
WWW-Mechanize-1.32/t/autocheck.t
WWW-Mechanize-1.32/t/upload.t
WWW-Mechanize-1.32/t/00-load.t
WWW-Mechanize-1.32/t/clone.t
WWW-Mechanize-1.32/t/image-parse.html
WWW-Mechanize-1.32/t/regex-error.t
WWW-Mechanize-1.32/t/pod-coverage.t
WWW-Mechanize-1.32/t/find_inputs.t
WWW-Mechanize-1.32/t/warnings.t
WWW-Mechanize-1.32/t/find_image.t
WWW-Mechanize-1.32/t/find_link.t
WWW-Mechanize-1.32/t/select.t
WWW-Mechanize-1.32/t/new.t
WWW-Mechanize-1.32/t/image-parse.t
WWW-Mechanize-1.32/t/save_content.t
WWW-Mechanize-1.32/t/link-relative.t
WWW-Mechanize-1.32/t/live/
WWW-Mechanize-1.32/t/live/computers4sure.t
WWW-Mechanize-1.32/t/live/wikipedia.t
WWW-Mechanize-1.32/t/field.html
WWW-Mechanize-1.32/t/link.t
WWW-Mechanize-1.32/t/find_link-warnings.t
WWW-Mechanize-1.32/t/tick.t
WWW-Mechanize-1.32/t/find_link.html
WWW-Mechanize-1.32/t/add_header.t
WWW-Mechanize-1.32/t/aliases.t
WWW-Mechanize-1.32/t/link-base.t
WWW-Mechanize-1.32/t/select.html
WWW-Mechanize-1.32/t/frames.html
WWW-Mechanize-1.32/t/google.html
WWW-Mechanize-1.32/t/pod.t
WWW-Mechanize-1.32/t/tick.html
WWW-Mechanize-1.32/t/find_link_id.html
WWW-Mechanize-1.32/t/field.t
WWW-Mechanize-1.32/t/taint.t
WWW-Mechanize-1.32/t/area_link.html
WWW-Mechanize-1.32/t/find_inputs.html
WWW-Mechanize-1.32/t/die.t
WWW-Mechanize-1.32/t/mech-dump/
WWW-Mechanize-1.32/t/mech-dump/mech-dump.t
WWW-Mechanize-1.32/t/frames.t
WWW-Mechanize-1.32/t/warn.t
WWW-Mechanize-1.32/t/local/
WWW-Mechanize-1.32/t/local/referer.t
WWW-Mechanize-1.32/t/local/submit.t
WWW-Mechanize-1.32/t/local/page_stack.t
WWW-Mechanize-1.32/t/local/form.t
WWW-Mechanize-1.32/t/local/click.t
WWW-Mechanize-1.32/t/local/log-server
WWW-Mechanize-1.32/t/local/get.t
WWW-Mechanize-1.32/t/local/follow.t
WWW-Mechanize-1.32/t/local/referer-server
WWW-Mechanize-1.32/t/local/overload.t
WWW-Mechanize-1.32/t/local/reload.t
WWW-Mechanize-1.32/t/local/failure.t
WWW-Mechanize-1.32/t/local/back.t
WWW-Mechanize-1.32/t/local/click_button.t
WWW-Mechanize-1.32/t/local/LocalServer.pm
WWW-Mechanize-1.32/t/area_link.t
WWW-Mechanize-1.32/t/form-parsing.t
WWW-Mechanize-1.32/Makefile.PL
Removing previously used /root/.cpan/build/WWW-Mechanize-1.32

CPAN.pm: Going to build P/PE/PETDANCE/WWW-Mechanize-1.32.tar.gz


WWW::Mechanize likes to have a lot of test modules for some of its
tests.
The following are modules that would be nice to have, but not
required.

Test::Memory::Cycle
Test::Warn
Test::Taint


Checking if your kit is complete...
Looks good
Writing Makefile for WWW::Mechanize
-- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible


----------------------------------------------------------------------------
What did i do wrong?


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

Date: Thu, 29 Nov 2007 10:15:48 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: How to persist and query a hash lookup in memory with Perl ?
Message-Id: <86sl2p10zv.fsf@lifelogs.com>

On Wed, 28 Nov 2007 18:22:34 -0800 (PST) Jack <jack_posemsky@yahoo.com> wrote: 

J> Hi I have a web application that needs to on an adhoc basis query a
J> hash lookup which should be persisted in memory - I have seen this
J> module "Persistent::Memory - A Persistent Class implemented using
J> Memory (RAM)" but I wanted to see if there was a much simpler approach
J> to taking a hash map and making it 'callable' while persisted in
J> memory using standard features not requiring a special Perl module
J> install..

Are you talking about sharing the data between several instances of your
web application, so whichever one handles a request can read or update
data?

Use a database.  There are cases where this is not the right approach,
but it doesn't sound like it in yours.

Ted


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

Date: 29 Nov 2007 17:47:19 GMT
From: xhoster@gmail.com
Subject: Re: How to persist and query a hash lookup in memory with Perl ?
Message-Id: <20071129124721.335$rr@newsreader.com>

jackposemsky@yahoo.com wrote:
> On Nov 28, 6:37 pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> > Jack wrote:
> > > Hi I have a web application that needs to on an adhoc basis query a
> > > hash lookup which should be persisted in memory - I have seen this
> > > module "Persistent::Memory - A Persistent Class implemented using
> > > Memory (RAM)" but I wanted to see if there was a much simpler
> > > approach to taking a hash map and making it 'callable' while
> > > persisted in memory using standard features not requiring a special
> > > Perl module install..
> >
> > > Any thoughts would be appreciated.
> >
> > Why not a tied hash? See e.g. "perldoc DB_File".
>
> Hi and thank you however that looks too complex - just trying to put a
> hash in memory, why is that so hard to do ?  Is there a simpler way ?

If you aren't willing to install modules and you aren't willing to use the
ones that are (often) standard, then I guess the next option would be to
hire someone who is willing to do one of those things.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

Date: Thu, 29 Nov 2007 09:56:18 -0800
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: How to persist and query a hash lookup in memory with Perl ?
Message-Id: <291120070956180943%jimsgibson@gmail.com>

In article
<7c5df670-d214-40c2-b59d-9ba1f5785618@s36g2000prg.googlegroups.com>,
<jackposemsky@yahoo.com> wrote:

> On Nov 28, 6:37 pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> > Jack wrote:
> > > Hi I have a web application that needs to on an adhoc basis query a
> > > hash lookup which should be persisted in memory - I have seen this
> > > module "Persistent::Memory - A Persistent Class implemented using
> > > Memory (RAM)" but I wanted to see if there was a much simpler approach
> > > to taking a hash map and making it 'callable' while persisted in
> > > memory using standard features not requiring a special Perl module
> > > install..
> >
> > > Any thoughts would be appreciated.
> >
> > Why not a tied hash? See e.g. "perldoc DB_File".
> >
> > --
> > Gunnar Hjalmarsson
> > Email:http://www.gunnar.cc/cgi-bin/contact.pl
> 
> Hi and thank you however that looks too complex - just trying to put a
> hash in memory, why is that so hard to do ?  Is there a simpler way ?

Your question is confusing. All Perl variables, including hashes, are
in memory. The trick to achieving "persistence" between execution
instances of your web application is to have the data on a permanent
data store, such as a disk file. Memory variables disappear once your
Perl process terminates. Using a tied hash, per Gunnar's suggestion, is
one way to accomplish this. There are others, such as using the
Storable module to serialize your hash so you can write it to memory.

I have not use Persistent::Memory, but you might want to check out the
Persistent::File  module instead. Both of those modules seem to be part
of the Persistent framework of Perl modules. 

See
<http://search.cpan.org/~dwinters/Persistent-Base-0.52/lib/Persistent.po
d>

-- 
Jim Gibson

 Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------        
                http://www.usenet.com


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

Date: Thu, 29 Nov 2007 01:34:08 -0800 (PST)
From: mike <rallabs@adelphia.net>
Subject: Re: making the keys of a hash from parameters collected from a form
Message-Id: <77709129-47b2-42a3-a131-fcbc069a3034@b15g2000hsa.googlegroups.com>

On Nov 29, 12:23 am, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> mike <rall...@adelphia.net> wrote in news:35f36fbc-c724-4df0-a418-
> 840e48f98...@n20g2000hsh.googlegroups.com:
>
> > Hello everyone:
> > I have the need to prioritize a number of items from a list and then
> > print them out in the order in which they were chosen.  To be more
> > specific, I have a list of 12 items and I would like to have the users
> > indicate which is their first choice, which is their second, etc. up
> > to 8.  I must put the items into a file in the order which has been
> > prioritized by the user.
>
> ...
>
> > print $q->h3(textfield(-name=>'app', -size=>1),"apple");
>
> A textfield in h3? We're straying off-topic here but that is awful HTML.
>
> > my %hashfruit=(
> > "param('app')"=>'app',
> > "param('lem')"=>'lem',
> > "param('ora')"=>'ora',
> > "param('lem')"=>'lem',
> > "param('lim')"=>'lim',
>
> ...
>
> > instead of getting the values (1
> > and 2), I get as keys the strings  'param(app)'
>
> You are specifying the keys as strings in the form "param('app')"
> yourself. That's what you told your program to do. How do you expect
> anything else to happen?
>
> If, instead, you had used
>
> my %hashfruit=(
>   param('app') =>'app',
>   param('lem') =>'lem',
>   param('ora') =>'ora',
>   param('lem') =>'lem',
>   param('lim') =>'lim',
> );
>
> the results of the param calls would be stringified.
>
> Of course, you are not performing any sanity checks on the inputs so
> this has the potential of becoming problematic. By giving each textfield
> a different name, you are making life unnecessarily hard.
>
> Instead, use the same name, say 'rank', for all the textfields. That
> way, things like checking that all the ranks are distinct, all the ranks
> are numbers etc becomes a much easier operation and you don't have to
> make a whole bunch of changes every time you change the list of fruits.
>
> As your scripts are too messy to modify, here is an alternative:
>
> #!perl
>
> use strict;
> use warnings;
>
> use CGI qw( -no_xhtml );
>
> my @FRUITS = qw( apple orange lemon lime banana );
>
> my $cgi = CGI->new;
> print $cgi->header( 'text/html' );
>
> unless ( $cgi->param ) {
>     show_form( $cgi );}
>
> else {
>     process_form( $cgi );
>
> }
>
> sub show_form {
>     my $cgi = shift;
>     my ( $msg ) = @_;
>
>     print $cgi->start_html;
>
>     if ( $msg ) {
>         print $cgi->p( $cgi->em( $msg ) );
>     }
>
>     print $cgi->start_form( -method => 'GET' );
>
>     for my $fruit ( @FRUITS ) {
>         print $cgi->p(
>             $cgi->textfield( -name => 'rank', -size => 1 ), $fruit
>         );
>     }
>
>     print $cgi->p( $cgi->submit, $cgi->reset ),
>           $cgi->end_form,
>           $cgi->end_html;
>     return;
>
> }
>
> sub process_form {
>     my $cgi = shift;
>     my @ranks = $cgi->param( 'rank' );
>
>     for my $rank ( @ranks ) {
>         $rank =~ s/^\s+//;
>         $rank =~ s/\s+$//;
>
>         unless ( $rank =~ /^(\d+)$/
>                 and $rank => 1
>                 and $rank <= @FRUITS
>         ) {
>             return show_form(
>                 $cgi,
>                 sprintf(
>                     'Ranks must be integers between %d and %d.',
>                     1, scalar @FRUITS
>                 )
>             );
>         }
>     }
>
>     my %ranked;
>     @ranked{ @ranks } = @FRUITS;
>
>     unless ( keys %ranked == @FRUITS ) {
>         return show_form(
>             $cgi,
>             'Please fill in all spaces with distinct ranks.'
>         );
>     }
>
>     print $cgi->start_html,
>           $cgi->ol(
>               $cgi->li(
>                   [ map { $ranked{ $_ } } sort keys %ranked ]
>               )
>           ),
>           $cgi->end_html;
>     return;
>
> }
>
> __END__
>
> --
> A. Sinan Unur <1...@llenroc.ude.invalid>
> (remove .invalid and reverse each component for email address)
> clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>

Dr. A. Sinan Unur: Thank you very much for both these approaches and
their explanations.  This may have been too elementary a question for
this newsgroup, but I got a lot of bad advice from the beginners'
group.  Thanks again.


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

Date: Thu, 29 Nov 2007 11:37:29 GMT
From: "John W. Krahn" <krahnj@telus.net>
Subject: Re: making the keys of a hash from parameters collected from a form
Message-Id: <474EA457.7013DEC4@telus.net>

mike wrote:
> 
> Dr. A. Sinan Unur: Thank you very much for both these approaches and
> their explanations.  This may have been too elementary a question for
> this newsgroup, but I got a lot of bad advice from the beginners'
> group.  Thanks again.

Its a *beginners* mailing list, what did you expect?  Maybe you should
have asked on the beginners-cgi mailing list instead?


John
-- 
use Perl;
program
fulfillment


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

Date: Thu, 29 Nov 2007 11:58:19 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: making the keys of a hash from parameters collected from a form
Message-Id: <Xns99F746EB11098asu1cornelledu@127.0.0.1>

mike <rallabs@adelphia.net> wrote in news:77709129-47b2-42a3-a131-
fcbc069a3034@b15g2000hsa.googlegroups.com:

 
> Dr. A. Sinan Unur: Thank you very much for both these approaches and
> their explanations.  This may have been too elementary a question for
> this newsgroup, but I got a lot of bad advice from the beginners'
> group.  Thanks again.

You are welcome. Just a couple of points: First, I appreciate your polite 
gesture, but in this group, I am simply Sinan. Second, and more 
pertinently, I generally don't use the HTML generation methods provided by 
CGI.pm. I would recommend you to look at some of the excellent templating 
modules on CPAN (I stick with HTML::Template but there are others) so as 
for neater separation between code and presentation. Finally, do read the 
posting guidelines for this group, if you read and follow them, you will 
find that asking questions (and getting answers) in this group is a much 
more rewarding experience than you can get on any beginners list.

Good luck.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>



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

Date: Thu, 29 Nov 2007 13:12:39 -0000
From: Justin C <justin.0711@purestblue.com>
Subject: PDF::Reuse & UK currency 'pound' symbol
Message-Id: <5640.474ebac7.3cfd9@zem>

I'm trying to print a 'pound' symbol (the UK currency, not a # or
anything else that may get called pound) to a PDF document in
PDF::Reuse. I've a string containing the symbol in a variable, and am
printing it thus:
$txt = "The cash value is £";  # not sure how that'll appear on usenet
prText($x, $y, $txt) ;

The output I'm seeing is a capitalised A with a caret followed by the
pound symbol. I'm not sure how to proceed. Looking at UTF8, I can find
the code for the character I want, but, looking at documentation for the
utf8 module I see: "Do not use this pragma for anything else than
telling Perl that your script is written in UTF-8" ... which it isn't, I
just want to print one symbol.

Any suggestions how I might move forward with this? Thank you for any
help you can give.

	Justin.
-- 
Justin C, by the sea.


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

Date: Thu, 29 Nov 2007 15:43:22 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: PDF::Reuse & UK currency 'pound' symbol
Message-Id: <q93325-69c.ln1@osiris.mauzo.dyndns.org>


Quoth justin.news@purestblue.com:
> I'm trying to print a 'pound' symbol (the UK currency, not a # or
> anything else that may get called pound) to a PDF document in
> PDF::Reuse. I've a string containing the symbol in a variable, and am
> printing it thus:
> $txt = "The cash value is £";  # not sure how that'll appear on usenet
> prText($x, $y, $txt) ;
> 
> The output I'm seeing is a capitalised A with a caret followed by the
> pound symbol. I'm not sure how to proceed. Looking at UTF8, I can find
> the code for the character I want, but, looking at documentation for the
> utf8 module I see: "Do not use this pragma for anything else than
> telling Perl that your script is written in UTF-8" ... which it isn't, I
> just want to print one symbol.

Actually, it probably is. If you have a literal £ as you wrote it up
there, then your document is in UTF8.

You should probably use the encoding pragma rather than the utf8 pragma:
it's more robust on bad input.

> Any suggestions how I might move forward with this? Thank you for any
> help you can give.

I strongly suspect this won't help, though :(. prText simply inserts the
text into the PDF as a PDF text literal, and I don't think PDF
understands literals in UTF8. You need to locate the £ character in
whatever font you are using and arrange to output that character
instead; simply converting your (now) Unicode perl string into an
ISO8859-1 byte string using Encode::encode may be sufficient, if you're
lucky.

Ben



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

Date: Thu, 29 Nov 2007 08:10:26 -0800 (PST)
From: schmmichael@gmail.com
Subject: Re: perl ftp and hidden partitions
Message-Id: <1a5e5d6f-be67-4a57-b551-0ddcd9b8433e@a39g2000pre.googlegroups.com>

On 26 Nov., 18:06, Sherman Pendley <spamt...@dot-app.org> wrote:
> schmmich...@gmail.com writes:
> > Hi all
>
> > I have an automation problem with perl and a ftp server.
> > The server is running on a B&R-SPS. This contains a flash memory (2GB)
> > for data logging.
> > The files will be on a hidden partition called "F".
>
> > I tried to log in on different ways:
> > e.g.:
>
> > my $ftp=Net::FTP->new($host,Port => 21, Debug => 1, Passive => 1) or
> > die "Couldn't connect: $@\n";
> > print "Connected\n";
>
> > $ftp->login('br','br',"/F:/")      or die $ftp->message;
>
> That third argument looks odd - the Net::FTP docs call it "ACCOUNT," which
> implies that it will (if provided) cause the client to issue the FTP command
> of the same name, which has nothing to do with establishing a working dir
> for the session.
>
> You can see the description of the ACCOUNT command here:
>
>     <http://www.faqs.org/rfcs/rfc959.html>
>
> Have you tried logging in without the third param, and then using the cwd()
> method to change to the drive & directory you want? Something like this:
>
>     $ftp->login('br','br') or die $ftp->message;
>     $ftp->cwd('/F:/')      or die $ftp->message;
>
> sherm--
>
> --
> WV News, Blogging, and Discussion:http://wv-www.com
> Cocoa programming in Perl:http://camelbones.sourceforge.net- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

Thank for all this tips.
I figured out that
$ftp->login('br','br') or die $ftp->message;
$ftp->cwd('/F:/')  or die $ftp->message;

works, but not each time. So I think the error is not in my perl code!

I will check the ftp-server and some application code on the sps

thanks again to all the people answerd my question

Michael


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

Date: Thu, 29 Nov 2007 04:11:21 -0700
From: "Gerry Ford" <invalid@invalid.net>
Subject: Re: retrieving news messages
Message-Id: <1196334206_815@sp12lax.superfeed.net>


"David Harmon" <source@netcom.com> wrote in message 
news:13ksp20d0m9g2c5@corp.supernews.com...
> On Thu, 05 Jul 2007 12:25:20 -0700 in comp.lang.perl.misc, Joe Smith
> <joe@inwap.com> wrote,
>>   my $nntp = Net::NNTP->new('newsgroups.comcast.net', { Debug => 1} );
>>   die "Unable to create NNTP object" unless $nntp;
>>
>>You have got to get those two statements working before proceeding
>>any further.
>
> It appears to me, that style of passing arguments to Net::NNTP->new
> cannot work.  I see this code in Net/NNTP.pm:
>
> sub new
> {
> my $self = shift;
> my $type = ref($self) || $self;
> my ($host,%arg);
> if (@_ % 2) {
>   $host = shift ;
>   %arg  = @_;
> } else {
>   %arg = @_;
>   $host=delete $arg{Host};
> }
>
>
> The above looks wrong to me; I think it ought to be more like
>
> if (not (@_ % 2)) {
>
> However, I'm still something of a Perl newbie, and am not quite sure
> of all that I am looking at here.  It appears that the constructor
> fails to pick up the Host argument, but then it goes on to look for
> the NNTPSERVER environment variable and use that, as documented.
> I guess that everyone who got it to work had some such luck.
>
> What do you all think?
Dude, they're dissing you.

Your constructor fails.  They know why, and apparently, you don't.
-- 
Gerry Ford 




----== Posted via Newsgroups.com - Usenet Access to over 100,000 Newsgroups ==----
Get Anonymous, Uncensored, Access to West and East Coast Server Farms at! 
----== Highest Retention and Completion Rates! HTTP://WWW.NEWSGROUPS.COM ==----


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

Date: Thu, 29 Nov 2007 12:16:22 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: retrieving news messages
Message-Id: <slrnfktept.guo.tadmc@tadmc30.sbcglobal.net>

David Harmon <source@netcom.com> wrote:
> On Thu, 05 Jul 2007 12:25:20 -0700 in comp.lang.perl.misc, Joe Smith
><joe@inwap.com> wrote,
>>   my $nntp = Net::NNTP->new('newsgroups.comcast.net', { Debug => 1} );
>>   die "Unable to create NNTP object" unless $nntp;
>>
>>You have got to get those two statements working before proceeding
>>any further.
>
> It appears to me, that style of passing arguments to Net::NNTP->new
> cannot work.  


That is correct.

You are not calling it correctly.

The OPTIONS are "hash like", but you are passing a hash reference instead.


> I see this code in Net/NNTP.pm:
>
> sub new
> {
>  my $self = shift;
>  my $type = ref($self) || $self;
>  my ($host,%arg);
>  if (@_ % 2) {
>    $host = shift ;
>    %arg  = @_;
>  } else {
>    %arg = @_;
>    $host=delete $arg{Host};
>  }
>
>
> The above looks wrong to me; I think it ought to be more like
>
>  if (not (@_ % 2)) {


If that were right, then it ought to be the original condition
but with the if and else blocks swapped. 

The if block will be evaluated if there are an odd number of arguments, 
the else block will be evaluated if there are an even number of args.

> However, I'm still something of a Perl newbie, and am not quite sure
> of all that I am looking at here.  It appears that the constructor
> fails to pick up the Host argument, but then it goes on to look for
> the NNTPSERVER environment variable and use that, as documented.  
> I guess that everyone who got it to work had some such luck.
>
> What do you all think?


You are calling new() with an even number of arguments (two), a
string and a hash reference.

Fix your call by passing an odd number of arguments instead
by losing the curlies:

   my $nntp = Net::NNTP->new('newsgroups.comcast.net', Debug => 1 );


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Thu, 29 Nov 2007 12:18:42 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: retrieving news messages
Message-Id: <Xns99F74A5FCBC3Easu1cornelledu@127.0.0.1>

David Harmon <source@netcom.com> wrote in
news:13ksp20d0m9g2c5@corp.supernews.com: 

> On Thu, 05 Jul 2007 12:25:20 -0700 in comp.lang.perl.misc, Joe Smith
> <joe@inwap.com> wrote,
>>   my $nntp = Net::NNTP->new('newsgroups.comcast.net', { Debug => 1}
>>   ); die "Unable to create NNTP object" unless $nntp;

 ...

> 
> It appears to me, that style of passing arguments to Net::NNTP->new
> cannot work.  I see this code in Net/NNTP.pm:
> 
> sub new
> {
>  my $self = shift;
>  my $type = ref($self) || $self;
>  my ($host,%arg);
>  if (@_ % 2) {
>    $host = shift ;
>    %arg  = @_;
>  } else {
>    %arg = @_;
>    $host=delete $arg{Host};
>  }
> 
> 
> The above looks wrong to me; I think it ought to be more like
> 
>  if (not (@_ % 2)) {
> 

I know nothing about Net::NNTP, however, you are wrong here:


sub new
{
 my $self = shift;

# $self now contains the class name or the 
# object reference on which new was called.
# The argument list is shortened by one element.

 my $type = ref($self) || $self;

 my ($host,%arg);
 if (@_ % 2) {
   $host = shift ;
   %arg  = @_;

# if the argument list now contains an odd number
# of elements, shift the first one in to $host.
# After that, there would be an even number of 
# arguments left. Use them as key => value pairs
# to form an arguments hash.


 } else {
   %arg = @_;
   $host=delete $arg{Host};

# If there are an even number of arguments to begin with,
# interpret them as key => value pairs to from the 
# arguments hash. Then, put the 'Host' argument in
# $host, at the same time removing it from %arg so that
# subsequent code does not need special cases.

 }

At this point, I do not know who posted the original code, but look at 
it:

my $nntp = Net::NNTP->new('newsgroups.comcast.net', { Debug => 1} );

The constructor is wrong. You can see that by realizing that the code 
above would produce 

%args = ( 'newsgroups.comcast.net' => { Debug => 1} );

from that constructor. Either of the following would work:

my $nntp = Net::NNTP->new('newsgroups.comcast.net', Debug => 1 );

or

my $nntp = Net::NNTP->new(
   Host => 'newsgroups.comcast.net', 
   Debug => 1,
);

The documentation for Net::NNTP states:

"OPTIONS are passed in a hash like fashion, using key and value pairs."

> I guess that everyone who got it to work had some such luck.

No, they read the documentation.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>



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

Date: Thu, 29 Nov 2007 12:45:56 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: SvUOK always fails on 64bit platform
Message-Id: <4to225-gr1.ln1@osiris.mauzo.dyndns.org>


Quoth cyl <u8526505@gmail.com>:
> On ?????, Ben Morrow <b...@morrow.me.uk> wrote:
> > Quoth cyl <u8526...@gmail.com>:
> > > 0 - 0x7fffffff                            false
> > > 0x80000000 - 0xffffffff             true
> >
> > 0x7fffffff here is the largest value that fits into a 32bit IV.
> >
> > > 64bit
> > > (in perl)                                (SvUOKreturn value)
> > > 0-0xffffffff                               false
> >
> > 0xffffffff easily fits into a 64bit IV, so that's what perl uses. If you
> 
> I thought 0xffffffff should be the max value of unsigned integer on
> either 32 bit or 64 bit platform. Is this correct?

Yes, 0xffffffff is 2**32-1, and the largest unsigned 32bit value.
0x7fffffff is the largest *signed* 32bit value, and perl always prefers
to store things signed when it can. When a value fits into a signed
integer, it's stored as an IV and SvUOK is false.

The largest unsigned 64bit integer is 0xffffffffffffffff (that's 16 fs),
and the largest signed half that, 0x7fffffffffffffff. On a perl with
64bit IVs, any value less than this will be stored as an IV, and will
not be SvUOK.

> Actually the
> problem comes from the SWIG (http://www.swig.org) implementation. I
> post the generated code below.
> 
> On 64bit platform,

Stop right there :). Do you mean a platform with 64bit ints, or a perl
with 64bit IVs? They are not equivalent: my perl here, for instance, is
configured for i386-freebsd-64int, so I have 64bit IVs even though my
ints are only 32bit. perl will use long long for IVs if you ask it to.

> when I pass values larger than 0x7fffffff to
> TestInt, the function SWIG_AsVal_unsigned_SS_long at the bottom will
> be called with parameter ST(0). Since SvUOK returns false,

Because the value fits into an IV.

> SvIV is used to convert the value.

*And then you cast it to (signed) long*, which is shorter than IV.
(Presumably you're running this on a 32bit platform with a 64bit perl:
you didn't say, but that's the only situation that fits.) Make the
temporary an IV, or, since you're checking SvIOK anyway, just use
SvIVX(obj) directly.

Why are you doing any of this? If you want to coerce a SV to an UV,
that's what SvUV does for you, including converting from a string or
float if necessary. I would have said the whole function would be better
written

    UV uv = SvUV(obj);
    *val  = (unsigned long) uv;

    if (*val != uv)
        return SWIG_OverflowError;

    return SWIG_OK;

if indeed you need that much error checking. Why aren't you just using
the typemap entry for unsigned long? That's what it's there for.

> In this case, values latger than
> 0x7fffffff become negative and an OverflowError is thrown. I'm
> wondering what changes should I make to correct this problem. Will
> there be any problem if I call SvUV directly without any type check?

No. SvUV is a coercion function. SvUVX is direct access to the 'UV' slot
of the SV (SVs don't really have an UV slot, but the IV slot sometimes
holds an UV instead), and using that without checking *is* dangerous.
Have you checked perlapi?

<snip>
> SWIGINTERN int
> SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned
> long *val)
> {
>   if (SvUOK(obj)) {
>     if (val) *val = SvUV(obj);
>     return SWIG_OK;
>   } else  if (SvIOK(obj)) {
>     long v = SvIV(obj);
>     if (v >= 0) {
>       if (val) *val = v;
>       return SWIG_OK;
>     } else {
>       return SWIG_OverflowError;
>     }
>   } else {

You really didn't need to post more code than this. It illustrates the
whole of your problem.

Ben



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

Date: Thu, 29 Nov 2007 10:25:24 -0800 (PST)
From: devphylosoff <devphyl@gmail.com>
Subject: what "shift" does, if not "$_ = shift;" ?
Message-Id: <3474359c-3bbe-400d-aa9d-ef42110dc20d@d21g2000prf.googlegroups.com>

hey

the first line in one of my subroutine is
shift;

but in this case i cannot use $_ and think $_ = shift;
why ?

entire code:

my @gilligan  = qw(a b c d e);
my @skipper   = qw(1 2 3 4 5);
my @professor = qw(I II III IV V);
my %all = (
  Gilligan  => \@gilligan,
  Skipper   => \@skipper,
  Professor => \@professor,
);

sub check_items_for_all {
        # $_ = shift;   # try this
        shift;
        for $key (keys %$_) {
                check_required_items($key, $_->{$key});
        }
}

sub check_required_items {
        my $who   = shift;
        my $items = shift;

        my @required = qw(1 2 3 I II III a b c d V);
        my @missing = (  );

        for my $item (@required) {
        unless (grep $item eq $_, @$items) { # not found in list?
        print "$who is missing $item.\n";
        push @missing, $item;
        }
        }

        if (@missing) {
        print "Adding @missing to @$items for $who.\n";
        push @$items, @missing;
        }
}


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

Date: Thu, 29 Nov 2007 18:35:00 +0000
From: Peter Makholm <peter@makholm.net>
Subject: Re: what "shift" does, if not "$_ = shift;" ?
Message-Id: <87myswgasr.fsf@hacking.dk>

devphylosoff <devphyl@gmail.com> writes:

> the first line in one of my subroutine is
> shift;

This will just discard the first argument from @_. Not really usefull
in you functions as you don't use @_ later on.

> but in this case i cannot use $_ and think $_ = shift;
> why ?

If you think that 'shift' in void context is equal to '$_ = shift'
then you thinking is wrong. Why you think that I'm not able to tell,
the documentation for the shift function doesn't seem to imply this.

The documentation says that shift works on the @_ array if the
argument to shift is omitted. But it doesn't say anything about shift
doing other special things.


> entire code:

If this is you entire code, then I have no idea what you expect. You
define some variables and two functions, but use neiter.

//Makholm


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

Date: Thu, 29 Nov 2007 10:39:12 -0800 (PST)
From: devphylosoff <devphyl@gmail.com>
Subject: Re: what "shift" does, if not "$_ = shift;" ?
Message-Id: <63df1452-cbcb-45cf-b139-ffed2a5e7b0c@s36g2000prg.googlegroups.com>

sorry, I lose

print map {" @{$_} \n"} values %all;
check_items_for_all(\%all);
print map {" @{$_} \n"} values %all;

in my pasted code


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

Date: Thu, 29 Nov 2007 12:16:22 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: writing to a notepad in perl
Message-Id: <slrnfkte17.guo.tadmc@tadmc30.sbcglobal.net>

rajendra <rajendra.prasad@in.bosch.com> wrote:


> open(f,">test.txt");


You should use uppercase filehandles.

You should always, yes *always*, check the return value from open():

   open F, '>test.txt' or die "could not open 'test.txt'  $!";

Even better, use lexical filehandles and the 3-arg form of open:

   open my $F, '>', 'test.txt' or die "could not open 'test.txt'  $!";


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

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 V11 Issue 1080
***************************************


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