Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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
Perl/Tk Version Dependency Issue
2 direct replies — Read more / Contribute
by rkabhi
on May 24, 2016 at 02:54
    Hello Perl Monks !!

    I need a Perl/Tk module which works with different versions of perl. We use Perl/Tk to create many scripts in our organisation. But the problem that we found lately was that we have different perl versions at different site locations.

    My observations so far:
    1) Tried invoking perl v5.10.1 to use Perl/Tk module that used to work fine with perl v5.8.8. There was a symbol lookup error pointed. After checking the online stuff for similar errors, I learnt that I will need to change the perl module.

    2) Installed Perl/Tk for perl v5.10.1. However, I landed up on similar error when tried using this newly downloaded Perl/Tk module with per v5.22.1. Also, I found that this newly downloaded Perl/Tk module for perl v5.10.1 is not working with perl v5.8.8

    3) Installed Perl/Tk for perl v5.22.1. This time I landed up in issues when I used this newly dowloaded Perl/Tk module with perl v5.10.1 or perl v5.8.8. The error said somewhat like this "Can't load" which again appeared as version dependency of Perl/Tk as it worked well with perl version for which it was downloaded.

    From above observations, one would assume that Perl/Tk module has a huge dependency on Perl versions. Everytime you upgrade your perl version, you need to also download a new compatible Perl/Tk module.

    The support I seek here is to answer below questions:

    Q-1) Is there any way that I can get a single Perl/Tk module which works for different Perl versions (or at least perl versions higher or same as perl v5.8.8)?

    Q-2) If the answer to above question is "Not Possible!". Then is it really wise to use Perl/Tk module in the projects? I assume here that there will be many other users who might have faced this problem. But to my surprise I could not find any reasonable help online. Requesting all perlmonks to throw some light here.

    Info that might be needed to refer:
    => OS used: Redhat Enterprise Linux Client (Release 6.7)
    => calling Tk module using "use Tk". The errors mentioned above are shown at this line.
    => Testing for a given Perl/Tk module with different perl version was done on different machines that has different perl versions installed
    => ______ - Let me know if any further info is needed.

    Thanks a lot for your support !!
Define regex substitution $1,$2,... from a string
2 direct replies — Read more / Contribute
by sylph001
on May 24, 2016 at 01:49

    Dear monks,

    Today I'm trying to define a regex substitution from a parameter which is received from outside.

    In the s/<regex>/<replacement>/ structure, both the <regex> and the <replacement> are passed from other strings.

    Seems the <regex> part works well, however for the <replacement> part, there is a '$1' to capture what's matched from the <regex> part and this seems not working.

    In fact, it looks like the '$1' was not interpretted at all.


    My script is like the following:

    $a = ''; $from = 'aaa.*\/(.+)$'; $to = 'file_publish?file=$1'; $a =~s/$from/$to/i; print "\$1: $1\n"; print "RESUTL: $a\n";


    The result is like:

    > ./


    But what I need is to replace the '$1' with the actual file name '', so the result I actually need is like:



    My monks, could you please cast your light of wisdom on me to help me get the '$1' work regex substitution?


    My best wishes

