[31084] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2329 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 10 03:09:43 2009

Date: Fri, 10 Apr 2009 00:09:05 -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           Fri, 10 Apr 2009     Volume: 11 Number: 2329

Today's topics:
    Re: Modification of a hash-by-reference parameter in a  <CoDeReBeL@live.com>
    Re: Modification of a hash-by-reference parameter in a  <tadmc@seesig.invalid>
    Re: Modification of a hash-by-reference parameter in a  <uri@stemsystems.com>
        new CPAN modules on Fri Apr 10 2009 (Randal Schwartz)
    Re: Pipe Between Programs <tadmc@seesig.invalid>
    Re: Pipe Between Programs <tadmc@seesig.invalid>
    Re: Pipe Between Programs <thegist@nospam.net>
    Re: XML::LibXML UTF-8 toString() -vs- nodeValue() <hjp-usenet2@hjp.at>
    Re: XML::LibXML UTF-8 toString() -vs- nodeValue() <benkasminbullock@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 9 Apr 2009 15:05:24 -0700 (PDT)
From: CoDeReBeL <CoDeReBeL@live.com>
Subject: Re: Modification of a hash-by-reference parameter in a recursive sub
Message-Id: <4ab0b18b-cecb-490e-97aa-f7c7511aced5@z9g2000yqi.googlegroups.com>

OK, I finally got it to work. Thanks for your help, all. I took your
advice about most everything except the regular expressions. I'm sure
they can be made a lot better but I wasn't going to start playing with
them until I actually had the program running. Here is the latest
version, in case anyone is interested and just in case someone has a
similar problem some day they might find this...

use strict;
use warnings;
use diagnostics;
use HTML::TreeBuilder;
use HTML::Element;
use Scalar::Util ;

sub traverse ;
sub curly_quotes ($) ;
sub go_ahead ($) ;

foreach my $file_name (@ARGV) {
  my $tree = HTML::TreeBuilder->new ;
  $tree->parse_file($file_name);
  print "\n\nWhere would you like to put the output file for
$file_name? " ;
  my $output = <STDIN> ;
  open OUTPUT_FILE, "> $output" or die $! ;
  traverse ($tree->find('body')) ;
  print OUTPUT_FILE $tree->as_HTML ("","  ",{}) ;
  $tree = $tree->delete ;
  close OUTPUT_FILE or die $!;
}

sub traverse {
  for my $element (@_) {
    if (Scalar::Util::blessed ($element)) {
      if (go_ahead($element)) {
        my @contents = $element->content_list() ;
        print "Before: ", @contents, "\n\n" ;
        traverse(@contents) ;
        print "After: ", @contents, "\n\n" ;
        $element->detach_content() ;
        $element->push_content (@contents) ;
      }
    }
    else {
      print "Processing a string: " ;
      $element = curly_quotes($element) ;
      print $element, "\n\n" ;
    }
  }
}

sub curly_quotes ($) {
  my $s = $_[0] ;
  $s =~ s/\s&\s/ &amp; /g ;
  $s =~ s/</&lt;/g ;
  $s =~ s/>/&gt;/g ;
  $s =~ s/'em\s/&rsquo;em /g ;
  $s =~ s/'tis\s/&rsquo;tis /g ;
  $s =~ s/'twas\s/&rsquo;twas /g ;
  $s =~ s/'Twas\s/&rsquo;Twas /g ;
  $s =~ s/'Tis\s/&rsquo;Tis / ;
  $s =~ s/'\s/&rsquo; /g ;
  $s =~ s/^'/&lsquo;/g ;
  $s =~ s/(\s)'/$1&lsquo;/g ;
  $s =~ s/"'/&ldquo;lsquo;/g ;
  $s =~ s/'"/&rsquo;&rdquo;/g ;
  $s =~ s/\s"/ &ldquo;/g ;
  $s =~ s/^'/&lsquo;/g ;
  $s =~ s/^"/&ldquo;/g ;
  $s =~ s/"\s/&rdquo; /g ;
  $s =~ s/'$/&rsquo;/g ;
  $s =~ s/"$/&rdquo;/g ;
  $s =~ s/(,|\.)'/$1&rsquo;/g ;
  $s =~ s/(,|\.)"/$1&rdquo;/g ;
  $s =~ s/(\S)'(\S)/$1&rsquo;$2/g ;
  return $s ;
}

