Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Seekers of Perl Wisdom

( #479=superdoc: print w/replies, xml ) Need Help??

If you have a question on how to do something in Perl, or you need a Perl solution to an actual real-life problem, or you're unsure why something you've tried just isn't working... then this section is the place to ask. Post a new question!

However, you might consider asking in the chatterbox first (if you're a registered user). The response time tends to be quicker, and if it turns out that the problem/solutions are too much for the cb to handle, the kind monks will be sure to direct you here.

User Questions
Constants lists in array slices
4 direct replies — Read more / Contribute
by LanX
on Jul 20, 2018 at 07:40
    The following code is surprising me in two ways:

    use strict; use warnings; use feature 'say'; use constant FL => 17,3,16; use constant FL2 => 22,4,13; my @row= "a".."z"; my @a = (" ") x 26; @a[17,3,16] = @row[22,4,13]; say "@a"; @a = (" ") x 26; @a[FL()] = @row[FL2]; say "@a";

    It seems like constant folding isn't happening at all!!!

    • I get a warning for FL2
      Scalar value @row[FL2] better written as $row[FL2] (ignoring that its a constant _list_)
    • Deparsing the code shows that FL and FL2 are called as functions
      @a[FL()] = @row[FL2()];
    Am I missing something?

    (This is perl 5, version 16,)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Writing IBM Mainframe floating point
3 direct replies — Read more / Contribute
by caden_varn
on Jul 20, 2018 at 06:19
    I need to create a file including single precision floating point fields in the IBM mainframe format (specifically to be read by the SAS s370frb4. informat). I am on an HP-UX 11 box which evidently uses a different floating point - when I use pack's 'f' option the value changes when read in by the SAS program on the other end. Is there an option or module that can do this easily? Any help greatefully received...
get text from node - XML::LibXML
5 direct replies — Read more / Contribute
by corfuitl
on Jul 20, 2018 at 05:36

    Hi all

    I have the XML file

    <seg><foo mid="0" mtype="seg"><g id="1">Need to export this text</g></foo></seg>

    and I would like to get the text with its XML tags (i.e. <g id="1">Need to export this text</g>

    for my $foo ($seg->findnodes('foo')) { my $mid = ($foo->findvalue('@mid')); my $mrktext = ($foo->findnodes('text()')); print "$mid $mrktext\n"; }

    I use this but it doesn't export any text.

Loading modules remotely
6 direct replies — Read more / Contribute
by bliako
on Jul 20, 2018 at 05:29

    Dear Monks,

    I would like to know if there is already a Perl module which provides a network server for serving Perl modules from a remote location and a directive to be embeded in a perl script so as to load said modules from the server. Preferably using encryption.

    For example,

    use Module::X from 192.32.43.45:7777 ssh='.ssh/id_rsa';

    thanks, bliako

Perl dictionary
5 direct replies — Read more / Contribute
by dideod.yang
on Jul 19, 2018 at 20:03
    Hi monks. I am perl & python lover.. recently I made many scripy using perl.. So I want to know many functions as much as possible. Cpan give me many information about modules.. but function is not.. Do you monks have nice website? or manual? about perl function??
site_perl files
3 direct replies — Read more / Contribute
by yaklichk0719
on Jul 19, 2018 at 17:00
    Can somebody please explain me what should be in the folder perl5.10/lib/site_perl/? I have perl 5.10.1 under centOS 6.6 and it does not have site_perl. Another package that I have been been trying to run requires the presence of this path perl5.10/lib/site_perl. Where can I download files for this site_perl? Please help me to figure this out. I really appreciate it.
occurence of repeated numbers group
5 direct replies — Read more / Contribute
by satya02
on Jul 19, 2018 at 09:42

    Please help me in finding occurence of repeated numbers group.

    Example input:

    1 2 5 9

    1 2 5 10

    4 5 10 12

    5 9 10 11

    output:-

    1 2 repated 2 times

    2 5 repeated 2 times

    5 10 repeated 3 times

I need help installing DBD:Oracle and DBD
1 direct reply — Read more / Contribute
by gandolf989
on Jul 19, 2018 at 09:33

    I am trying to install DBD:Oracle and DBD so that I can write a script to clean up some attachments with our primary database, and change the pointers to show that the attachments are gone. But I ran into an issue with the above packages. I tried the initial install using cpan. but I did not have the environment variables set, so it did not compile correctly. I would like to remove and reinstall the packages, or mostly just get them working. I do have an 11.2.0.4 Oracle client on the server. But I will be connecting to another server for the database.

    Can someone point me in the right direction. The server is Redhat 6.8. Thanks

    $:~/ ./runMyPerlScript.pl Can't load '/usr/local/lib/perl5/site_perl/5.28.0/x86_64-linux/auto/DB +I/DBI.so' for module DBI: /usr/local/lib/perl5/site_perl/5.28.0/x86_6 +4-linux/auto/DBI/DBI.so: undefined symbol: PL_sv_immortals at /usr/li +b64/perl5/DynaLoader.pm line 200. at /usr/local/lib/perl5/site_perl/5.28.0/x86_64-linux/DBI.pm line 284 +. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5. +28.0/x86_64-linux/DBI.pm line 284. Compilation failed in require at /usr/local/lib/perl5/site_perl/5.28.0 +/x86_64-linux/DBD/Oracle.pm line 20. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5. +28.0/x86_64-linux/DBD/Oracle.pm line 20. Compilation failed in require at /home/oracle/scripts/purge_proddoc_sc +ript/purge_proddoc_script.pl line 16. BEGIN failed--compilation aborted at /home/oracle/scripts/purge_proddo +c_script/purge_proddoc_script.pl line 16 (#1) (F) The module you tried to load failed to load a dynamic extensio +n. This may either mean that you upgraded your version of perl to one that + is incompatible with your old dynamic extensions (which is known to h +appen between major versions of perl), or (more likely) that your dynami +c extension was built against an older version of the library that i +s installed on your system. You may need to rebuild your old dynamic extensions. Uncaught exception from user code: Can't load '/usr/local/lib/perl5/site_perl/5.28.0/x86_64-linux +/auto/DBI/DBI.so' for module DBI: /usr/local/lib/perl5/site_perl/5.28 +.0/x86_64-linux/auto/DBI/DBI.so: undefined symbol: PL_sv_immortals at + /usr/lib64/perl5/DynaLoader.pm line 200. at /usr/local/lib/perl5/site_perl/5.28.0/x86_64-linux/DBI.pm line 284 +. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5. +28.0/x86_64-linux/DBI.pm line 284. Compilation failed in require at /usr/local/lib/perl5/site_perl/5.28.0 +/x86_64-linux/DBD/Oracle.pm line 20. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5. +28.0/x86_64-linux/DBD/Oracle.pm line 20. Compilation failed in require at /home/oracle/scripts/purge_proddoc_sc +ript/purge_proddoc_script.pl line 16. BEGIN failed--compilation aborted at /home/oracle/scripts/purge_proddo +c_script/purge_proddoc_script.pl line 16. at /home/oracle/scripts/purge_proddoc_script/purge_proddoc_script.pl +line 16. $:~/scripts/purge_proddoc_script > cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.8 (Santiago)
    #!/usr/bin/perl use strict; use warnings; use diagnostics; package purge_proddoc_script; use Getopt::Std; # use Sys::Hostname; use POSIX qw(setuid setgid); use English; use Carp; use Cwd 'abs_path'; use DBD::Oracle qw(:ora_session_modes); use DBI; use File::Basename; use IO::Handle; use Log::Log4perl qw( :easy ); use Text::Diff; local $SIG{__WARN__} = \&Carp::cluck; $SIG{__DIE__} = sub { # return if $^S; # ignore die in an eval block # Get the actual caller for the "die" and not the wrapper local $Log::Log4perl::caller_depth; $Log::Log4perl::caller_depth++; LOGDIE($_[0]); }; # possible log values: DEBUG, INFO, WARN, ERROR, FATAL my $debug_level="INFO"; # my $error_mail_list='bbyrd@aires.com, ASayed@aires.com, vkamins@aire +s.com, RKatru@aires.com'; my $error_mail_list='bbyrd@aires.com'; # Unbuffer STDOUT and STDERR select STDERR; $| = 1; select STDOUT; $| = 1;
Migrating from Windows Server 2003
6 direct replies — Read more / Contribute
by cochise33
on Jul 19, 2018 at 08:26
    I'm running Perl on a Windows 2003 Server. The time has come to finally move to a more current version of Windows and I was wondering if you guys have any suggestions or warnings. Am I going to have any problems with Windows Server 12 or 16?

    Though I've used Perl for 20 years, I've only installed/reinstalled it or any packages like GD or some .pdf scripts a couple of times, so from that angle I'm a beginner.

    We also use MDaemon for the email part of what we do.

    Thanks for any help,

    Steve
Use Protocol::WebSocket::Client in HTTPS mode?
1 direct reply — Read more / Contribute
by larrymcp
on Jul 19, 2018 at 02:55

    I need to communicate with a Websockets server that expects HTTPS. I'm doing some initial tests using the wsconsole example script that comes with Protocol::WebSocket::Client.

    When the script connects to the server on port 443, the server responds:

        400 Bad Request
        The plain HTTP request was sent to HTTPS port

    It appears that for some reason the wsconsole script is not using HTTPS, even though I did preface the URL with "wss://" and I did specify port 443. Is there something I need to do, some parameter I need to specify, to tell it to use HTTPS when communicating with the server?

    Thanks very much!


Add your question
Title:
Your question:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":


  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (2)
    As of 2018-07-21 23:47 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















      Results (450 votes). Check out past polls.

      Notices?