Net::RabbitMQ can't make, help me~ thanks all!
1 direct reply — Read more / Contribute
by Perl_Love
on May 23, 2016 at 23:23
    [root@localhost /]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1- +noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:langu +ages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.2.1511 (Core) Release: 7.2.1511 Codename: Core [root@localhost /]# perl -V Summary of my perl5 (revision 5 version 16 subversion 3) configuration +: Platform: osname=linux, osvers=2.6.32-220.17.1.el6.x86_64, archname=x86_64-l +inux-thread-multi uname='linux 2.6.32-220.17.1.el6.x86_64 #1 + smp wed may 16 00:01:37 bst 2012 x86_64 x86_64 x86_64 gnulinux ' config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOU +RCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 + -grecord-gcc-switches -m64 -mtune=generic -Dccdlflags=-Wl,--enable +-new-dtags -Dlddlflags=-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOUR +CE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 +-grecord-gcc-switches -m64 -mtune=generic -Wl,-z,relro -DDEBUGGING +=-g -Dversion=5.16.3 -Dmyhostname=localhost -Dperladmin=root@localhos +t -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr -Dvendorprefix=/usr -D +siteprefix=/usr/local -Dsitelib=/usr/local/share/perl5 -Dsitearch=/us +r/local/lib64/perl5 -Dprivlib=/usr/share/perl5 -Dvendorlib=/usr/share +/perl5/vendor_perl -Darchlib=/usr/lib64/perl5 -Dvendorarch=/usr/lib64 +/perl5/vendor_perl -Darchname=x86_64-linux-thread-multi -Dlibpth=/usr +/local/lib64 /lib64 /usr/lib64 -Duseshrplib -Dusethreads -Duseithread +s -Dusedtrace=/usr/bin/dtrace -Duselargefiles -Dd_semctl_semun -Di_db + -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -D +installusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/le +ss -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_ +r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endserven +t_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/bin -Dusesitecustom +ize' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=und +ef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasin +g -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D +_FILE_OFFSET_BITS=64', optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions +-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switc +hes -m64 -mtune=generic', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -f +stack-protector -I/usr/local/include' ccversion='', gccversion='4.8.5 20150623 (Red Hat 4.8.5-4)', gccos +andvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='gcc', ldflags =' -fstack-protector' libpth=/usr/local/lib64 /lib64 /usr/lib64 libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread +-lc -lgdbm_compat perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=, so=so, useshrplib=true, gnulibc_version='2.17' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,--en +able-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_F +ORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buf +fer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Wl,-z,relro ' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT +_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API USE_SITECUSTOMIZE Locally applied patches: Fedora Patch1: Removes date check, Fedora/RHEL specific Fedora Patch3: support for libdir64 Fedora Patch4: use libresolv instead of libbind Fedora Patch5: USE_MM_LD_RUN_PATH Fedora Patch6: Skip hostname tests, due to builders not being netw +ork capable Fedora Patch7: Dont run one io test due to random builder failures Fedora Patch9: Fix find2perl to translate ? glob properly (RT#1130 +54) Fedora Patch10: Fix broken atof (RT#109318) Fedora Patch13: Clear $@ before "do" I/O error (RT#113730) Fedora Patch14: Do not truncate syscall() return value to 32 bits +(RT#113980) Fedora Patch15: Override the Pod::Simple::parse_file (CPANRT#77530 +) Fedora Patch16: Do not leak with attribute on my variable (RT#1147 +64) Fedora Patch17: Allow operator after numeric keyword argument (RT# +105924) Fedora Patch18: Extend stack in File::Glob::glob, (RT#114984) Fedora Patch19: Do not crash when vivifying $| Fedora Patch20: Fix misparsing of maketext strings (CVE-2012-6329) Fedora Patch21: Add NAME headings to CPAN modules (CPANRT#73396) Fedora Patch22: Fix leaking tied hashes (RT#107000) [1] Fedora Patch23: Fix leaking tied hashes (RT#107000) [2] Fedora Patch24: Fix leaking tied hashes (RT#107000) [3] Fedora Patch25: Fix dead lock in PerlIO after fork from thread (RT +#106212) Fedora Patch26: Make regexp safe in a signal handler (RT#114878) Fedora Patch27: Update h2ph(1) documentation (RT#117647) Fedora Patch28: Update pod2html(1) documentation (RT#117623) Fedora Patch29: Document Math::BigInt::CalcEmu requires Math::BigI +nt (CPAN RT#85015) RHEL Patch30: Use stronger algorithm needed for FIPS in t/op/crypt +.t (RT#121591) RHEL Patch31: Make *DBM_File desctructors thread-safe (RT#61912) RHEL Patch32: Use stronger algorithm needed for FIPS in t/op/taint +.t (RT#123338) RHEL Patch33: Remove CPU-speed-sensitive test in Benchmark test Built under linux Compiled at Nov 20 2015 03:29:53 %ENV: PERL5LIB="/root/perl5/lib/perl5:" PERL_LOCAL_LIB_ROOT=":/root/perl5" PERL_MB_OPT="--install_base /root/perl5" PERL_MM_OPT="INSTALL_BASE=/root/perl5" @INC: /root/perl5/lib/perl5/x86_64-linux-thread-multi /root/perl5/lib/perl5 /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . [root@localhost Net--RabbitMQ-0.2.8]# perl Makefile.PL Writing Makefile for Net::RabbitMQ Writing MYMETA.yml and MYMETA.json [root@localhost Net--RabbitMQ-0.2.8]# make Skip blib/lib/Net/ (unchanged) Skip blib/lib/Net/ (unchanged) gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack +-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BI +TS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack +-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m6 +4 -mtune=generic -DVERSION=\"0.2.8\" -DXS_VERSION=\"0.2.8\" -fPIC " +-I/usr/lib64/perl5/CORE" RabbitMQ.c RabbitMQ.xs: In function ‘internal_recv’: RabbitMQ.xs:185:11: warning: unused variable ‘val’ [-Wunused-variable] SV *val; ^ RabbitMQ.xs: In function ‘hash_to_amqp_table’: RabbitMQ.xs:252:3: warning: implicit declaration of function ‘amqp_cre +ate_table’ [-Wimplicit-function-declaration] amqp_create_table(conn, table, HvKEYS(hash)); ^ RabbitMQ.xs:263:7: warning: implicit declaration of function ‘amqp_tab +le_add_string’ [-Wimplicit-function-declaration] amqp_table_add_string(conn, table, amqp_cstring_bytes(key), amq +p_cstring_bytes(SvPV_nolen(value))); ^ RabbitMQ.xs:265:7: warning: implicit declaration of function ‘amqp_tab +le_add_int’ [-Wimplicit-function-declaration] amqp_table_add_int(conn, table, amqp_cstring_bytes(key), (uint6 +4_t) SvIV(value)); ^ RabbitMQ.c: In function ‘XS_Net__RabbitMQ_exchange_declare’: RabbitMQ.c:605:7: warning: variable ‘args’ set but not used [-Wunused- +but-set-variable] HV * args; ^ RabbitMQ.xs: In function ‘XS_Net__RabbitMQ_ack’: RabbitMQ.xs:527:7: warning: pointer targets in assignment differ in si +gnedness [-Wpointer-sign] l = SvPV(delivery_tag, len); ^ RabbitMQ.xs: In function ‘XS_Net__RabbitMQ_reject’: RabbitMQ.xs:545:6: warning: pointer targets in assignment differ in si +gnedness [-Wpointer-sign] l = SvPV(delivery_tag, len); ^ RabbitMQ.c: In function ‘XS_Net__RabbitMQ__publish’: RabbitMQ.xs:575:11: warning: unused variable ‘exchange’ [-Wunused-vari +able] char *exchange = ""; ^ RabbitMQ.c: In function ‘XS_Net__RabbitMQ_new’: RabbitMQ.c:1510:9: warning: unused variable ‘clazz’ [-Wunused-variable +] char * clazz = (char *)SvPV_nolen(ST(0)) ^ RabbitMQ.c: In function ‘XS_Net__RabbitMQ_tx_select’: RabbitMQ.c:1636:7: warning: variable ‘args’ set but not used [-Wunused +-but-set-variable] HV * args; ^ RabbitMQ.c: In function ‘XS_Net__RabbitMQ_tx_commit’: RabbitMQ.c:1689:7: warning: variable ‘args’ set but not used [-Wunused +-but-set-variable] HV * args; ^ RabbitMQ.c: In function ‘XS_Net__RabbitMQ_tx_rollback’: RabbitMQ.c:1742:7: warning: variable ‘args’ set but not used [-Wunused +-but-set-variable] HV * args; ^ gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack +-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BI +TS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack +-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m6 +4 -mtune=generic -DVERSION=\"0.2.8\" -DXS_VERSION=\"0.2.8\" -fPIC " +-I/usr/lib64/perl5/CORE" amqp_api.c gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack +-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BI +TS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack +-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m6 +4 -mtune=generic -DVERSION=\"0.2.8\" -DXS_VERSION=\"0.2.8\" -fPIC " +-I/usr/lib64/perl5/CORE" amqp_connection.c gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack +-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BI +TS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack +-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m6 +4 -mtune=generic -DVERSION=\"0.2.8\" -DXS_VERSION=\"0.2.8\" -fPIC " +-I/usr/lib64/perl5/CORE" amqp_debug.c gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack +-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BI +TS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack +-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m6 +4 -mtune=generic -DVERSION=\"0.2.8\" -DXS_VERSION=\"0.2.8\" -fPIC " +-I/usr/lib64/perl5/CORE" amqp_framing.c gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack +-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BI +TS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack +-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m6 +4 -mtune=generic -DVERSION=\"0.2.8\" -DXS_VERSION=\"0.2.8\" -fPIC " +-I/usr/lib64/perl5/CORE" amqp_mem.c gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack +-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BI +TS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack +-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m6 +4 -mtune=generic -DVERSION=\"0.2.8\" -DXS_VERSION=\"0.2.8\" -fPIC " +-I/usr/lib64/perl5/CORE" amqp_socket.c gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack +-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BI +TS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack +-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m6 +4 -mtune=generic -DVERSION=\"0.2.8\" -DXS_VERSION=\"0.2.8\" -fPIC " +-I/usr/lib64/perl5/CORE" amqp_table.c Running Mkbootstrap for Net::RabbitMQ () chmod 644 rm -f blib/arch/auto/Net/RabbitMQ/ gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions - +fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switch +es -m64 -mtune=generic -Wl,-z,relro RabbitMQ.o amqp_api.o amqp_conne +ction.o amqp_debug.o amqp_framing.o amqp_mem.o amqp_socket.o amqp_tab +le.o -o blib/arch/auto/Net/RabbitMQ/ \ \ chmod 755 blib/arch/auto/Net/RabbitMQ/ cp blib/arch/auto/Net/RabbitMQ/ chmod 644 blib/arch/auto/Net/RabbitMQ/ Manifying blib/man3/Net::RabbitMQ.3pm /usr/bin/perl "-Iblib/arch" "-Iblib/lib" ._Makefile.PL ._Makefile Unrecognized character \x05; marked by <-- HERE after <-- HERE near co +lumn 2 at ._Makefile.PL line 1. make: *** [._Makefile] Error 255 [root@localhost Net--RabbitMQ-0.2.8]#