sub go_ahead ($) {
  my $element = $_[0] ;
  my $s = $element->tag() ;
  my %tags = (
    head => "head",
    script => "script",
    img => "img",
    object => "object",
    applet => "applet",
    pre => "pre"
  ) ;
  return !(exists $tags{$s}) ;
}

Thanks again!



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

Date: Thu, 9 Apr 2009 19:01:08 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Modification of a hash-by-reference parameter in a recursive sub
Message-Id: <slrngtt324.7rp.tadmc@tadmc30.sbcglobal.net>

CoDeReBeL <CoDeReBeL@live.com> wrote:


> sub traverse ;
> sub curly_quotes ($) ;
> sub go_ahead ($) ;


Why do you include those 3 lines?

What do you think they are doing for you?

What happens if you delete them and then test your program?

If you don't know why those lines are there, then those lines
should not be there. Delete them, they do nothing for you.


> foreach my $file_name (@ARGV) {
>   my $tree = HTML::TreeBuilder->new ;
>   $tree->parse_file($file_name);
>   print "\n\nWhere would you like to put the output file for
> $file_name? " ;
>   my $output = <STDIN> ;


    chomp $output;


>   open OUTPUT_FILE, "> $output" or die $! ;


You should use the 3-arg form of open() with a lexical filehandle:

    open my $OUTPUT_FILE, '>', $output or die "could not open '$output' $!";


>   traverse ($tree->find('body')) ;
>   print OUTPUT_FILE $tree->as_HTML ("","  ",{}) ;


    print $OUTPUT_FILE $tree->as_HTML ("","  ",{}) ;


>   $tree = $tree->delete ;
>   close OUTPUT_FILE or die $!;

     close $OUTPUT_FILE or die $!;

> }
>
> sub traverse {
>   for my $element (@_) {
>     if (Scalar::Util::blessed ($element)) {
>       if (go_ahead($element)) {


You can combine those 2 "if"s and do without go_ahead():

    if (Scalar::Util::blessed ($element) and 
        $element->tag() !~ /^(head|script|img|object|applet|pre)$/ ) {


>         my @contents = $element->content_list() ;
>         print "Before: ", @contents, "\n\n" ;
>         traverse(@contents) ;
>         print "After: ", @contents, "\n\n" ;
>         $element->detach_content() ;
>         $element->push_content (@contents) ;
>       }
>     }
>     else {
>       print "Processing a string: " ;
>       $element = curly_quotes($element) ;
>       print $element, "\n\n" ;


You can combine those last 2 lines:

        print curly_quotes($element), "\n\n" ;


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


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

Date: Thu, 09 Apr 2009 19:53:52 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Modification of a hash-by-reference parameter in a recursive sub
Message-Id: <x7d4bl2xkf.fsf@mail.sysarch.com>

>>>>> "C" == CoDeReBeL  <CoDeReBeL@live.com> writes:

  C> sub traverse ;
  C> sub curly_quotes ($) ;
  C> sub go_ahead ($) ;

no need to predeclare subs in perl. and using prototypes is mostly
useless and doesn't really do what you think it does. so drop those
lines and all the prototypes you have below.

  C> foreach my $file_name (@ARGV) {
  C>   my $tree = HTML::TreeBuilder->new ;
  C>   $tree->parse_file($file_name);
  C>   print "\n\nWhere would you like to put the output file for
  C> $file_name? " ;
  C>   my $output = <STDIN> ;
  C>   open OUTPUT_FILE, "> $output" or die $! ;

you don't chomp the filename. it could cause odd issues with the open.
and use lexical file handles, not barewords. 

  C>   traverse ($tree->find('body')) ;
  C>   print OUTPUT_FILE $tree->as_HTML ("","  ",{}) ;
  C>   $tree = $tree->delete ;

no need to delete the tree as it will go out of scope here.

  C>   close OUTPUT_FILE or die $!;

same if you used a lexical handle. and close is rarely checked as it has
maybe one fault possible on a plain file (filesystem full).

  C> }
  C>     if (Scalar::Util::blessed ($element)) {

import blessed from that module and you won't need to use the full path
to it.

  C> sub curly_quotes ($) {
  C>   my $s = $_[0] ;

	my( $s ) = @_ ;

that is a better style. never use $_[] unless there is a special reason
(and there are a few)

  C> sub go_ahead ($) {
  C>   my $element = $_[0] ;
  C>   my $s = $element->tag() ;
  C>   my %tags = (
  C>     head => "head",
  C>     script => "script",
  C>     img => "img",
  C>     object => "object",
  C>     applet => "applet",
  C>     pre => "pre"

you assign this hash EACH time the sub is called even though the hash is
constant. assign it once in a file level lexical at the top and it will
be reused each time in this sub.

and STOP using single letter variable names. that is your worst
offense. you may think you know this stuff but it is not proper in any
language. you are writing code to be read by humans, not computers and
OTHER humans, not yourself.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Fri, 10 Apr 2009 04:42:26 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Fri Apr 10 2009
Message-Id: <KHvBqq.1F91@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Algorithm-Graphs-TransitiveClosure-2009040901
http://search.cpan.org/~abigail/Algorithm-Graphs-TransitiveClosure-2009040901/
Calculate the transitive closure. 
----
Any-Moose-0.07
http://search.cpan.org/~flora/Any-Moose-0.07/
use Moose or Mouse modules 
----
App-Munchies-0.1.657
http://search.cpan.org/~pjfl/App-Munchies-0.1.657/
Catalyst example application using food recipes as a data set 
----
Astro-SIMBAD-Client-0.018
http://search.cpan.org/~wyant/Astro-SIMBAD-Client-0.018/
Fetch astronomical data from SIMBAD 4. 
----
CPAN-Mini-Growl-0.01
http://search.cpan.org/~miyagawa/CPAN-Mini-Growl-0.01/
Growls updates from CPAN::Mini 
----
CPAN-MirrorStatus-0.02_01
http://search.cpan.org/~shelling/CPAN-MirrorStatus-0.02_01/
query mirrors status from mirrors.cpan.org 
----
Catalyst-App-RoleApplicator-0.001
http://search.cpan.org/~hdp/Catalyst-App-RoleApplicator-0.001/
apply roles to your Catalyst application-related classes 
----
Catalyst-Controller-ActionRole-0.09
http://search.cpan.org/~flora/Catalyst-Controller-ActionRole-0.09/
Apply roles to action instances 
----
Catalyst-Controller-ActionRole-0.10
http://search.cpan.org/~flora/Catalyst-Controller-ActionRole-0.10/
Apply roles to action instances 
----
Catalyst-Plugin-AutoCRUD-0.42
http://search.cpan.org/~oliver/Catalyst-Plugin-AutoCRUD-0.42/
Instant AJAX web front-end for DBIx::Class 
----
Catalyst-Plugin-AutoCRUD-0.43
http://search.cpan.org/~oliver/Catalyst-Plugin-AutoCRUD-0.43/
Instant AJAX web front-end for DBIx::Class 
----
Catalyst-Plugin-AutoCRUD-0.44
http://search.cpan.org/~oliver/Catalyst-Plugin-AutoCRUD-0.44/
Instant AJAX web front-end for DBIx::Class 
----
Catalyst-Plugin-Log4perl-Simple-0.001
http://search.cpan.org/~mooli/Catalyst-Plugin-Log4perl-Simple-0.001/
Simple Log4perl setup for Catalyst application 
----
CatalystX-ListFramework-Builder-0.42
http://search.cpan.org/~oliver/CatalystX-ListFramework-Builder-0.42/
*** DEPRECATED *** please see Catalyst::Plugin::AutoCRUD 
----
CatalystX-REPL-0.03
http://search.cpan.org/~flora/CatalystX-REPL-0.03/
read-eval-print-loop for debugging your Catalyst application 
----
CatalystX-RelatedClassRoles-0.001
http://search.cpan.org/~hdp/CatalystX-RelatedClassRoles-0.001/
apply roles to your Catalyst application-related classes 
----
CatalystX-Usul-0.1.443
http://search.cpan.org/~pjfl/CatalystX-Usul-0.1.443/
A base class for Catalyst MVC components 
----
DBD-SQLite-1.22_03
http://search.cpan.org/~adamk/DBD-SQLite-1.22_03/
Self Contained RDBMS in a DBI Driver 
----
DateTime-Format-Natural-0.76
http://search.cpan.org/~schubiger/DateTime-Format-Natural-0.76/
Create machine readable date/time with natural parsing logic 
----
DateTimeX-Format-1.00
http://search.cpan.org/~ecarroll/DateTimeX-Format-1.00/
Moose Roles for building next generation DateTime formats 
----
Devel-Declare-0.004000
http://search.cpan.org/~flora/Devel-Declare-0.004000/
Adding keywords to perl, in perl 
----
Devel-REPL-1.003005
http://search.cpan.org/~oliver/Devel-REPL-1.003005/
a modern perl interactive shell 
----
EAFDSS-0.60
http://search.cpan.org/~hasiotis/EAFDSS-0.60/
Electronic Fiscal Signature Devices Library 
----
Email-MIME-Kit-Assembler-TextifyHTML-1.001
http://search.cpan.org/~rjbs/Email-MIME-Kit-Assembler-TextifyHTML-1.001/
textify some HTML arguments to assembly 
----
Geography-Countries-2009040901
http://search.cpan.org/~abigail/Geography-Countries-2009040901/
2-letter, 3-letter, and numerical codes for countries. 
----
Geography-States-2009040901
http://search.cpan.org/~abigail/Geography-States-2009040901/
Map states and provinces to their codes, and vica versa. 
----
Gravatar-URL-1.01
http://search.cpan.org/~mschwern/Gravatar-URL-1.01/
Make URLs for Gravatars from an email address 
----
HTML-FormWidgets-0.4.156
http://search.cpan.org/~pjfl/HTML-FormWidgets-0.4.156/
Create HTML form markup 
----
HTML-TurboForm-0.37
http://search.cpan.org/~camelcase/HTML-TurboForm-0.37/
----
HTML-TurboForm-0.38
http://search.cpan.org/~camelcase/HTML-TurboForm-0.38/
----
Hash-Merge-0.11
http://search.cpan.org/~dmuey/Hash-Merge-0.11/
Merges arbitrarily deep hashes into a single hash 
----
Jaipo-0.20
http://search.cpan.org/~cornelius/Jaipo-0.20/
Micro-blogging Client 
----
Jifty-0.90409
http://search.cpan.org/~alexmv/Jifty-0.90409/
an application framework 
----
KinoSearch-0.165
http://search.cpan.org/~creamyg/KinoSearch-0.165/
search engine library 
----
LCFG-Build-Tools-0.0.56
http://search.cpan.org/~sjquinney/LCFG-Build-Tools-0.0.56/
LCFG software release tools 
----
LCFG-Build-VCS-0.0.32
http://search.cpan.org/~sjquinney/LCFG-Build-VCS-0.0.32/
LCFG version-control infrastructure 
----
LCFG-Build-VCS-0.0.33
http://search.cpan.org/~sjquinney/LCFG-Build-VCS-0.0.33/
LCFG version-control infrastructure 
----
Mail-Log-Parse-1.0301
http://search.cpan.org/~dstaal/Mail-Log-Parse-1.0301/
Parse and return info in maillogs 
----
Marpa-0.001_007
http://search.cpan.org/~jkegl/Marpa-0.001_007/
General BNF Parsing (Experimental version) 
----
Math-Modular-SquareRoot-1.001
http://search.cpan.org/~prbrenan/Math-Modular-SquareRoot-1.001/
Modular square roots 
----
MooseX-AttributeHelpers-0.17
http://search.cpan.org/~flora/MooseX-AttributeHelpers-0.17/
Extend your attribute interfaces 
----
MooseX-Getopt-0.18
http://search.cpan.org/~rjbs/MooseX-Getopt-0.18/
A Moose role for processing command line options 
----
MooseX-Role-RelatedClassRoles-0.002
http://search.cpan.org/~hdp/MooseX-Role-RelatedClassRoles-0.002/
Apply roles to a class related to yours 
----
Mouse-0.20
http://search.cpan.org/~sartak/Mouse-0.20/
Moose minus the antlers 
----
Net-Lookup-DotTel-0.01
http://search.cpan.org/~zebaz/Net-Lookup-DotTel-0.01/
Look up information related to a .tel domain name (or possible another domain name having .tel-style TXT and NAPTR records). 
----
Net-Patricia-1.14.50
http://search.cpan.org/~philipp/Net-Patricia-1.14.50/
Patricia Trie perl module for fast IP address lookups 
----
Net-Patricia-1.14.51
http://search.cpan.org/~philipp/Net-Patricia-1.14.51/
Patricia Trie perl module for fast IP address lookups 
----
Net-Patricia-1.14.52
http://search.cpan.org/~philipp/Net-Patricia-1.14.52/
Patricia Trie perl module for fast IP address lookups 
----
Numeric-LL_Array-0.02
http://search.cpan.org/~ilyaz/Numeric-LL_Array-0.02/
Perl extension for blah blah blah 
----
POE-Component-Client-DNS-Recursive-0.08
http://search.cpan.org/~bingos/POE-Component-Client-DNS-Recursive-0.08/
A recursive DNS client for POE 
----
POE-Component-Gearman-Client-0.01
http://search.cpan.org/~aar/POE-Component-Gearman-Client-0.01/
Asynchronous client module for Gearman for POE applications 
----
POE-Session-YieldCC-0.201
http://search.cpan.org/~rkitover/POE-Session-YieldCC-0.201/
POE::Session extension for using continuations 
----
Perl-Dist-WiX-0.169
http://search.cpan.org/~csjewell/Perl-Dist-WiX-0.169/
Experimental 4th generation Win32 Perl distribution builder 
----
RDF-Simple-0.409
http://search.cpan.org/~mthurn/RDF-Simple-0.409/
read and write RDF without complication 
----
Sphinx-Search-0.17
http://search.cpan.org/~jjschutz/Sphinx-Search-0.17/
Sphinx search engine API Perl client 
----
Sphinx-Search-0.18
http://search.cpan.org/~jjschutz/Sphinx-Search-0.18/
Sphinx search engine API Perl client 
----
Test-Classy-0.07
http://search.cpan.org/~ishigaki/Test-Classy-0.07/
write your unit tests in other modules than *.t 
----
Test-Declare-0.04
http://search.cpan.org/~nekokak/Test-Declare-0.04/
declarative testing 
----
Test-Regexp-2009040901
http://search.cpan.org/~abigail/Test-Regexp-2009040901/
Test your regular expressions 
----
Test-Snapshots-0.01
http://search.cpan.org/~szabgab/Test-Snapshots-0.01/
for testing stand alone scripts and executables 
----
UNIVERSAL-implant-0.01_01
http://search.cpan.org/~shelling/UNIVERSAL-implant-0.01_01/
UNIVERSAL Class::Implant 
----
UUID-Generator-PurePerl-0.03
http://search.cpan.org/~banb/UUID-Generator-PurePerl-0.03/
Universally Unique IDentifier (UUID) Generator 
----
UUID-Object-0.02
http://search.cpan.org/~banb/UUID-Object-0.02/
Universally Unique IDentifier (UUID) Object Class 
----
VMS-System-1_05
http://search.cpan.org/~cberry/VMS-System-1_05/
Retrieves status and identification information from OpenVMS system(s). 
----
WWW-Scripter-0.002
http://search.cpan.org/~sprout/WWW-Scripter-0.002/
For scripting web sites that have scripts 
----
Win32-FirewallParser-0.03
http://search.cpan.org/~ltriant/Win32-FirewallParser-0.03/
Microsoft Windows XP SP2 Firewall Log Parser 
----
Win32-Process-Hide-v0.2
http://search.cpan.org/~rootkwok/Win32-Process-Hide-v0.2/
Perl extension for hiding your process. 
----
Win32-Process-Kill-v1.0
http://search.cpan.org/~rootkwok/Win32-Process-Kill-v1.0/
Perl extension for Terminating Process in Win32 (R3) 
----
Win32-SysPrivilege-v1.4
http://search.cpan.org/~rootkwok/Win32-SysPrivilege-v1.4/
Perl extension for Running external programs with SYSTEM Privilege 
----
activitymail-1.26
http://search.cpan.org/~dwheeler/activitymail-1.26/
CVS activity notification 
----
local-lib-1.003003
http://search.cpan.org/~apeiron/local-lib-1.003003/
create and use a local lib/ for perl modules with PERL5LIB 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


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

Date: Thu, 9 Apr 2009 10:21:15 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Pipe Between Programs
Message-Id: <slrngts4jb.2fj.tadmc@tadmc30.sbcglobal.net>

E.D.G. <edgrsprj@ix.netcom.com> wrote:
> "Tad J McClellan" <tadmc@seesig.invalid> wrote in message 
> news:slrngtrnfe.v8s.tadmc@tadmc30.sbcglobal.net...


Including that means that you are going to quote something
that was written by Tad J McClellan.


>> E.D.G. <edgrsprj@ix.netcom.com> wrote:


Including that means that you are going to quote something
that was written by E.D.G. and quoted earlier by Tad J McClellan.


[ snip all original text with no quotes in it ]


Learn how to compose followups or cease making followups.


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


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

Date: Thu, 9 Apr 2009 10:29:30 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Pipe Between Programs
Message-Id: <slrngts52q.2fj.tadmc@tadmc30.sbcglobal.net>

E.D.G. <edgrsprj@ix.netcom.com> wrote:
> "Tad J McClellan" <tadmc@seesig.invalid> wrote in message 
> news:slrngtrnfe.v8s.tadmc@tadmc30.sbcglobal.net...
>> E.D.G. <edgrsprj@ix.netcom.com> wrote:
>
> I did check the Perl FAQ and did not understand the information.


Then you should ask a question about the parts of that information
that you do not understand.


> The "open gnuplot" command in the computer program I am already using has 
> the correct path in it.  I simply did not include it in my post.


So the code that you included in your post is not the code that
you are using?

Why then did you include it at all?


> That code does actually do a good job of starting and running the Gnuplot 
> program. 


The code that you posted does no such thing.

If "that code" refers to code that only you can see, then only
you can answer questions about it.

If you want us to help you with code, then you must show us
the code that you want help with.


> If it is not creating a "pipe" then what is that type of data 
> transfer mechanism called?


If you want us to help you with code, then you must show us
the code that you want help with.

Since the only code we've seen is what you've posted, the
type of data transfer shown in that code is called "reading from a file",
despite the fact that you attempt to write to the filehandle that
was opened only for reading.

There was no pipe on the code that you posted. If you think that there
is, then you are wrong somewhere. Figuring out where you are wrong
will likely go a long way toward figuring out how to fix problems
in code.


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


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

Date: Thu, 09 Apr 2009 23:42:14 -0400
From: TheGist <thegist@nospam.net>
Subject: Re: Pipe Between Programs
Message-Id: <grmf5a$52q$1@aioe.org>

Tad J McClellan wrote[a bunch of faggotry which has been snipped]

So, you are showing your massive asshole side.
I'd deride you more for it except you are directing it
at some random internet kook who believes he has esp or someshit.
You get a pass this time you fucking polesmoker. appeciate it.


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

Date: Thu, 9 Apr 2009 20:53:32 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: XML::LibXML UTF-8 toString() -vs- nodeValue()
Message-Id: <slrngtsh1d.9m5.hjp-usenet2@hrunkner.hjp.at>

On 2009-04-09 00:24, Ben Bullock <benkasminbullock@gmail.com> wrote:
> On Wed, 08 Apr 2009 10:16:54 -0700, MaggotChild wrote:
>
>> How can one tell that the string is UTF-8 without checking Perl's utf8
>> flag?
>> Or is this not possible?
>
> You can check whether a string is correctly encoded as UTF-8 by using
> the "decode_utf8" routine of the Encode module. If it is not UTF-8 you will
> get an error message.
>
> If you have a random stream of bytes and you want to check whether they
> might be correct UTF-8 or some other encoding, you could try Encode::Guess.
> (You can read my review of this module at 
> "cpanratings.perl.org/dist/Encode". My cpanratings name is "BKB".).
>
> If you want to know whether Perl has marked a string as being UTF-8, in
> other words whether Perl thinks that a string is UTF-8 or not, the only
> way of doing this is to look at Perl's flag, using utf8::is_utf8 or
> the similar routine in Encode.

The (stupidly named) utf8 flag doesn't indicate whether perl thinks that
a string is UTF-8 or not. It indicates that the string is a character
string, i.e., each element of the string is a character, not a byte.

(The utf8 flag is called the utf8 flag because character strings are
encoded internally as UTF-8. But as a Perl programmer you don't have to
know that, just like you don't have to know how numbers are stored or
how the hash algorithm works. You just have to know that characters are
32-bit values and that ord() of a character returns the unicode code
point.)

	hp


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

Date: 10 Apr 2009 01:48:23 GMT
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: XML::LibXML UTF-8 toString() -vs- nodeValue()
Message-Id: <49dea566$0$31424$c5fe31e7@read01.usenet4all.se>

On Thu, 09 Apr 2009 20:53:32 +0200, Peter J. Holzer wrote:

> On 2009-04-09 00:24, Ben Bullock <benkasminbullock@gmail.com> wrote:

>> If you want to know whether Perl has marked a string as being UTF-8, in
>> other words whether Perl thinks that a string is UTF-8 or not, the only
>> way of doing this is to look at Perl's flag, using utf8::is_utf8 or
>> the similar routine in Encode.
> 
> The (stupidly named) utf8 flag doesn't indicate whether perl thinks that
> a string is UTF-8 or not.

Yes, it does. If I have a string

my $p = "XYZ"; 

where "XYZ" are three bytes of a single character encoded as UTF-8 in the 
text of the program (ie I have asked my text editor to save in the UTF-8 
form), then if I have the line

use utf8;

at the top of my program, Perl will set the "utf8 flag" on $p and will 
act as if this multibyte UTF-8 character is a single item, for example 
length ($p) == 1. If I do not have the use utf8; line in the program, 
Perl will not set the utf8 flag on $p and I will get length ($p) == 3 
instead of 1. Thus the string may actually be UTF-8 even when Perl's flag 
is not set.




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

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


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