what is a pure perl equivalent for "net user username /domain"?
2 direct replies — Read more / Contribute
by kwolcott
on May 23, 2016 at 14:49
    Hi; what is a pure perl equivalent for "net user username /domain"? I need to programmatically remove inactive accounts (defined as those no longer employed by the firm) and the mechanism I currently am using, via Perl on Cygwin is to run "net user username /domain" for every username that I have for the two applications for which I am responsible for account management. Is there a Pure Perl module that will return a yes/no answer to the question "is xyz currently an employee?" Thanks, Ken Wolcott
Verilog parse:vhier to get input/output ports
1 direct reply — Read more / Contribute
by perlUser345
on May 23, 2016 at 13:07
    Hey perl monks! I'm trying to parse a verilog file and would like to get all the module names, input/output port names, whether they're inputs/outputs and the input/output sizes for them. For example:
    module mux_test( din_0 , din_1 , sel , mux_out ); input din_0, din_1, sel ; output [7:0] mux_out; //just as an example //stuff, stuff, and more stuff endmodule
    I'd like to get: inputs = din_0, din_1, sel;
    input size = 1 (for each of them);
    outputs = mux_out;
    output size = 8;
    module name = mux_test.
    I tried using vhier but I could only get module names with: vhier <name> --modules
    Is there any other tool I can use to do this and an example related to mine above would be appreciated.
    Thanks for your help!
Progress count for save_content in WWW::Mechanize
2 direct replies — Read more / Contribute
by perlmad
on May 23, 2016 at 09:48

    Hi Folks

    I am using www::mechanize module to download a file from website and i could not find how long it's take to complete so i need a progress amount for downloading status, my code is shown below

    $mech->save_content($filename,":content_cb" => \&callback); sub callback { my( $data, $response, $proto ) = @_; $progress_amount+= length($data); my $size = $response->header('Content-Length'); print floor(($progress_amount/$size)*100),"% downloaded\n"; # +print percent downloaded }

    It is not working

    Any Idea...

[SOLVED]:Upgrading Perl 5.8 program to 5.22
3 direct replies — Read more / Contribute
by $h4X4_&#124;=73}{
on May 23, 2016 at 06:58

    I would like a Perl program I made years ago to run the latest version of Perl 5.22. But the biggest problem I face with this task is the size of the program. The only way I see this happening is if I rebuild the hole framework from scratch under 5.22 while trying to recycle and convert some methods.

    There is no other reason I can see why i need to upgrade other than the fact that the program is stuck at Perl 5.8 and to upgrade to 5.22 would need a major overhaul to the hole framework.

    Are there any advantages of using the latest Perl version that I missed?

    The lesson was... Don't use Exporter in a file you have named "exporter" to keep your variables in scope. But you can use Exporter in a file called "foo" and it will work fine.
perl ssh keystroke
3 direct replies — Read more / Contribute
by Visinescu
on May 23, 2016 at 05:22
    Hello, I have a perl script that wants to send a keystroke to end a process. I connect from an ubuntu system to windows with SSH and execute the script there but the keystroke is not sent ( I used Win32::GuiTest module ). Any ideas?
To find the Title of current page
1 direct reply — Read more / Contribute
by Anonymous Monk
on May 23, 2016 at 04:52

    Hi Monks

    I am using WWW::Mechanize module to extract hyperlinks and download a file from website

    I have a small problem to identify the file name of the current page

    $temp=""; $mech->get($temp); $mech->save_content();

    The above mentioned url is a pdf file link and url has only key value there is no extension or file name, my question is how do i extract the pdf file name? even i used $mech->title() to get title but it seems a null string only

    Any Idea...

Perl sha256 question
2 direct replies — Read more / Contribute
by Anonymous Monk
on May 23, 2016 at 03:13


    The output I am getting from SHA256 is different from what I get from other online tools:
    use Digest::SHA qw(sha256_hex); print sha256_hex(5472151337331275); # 32838cef9e4571b4fa9a5297e265cf860a31774de3ca339878d87238af604a45 #result from other online tools: # b5951ee4a7cbfdc9df6b1b74de2d1ba865de40796c756cebe88a806c5a7b9e60

    Am I missing something? Could someone enlighten me?

    Thanks in advance :)

Add your question
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?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (9)
    As of 2016-05-24 10:06 GMT
    Find Nodes?
      Voting Booth?